Exemplo n.º 1
0
 public QueryInformation GetQueryInformation(QueryInformationLevel queryInformationLevel)
 {
     return(QueryInformation.GetQueryInformation(InformationBytes, queryInformationLevel));
 }
Exemplo n.º 2
0
 public void SetQueryInformation(QueryInformation queryInformation)
 {
     InformationBytes = queryInformation.GetBytes();
 }
Exemplo n.º 3
0
 public static FileInformation ToFileInformation(QueryInformation queryInformation)
 {
     if (queryInformation is QueryFileBasicInfo)
     {
         QueryFileBasicInfo   queryFileBasicInfo = (QueryFileBasicInfo)queryInformation;
         FileBasicInformation result             = new FileBasicInformation();
         result.CreationTime   = queryFileBasicInfo.CreationTime;
         result.LastAccessTime = queryFileBasicInfo.LastAccessTime;
         result.LastWriteTime  = queryFileBasicInfo.LastWriteTime;
         result.ChangeTime     = queryFileBasicInfo.LastChangeTime;
         result.FileAttributes = (FileAttributes)queryFileBasicInfo.ExtFileAttributes;
         return(result);
     }
     else if (queryInformation is QueryFileStandardInfo)
     {
         QueryFileStandardInfo   queryFileStandardInfo = (QueryFileStandardInfo)queryInformation;
         FileStandardInformation result = new FileStandardInformation();
         result.AllocationSize = queryFileStandardInfo.AllocationSize;
         result.EndOfFile      = queryFileStandardInfo.EndOfFile;
         result.DeletePending  = queryFileStandardInfo.DeletePending;
         result.Directory      = queryFileStandardInfo.Directory;
         return(result);
     }
     else if (queryInformation is QueryFileEaInfo)
     {
         QueryFileEaInfo   queryFileEaInfo = (QueryFileEaInfo)queryInformation;
         FileEaInformation result          = new FileEaInformation();
         result.EaSize = queryFileEaInfo.EaSize;
         return(result);
     }
     else if (queryInformation is QueryFileNameInfo)
     {
         QueryFileNameInfo   queryFileNameInfo = (QueryFileNameInfo)queryInformation;
         FileNameInformation result            = new FileNameInformation();
         result.FileName = queryFileNameInfo.FileName;
         return(result);
     }
     else if (queryInformation is QueryFileAllInfo)
     {
         QueryFileAllInfo   queryFileAllInfo = (QueryFileAllInfo)queryInformation;
         FileAllInformation result           = new FileAllInformation();
         result.BasicInformation.CreationTime      = queryFileAllInfo.CreationTime;
         result.BasicInformation.LastAccessTime    = queryFileAllInfo.LastAccessTime;
         result.BasicInformation.LastWriteTime     = queryFileAllInfo.LastWriteTime;
         result.BasicInformation.ChangeTime        = queryFileAllInfo.LastChangeTime;
         result.BasicInformation.FileAttributes    = (FileAttributes)queryFileAllInfo.ExtFileAttributes;
         result.StandardInformation.AllocationSize = queryFileAllInfo.AllocationSize;
         result.StandardInformation.EndOfFile      = queryFileAllInfo.EndOfFile;
         result.StandardInformation.DeletePending  = queryFileAllInfo.DeletePending;
         result.StandardInformation.Directory      = queryFileAllInfo.Directory;
         result.EaInformation.EaSize     = queryFileAllInfo.EaSize;
         result.NameInformation.FileName = queryFileAllInfo.FileName;
         return(result);
     }
     else if (queryInformation is QueryFileAltNameInfo)
     {
         QueryFileAltNameInfo         queryFileAltNameInfo = (QueryFileAltNameInfo)queryInformation;
         FileAlternateNameInformation result = new FileAlternateNameInformation();
         result.FileName = queryFileAltNameInfo.FileName;
         return(result);
     }
     else if (queryInformation is QueryFileStreamInfo)
     {
         QueryFileStreamInfo   queryFileStreamInfo = (QueryFileStreamInfo)queryInformation;
         FileStreamInformation result = new FileStreamInformation();
         result.Entries.AddRange(queryFileStreamInfo.Entries);
         return(result);
     }
     else if (queryInformation is QueryFileCompressionInfo)
     {
         QueryFileCompressionInfo   queryFileCompressionInfo = (QueryFileCompressionInfo)queryInformation;
         FileCompressionInformation result = new FileCompressionInformation();
         result.CompressedFileSize   = queryFileCompressionInfo.CompressedFileSize;
         result.CompressionFormat    = queryFileCompressionInfo.CompressionFormat;
         result.CompressionUnitShift = queryFileCompressionInfo.CompressionUnitShift;
         result.ChunkShift           = queryFileCompressionInfo.ChunkShift;
         result.ClusterShift         = queryFileCompressionInfo.ClusterShift;
         result.Reserved             = queryFileCompressionInfo.Reserved;
         return(result);
     }
     else
     {
         throw new NotImplementedException();
     }
 }