コード例 #1
0
        public IPhysicalNode CreateTo(PhysicalFolder directory)
        {
            var dirPath = Path.Combine(directory.FullPath, Name);

            PhysicalFolder result;

            if (CopyFromFolder != null)
            {
                CopyDirectoryAndFiles(CopyFromFolder.FullPath, dirPath);
                result = new PhysicalFolder(dirPath, PhysicalFolderDeleteType.NoDelete);
            }
            else
            {
                result = PhysicalFolder.Create(dirPath, PhysicalFolderDeleteType.NoDelete, Nodes);
            }

            if (AttributesValue != null)
            {
                new DirectoryInfo(dirPath).Attributes = AttributesValue.Value;
            }
            if (CreationTimeValue != null)
            {
                Directory.SetCreationTime(dirPath, CreationTimeValue.Value);
            }

            if (LastWriteTimeValue != null)
            {
                Directory.SetLastWriteTime(dirPath, LastWriteTimeValue.Value);
            }

            return(result);
        }
コード例 #2
0
        public IPhysicalNode CreateTo(PhysicalFolder directory)
        {
            var destFilePath   = Path.Combine(directory.FullPath, Name);
            var tempFolderPath = CreateTempFolderPath();

            if (AnonymousTypeFolder != null)
            {
                using (var dir = TypeBasePhysicalFolder.CreatePhysicalFolder(
                           tempFolderPath,
                           PhysicalFolderDeleteType.DeleteFolder,
                           AnonymousTypeFolder))
                {
                    CreateArchiveFile.Archive(tempFolderPath, destFilePath);
                }
            }
            else
            {
                using (var dir = PhysicalFolder.Create(tempFolderPath, PhysicalFolderDeleteType.DeleteFolder, Nodes))
                {
                    CreateArchiveFile.Archive(dir.FullPath, destFilePath);
                }
            }

            if (AttributesValue != null)
            {
                File.SetAttributes(destFilePath, AttributesValue.Value);
            }
            if (CreationTimeValue != null)
            {
                File.SetCreationTime(destFilePath, CreationTimeValue.Value);
            }
            if (LastWriteTimeValue != null)
            {
                File.SetLastWriteTime(destFilePath, LastWriteTimeValue.Value);
            }
            return(new PhysicalFile(Name, destFilePath));
        }