示例#1
0
        private void BuildFileNode(string path, FileNode fileNode, bool handleSMBAttributes, PreserveSMBPermissions getPermissions)
        {
            fileNode.MD5 = Helper.GetFileContentMD5(LongPathExtension.GetFullPath(path));
            // fileNode.LastModifiedTime =
            using (FileStream fs = LongPathFileExtension.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                fileNode.SizeInByte = fs.Length;
            }

            DateTimeOffset?creationTime   = null;
            DateTimeOffset?lastWriteTime  = null;
            FileAttributes?fileAttributes = null;

            LongPathFileExtension.GetFileProperties(path, out creationTime, out lastWriteTime, out fileAttributes);

            fileNode.CreationTime  = creationTime;
            fileNode.LastWriteTime = lastWriteTime;

            if (handleSMBAttributes)
            {
                fileNode.SMBAttributes = Helper.ToCloudFileNtfsAttributes(fileAttributes.Value);
            }

            if (PreserveSMBPermissions.None != getPermissions)
            {
                fileNode.PortableSDDL = LongPathFileExtension.GetFilePortableSDDL(path, getPermissions);
            }

            fileNode.Metadata = new Dictionary <string, string>();
        }
 private void BuildFileNode(string path, FileNode fileNode)
 {
     fileNode.MD5 = Helper.GetFileContentMD5(LongPathExtension.GetFullPath(path));
     // fileNode.LastModifiedTime =
     using (FileStream fs = LongPathFileExtension.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         fileNode.SizeInByte = fs.Length;
     }
     fileNode.Metadata = new Dictionary <string, string>();
 }
        public override DMLibDataInfo GetTransferDataInfo(string rootDir)
        {
#if DOTNET5_4
            DirectoryInfo rootDirInfo = new DirectoryInfo(Path.Combine(this.BasePath, rootDir));
            if (!rootDirInfo.Exists)
            {
                return(null);
            }
#else
            string rootDirInfo = rootDir;
            if (rootDir.Length == 0)
            {
                rootDirInfo = LongPathExtension.Combine(this.BasePath, rootDir);
            }
            if (!LongPathDirectoryExtension.Exists(rootDirInfo))
            {
                return(null);
            }
#endif
            DMLibDataInfo dataInfo = new DMLibDataInfo(rootDir);
            this.BuildDirNode(rootDirInfo, dataInfo.RootNode);

            return(dataInfo);
        }
示例#4
0
        public DMLibDataInfo GetTransferDataInfo(string rootDir, bool handleSMBAttributes, PreserveSMBPermissions getSMBPermissions)
        {
#if DOTNET5_4
            DirectoryInfo rootDirInfo = new DirectoryInfo(Path.Combine(this.BasePath, rootDir));
            if (!rootDirInfo.Exists)
            {
                return(null);
            }
#else
            string rootDirInfo = rootDir;
            if (rootDir.Length == 0)
            {
                rootDirInfo = LongPathExtension.Combine(this.BasePath, rootDir);
            }
            if (!LongPathDirectoryExtension.Exists(rootDirInfo))
            {
                return(null);
            }
#endif
            DMLibDataInfo dataInfo = new DMLibDataInfo(rootDir);
            this.BuildDirNode(rootDirInfo, dataInfo.RootNode, handleSMBAttributes, getSMBPermissions);

            return(dataInfo);
        }