Procházet zdrojové kódy

FileSystemInformation: Added GetFileSystemInformation method

Tal Aloni před 7 roky
rodič
revize
1fbd003b0d

+ 25 - 0
SMBLibrary/NTFileStore/Structures/FileSystemInformation/FileSystemInformation.cs

@@ -30,5 +30,30 @@ namespace SMBLibrary
         {
             get;
         }
+
+        public static FileSystemInformation GetFileSystemInformation(byte[] buffer, int offset, FileSystemInformationClass informationClass)
+        {
+            switch (informationClass)
+            {
+                case FileSystemInformationClass.FileFsVolumeInformation:
+                    return new FileFsVolumeInformation(buffer, offset);
+                case FileSystemInformationClass.FileFsSizeInformation:
+                    return new FileFsSizeInformation(buffer, offset);
+                case FileSystemInformationClass.FileFsDeviceInformation:
+                    return new FileFsDeviceInformation(buffer, offset);
+                case FileSystemInformationClass.FileFsAttributeInformation:
+                    return new FileFsAttributeInformation(buffer, offset);
+                case FileSystemInformationClass.FileFsControlInformation:
+                    return new FileFsControlInformation(buffer, offset);
+                case FileSystemInformationClass.FileFsFullSizeInformation:
+                    return new FileFsFullSizeInformation(buffer, offset);
+                case FileSystemInformationClass.FileFsObjectIdInformation:
+                    return new FileFsObjectIdInformation(buffer, offset);
+                case FileSystemInformationClass.FileFsSectorSizeInformation:
+                    return new FileFsSectorSizeInformation(buffer, offset);
+                default:
+                    throw new UnsupportedInformationLevelException();
+            }
+        }
     }
 }