Преглед на файлове

NetBios: NameFlags: Added explicit conversion from ushort

Tal Aloni преди 5 години
родител
ревизия
3c67594c73
променени са 1 файла, в които са добавени 9 реда и са изтрити 1 реда
  1. 9 1
      SMBLibrary/NetBios/NameServicePackets/EnumStructures/NameFlags.cs

+ 9 - 1
SMBLibrary/NetBios/NameServicePackets/EnumStructures/NameFlags.cs

@@ -1,4 +1,4 @@
-/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
+/* Copyright (C) 2014-2020 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  * 
  * You can redistribute this program and/or modify it under the terms of
  * the GNU Lesser Public License as published by the Free Software Foundation,
@@ -34,5 +34,13 @@ namespace SMBLibrary.NetBios
             }
             return value;
         }
+
+        public static explicit operator NameFlags(ushort value)
+        {
+            NameFlags result = new NameFlags();
+            result.NodeType = (OwnerNodeType)((value >> 13) & 0x3);
+            result.WorkGroup = (value & 0x8000) > 0;
+            return result;
+        }
     }
 }