private void GenerateDir(DirNode dirNode, string parentPath)
        {
            string dirPath = Path.Combine(parentPath, dirNode.Name);

            if (!string.IsNullOrEmpty(dirNode.Content))
            {
                CreateSymlink(dirPath, dirNode.Content);

                Test.Info("Building symlinked dir info of {0}", dirPath);
                dirNode.BuildSymlinkedDirNode();
                return;
            }

            DMLibDataHelper.CreateLocalDirIfNotExists(dirPath);

            foreach (var file in dirNode.FileNodes)
            {
                GenerateFile(file, dirPath);
            }

            foreach (var subDir in dirNode.NormalDirNodes)
            {
                GenerateDir(subDir, dirPath);
            }

            foreach (var subDir in dirNode.SymlinkedDirNodes)
            {
                CreateSymlink(Path.Combine(dirPath, subDir.Name), subDir.Content);

                Test.Info("Building symlinked dir info of {0}", Path.Combine(dirPath, subDir.Name));
                subDir.BuildSymlinkedDirNode();
            }
        }
示例#2
0
        private void GenerateDir(DirNode dirNode, CloudFileDirectory cloudFileDir, string parentPath)
        {
            string dirPath = Path.Combine(parentPath, dirNode.Name);

            DMLibDataHelper.CreateLocalDirIfNotExists(dirPath);
            cloudFileDir.CreateIfNotExists(HelperConst.DefaultFileOptions);

            if (null != cloudFileDir.Parent)
            {
                if (null != dirNode.SMBAttributes)
                {
                    cloudFileDir.Properties.NtfsAttributes = dirNode.SMBAttributes;
                }

                if (dirNode.CreationTime.HasValue)
                {
                    cloudFileDir.Properties.CreationTime = dirNode.CreationTime;
                }
                if (dirNode.LastWriteTime.HasValue)
                {
                    cloudFileDir.Properties.LastWriteTime = dirNode.LastWriteTime;
                }
                if (null != dirNode.PortableSDDL)
                {
                    cloudFileDir.FilePermission = dirNode.PortableSDDL;
                }
                cloudFileDir.SetProperties(HelperConst.DefaultFileOptions);

                cloudFileDir.FetchAttributes(null, HelperConst.DefaultFileOptions);

                dirNode.CreationTime  = cloudFileDir.Properties.CreationTime;
                dirNode.LastWriteTime = cloudFileDir.Properties.LastWriteTime;

                if ((null != dirNode.Metadata) &&
                    (dirNode.Metadata.Count > 0))
                {
                    cloudFileDir.Metadata.Clear();

                    foreach (var keyValuePair in dirNode.Metadata)
                    {
                        cloudFileDir.Metadata.Add(keyValuePair);
                    }

                    cloudFileDir.SetMetadata(null, HelperConst.DefaultFileOptions);
                }
            }

            foreach (var subDir in dirNode.DirNodes)
            {
                CloudFileDirectory subCloudFileDir = cloudFileDir.GetDirectoryReference(subDir.Name);
                this.GenerateDir(subDir, subCloudFileDir, dirPath);
            }

            foreach (var file in dirNode.FileNodes)
            {
                CloudFile cloudFile = cloudFileDir.GetFileReference(file.Name);
                this.GenerateFile(file, cloudFile, dirPath);
            }
        }
        private void GenerateDir(DirNode dirNode, string parentPath)
        {
            string dirPath = Path.Combine(parentPath, dirNode.Name);

            DMLibDataHelper.CreateLocalDirIfNotExists(dirPath);

            foreach (var subDir in dirNode.DirNodes)
            {
                GenerateDir(subDir, dirPath);
            }

            foreach (var file in dirNode.FileNodes)
            {
                GenerateFile(file, dirPath);
            }
        }
示例#4
0
        private void GenerateDir(DirNode dirNode, CloudFileDirectory cloudFileDir, string parentPath)
        {
            string dirPath = Path.Combine(parentPath, dirNode.Name);

            DMLibDataHelper.CreateLocalDirIfNotExists(dirPath);
            cloudFileDir.CreateIfNotExists(HelperConst.DefaultFileOptions);

            foreach (var subDir in dirNode.DirNodes)
            {
                CloudFileDirectory subCloudFileDir = cloudFileDir.GetDirectoryReference(subDir.Name);
                this.GenerateDir(subDir, subCloudFileDir, dirPath);
            }

            foreach (var file in dirNode.FileNodes)
            {
                CloudFile cloudFile = cloudFileDir.GetFileReference(file.Name);
                this.GenerateFile(file, cloudFile, dirPath);
            }
        }
        private void GenerateDir(DirNode dirNode, CloudBlobDirectory cloudBlobDir)
        {
            DMLibDataHelper.CreateLocalDirIfNotExists(this.TempFolder);

            foreach (var subDir in dirNode.DirNodes)
            {
                CloudBlobDirectory subCloudBlobDir = cloudBlobDir.GetDirectoryReference(subDir.Name);
                this.GenerateDir(subDir, subCloudBlobDir);
            }

            List <FileNode> snapshotList = new List <FileNode>();

            foreach (var file in dirNode.FileNodes)
            {
                CloudBlob cloudBlob = CloudBlobHelper.GetCloudBlobReference(cloudBlobDir, file.Name, this.BlobType);
                this.GenerateFile(file, cloudBlob, snapshotList);
            }

            foreach (var snapshot in snapshotList)
            {
                dirNode.AddFileNode(snapshot);
            }
        }