Exemplo n.º 1
0
        internal FILEDESCRIPTOR ToFileDescriptor()
        {
            FILEDESCRIPTOR filedescriptor = new FILEDESCRIPTOR();

            filedescriptor.dwFlags   = FileDescriptorFlags.FD_FILESIZE;
            filedescriptor.cFileName = this.Name;
            if (this.Contents != null)
            {
                NativeUtilities.GetWords(this.Contents.LongLength, out filedescriptor.nFileSizeHigh, out filedescriptor.nFileSizeLow);
            }
            if (this.Attributes != FileAttributes.Normal)
            {
                filedescriptor.dwFileAttributes = (uint)this.Attributes;
                filedescriptor.dwFlags         |= FileDescriptorFlags.FD_ATTRIBUTES;
            }
            if (this.CreationTime != DateTime.MinValue)
            {
                NativeUtilities.GetWords(this.CreationTime.ToFileTime(), out filedescriptor.ftCreationTime.dwHighDateTime, out filedescriptor.ftCreationTime.dwLowDateTime);
                filedescriptor.dwFlags |= FileDescriptorFlags.FD_CREATETIME;
            }
            if (this.LastAccessTime != DateTime.MinValue)
            {
                NativeUtilities.GetWords(this.LastAccessTime.ToFileTime(), out filedescriptor.ftLastAccessTime.dwHighDateTime, out filedescriptor.ftLastAccessTime.dwLowDateTime);
                filedescriptor.dwFlags |= FileDescriptorFlags.FD_ACCESSTIME;
            }
            if (this.LastWriteTime != DateTime.MinValue)
            {
                NativeUtilities.GetWords(this.LastWriteTime.ToFileTime(), out filedescriptor.ftLastWriteTime.dwHighDateTime, out filedescriptor.ftLastWriteTime.dwLowDateTime);
                filedescriptor.dwFlags |= FileDescriptorFlags.FD_WRITESTIME;
            }
            return(filedescriptor);
        }
Exemplo n.º 2
0
        internal static VirtualFile FromFileDescriptor(FILEDESCRIPTOR fd)
        {
            VirtualFile virtualFile = new VirtualFile();

            virtualFile.Name = fd.cFileName;
            if ((fd.dwFlags & FileDescriptorFlags.FD_ATTRIBUTES) == FileDescriptorFlags.FD_ATTRIBUTES)
            {
                virtualFile.Attributes = (FileAttributes)fd.dwFileAttributes;
            }
            if ((fd.dwFlags & FileDescriptorFlags.FD_CREATETIME) == FileDescriptorFlags.FD_CREATETIME)
            {
                virtualFile.CreationTime = NativeUtilities.ToDateTime(fd.ftCreationTime);
            }
            if ((fd.dwFlags & FileDescriptorFlags.FD_ACCESSTIME) == FileDescriptorFlags.FD_ACCESSTIME)
            {
                virtualFile.LastAccessTime = NativeUtilities.ToDateTime(fd.ftLastAccessTime);
            }
            if ((fd.dwFlags & FileDescriptorFlags.FD_WRITESTIME) == FileDescriptorFlags.FD_WRITESTIME)
            {
                virtualFile.LastWriteTime = NativeUtilities.ToDateTime(fd.ftLastWriteTime);
            }
            return(virtualFile);
        }
Exemplo n.º 3
0
 internal FILEDESCRIPTOR ToFileDescriptor()
 {
     FILEDESCRIPTOR filedescriptor = new FILEDESCRIPTOR();
     filedescriptor.dwFlags = FileDescriptorFlags.FD_FILESIZE;
     filedescriptor.cFileName = this.Name;
     if (this.Contents != null)
         NativeUtilities.GetWords(this.Contents.LongLength, out filedescriptor.nFileSizeHigh, out filedescriptor.nFileSizeLow);
     if (this.Attributes != FileAttributes.Normal)
     {
         filedescriptor.dwFileAttributes = (uint)this.Attributes;
         filedescriptor.dwFlags |= FileDescriptorFlags.FD_ATTRIBUTES;
     }
     if (this.CreationTime != DateTime.MinValue)
     {
         NativeUtilities.GetWords(this.CreationTime.ToFileTime(), out filedescriptor.ftCreationTime.dwHighDateTime, out filedescriptor.ftCreationTime.dwLowDateTime);
         filedescriptor.dwFlags |= FileDescriptorFlags.FD_CREATETIME;
     }
     if (this.LastAccessTime != DateTime.MinValue)
     {
         NativeUtilities.GetWords(this.LastAccessTime.ToFileTime(), out filedescriptor.ftLastAccessTime.dwHighDateTime, out filedescriptor.ftLastAccessTime.dwLowDateTime);
         filedescriptor.dwFlags |= FileDescriptorFlags.FD_ACCESSTIME;
     }
     if (this.LastWriteTime != DateTime.MinValue)
     {
         NativeUtilities.GetWords(this.LastWriteTime.ToFileTime(), out filedescriptor.ftLastWriteTime.dwHighDateTime, out filedescriptor.ftLastWriteTime.dwLowDateTime);
         filedescriptor.dwFlags |= FileDescriptorFlags.FD_WRITESTIME;
     }
     return filedescriptor;
 }
Exemplo n.º 4
0
 internal static VirtualFile FromFileDescriptor(FILEDESCRIPTOR fd)
 {
     VirtualFile virtualFile = new VirtualFile();
     virtualFile.Name = fd.cFileName;
     if ((fd.dwFlags & FileDescriptorFlags.FD_ATTRIBUTES) == FileDescriptorFlags.FD_ATTRIBUTES)
         virtualFile.Attributes = (FileAttributes)fd.dwFileAttributes;
     if ((fd.dwFlags & FileDescriptorFlags.FD_CREATETIME) == FileDescriptorFlags.FD_CREATETIME)
         virtualFile.CreationTime = NativeUtilities.ToDateTime(fd.ftCreationTime);
     if ((fd.dwFlags & FileDescriptorFlags.FD_ACCESSTIME) == FileDescriptorFlags.FD_ACCESSTIME)
         virtualFile.LastAccessTime = NativeUtilities.ToDateTime(fd.ftLastAccessTime);
     if ((fd.dwFlags & FileDescriptorFlags.FD_WRITESTIME) == FileDescriptorFlags.FD_WRITESTIME)
         virtualFile.LastWriteTime = NativeUtilities.ToDateTime(fd.ftLastWriteTime);
     return virtualFile;
 }