Пример #1
0
        private void MergeFiles(string machine, TaskInfo task)
        {
            Logger.AddTrace("Merging Shared Task");

            string targetZipFile;
            string sharedPath = FileUtilities.GetAbsolutePath(task.GetSharedPath());
            string targetPath = Path.Combine(Path.GetTempPath(), task.Id.ToString());

            if (!ViewsManager.DownloadTaskFile(machine, task, out targetZipFile, task.GetSharedPath()))
            {
                return;
            }

            //clean temporal path before decompress new files
            if (Directory.Exists(targetPath))
            {
                Directory.Delete(targetPath, true);
            }

            try
            {
                ZipFiles.Decompress(targetPath, targetZipFile);
            }
            catch (Exception e)
            {
                Logger.AddException(e);
            }

            bool isDirectory = string.IsNullOrEmpty(Path.GetExtension(sharedPath));

            if (!isDirectory)
            {
                targetPath = Path.Combine(targetPath, Path.GetFileName(sharedPath));
            }

            FileUtilities.ForceCreateDirectory(sharedPath);

            this.ExecuteMergeTool(sharedPath, targetPath, isDirectory);
        }
Пример #2
0
        private void OverwriteFiles(string machine, TaskInfo task)
        {
            Logger.AddTrace("Overwriting Files");

            string targetZipFile;
            string sharedPath = FileUtilities.GetAbsolutePath(task.GetSharedPath());
            string targetPath = Path.GetDirectoryName(sharedPath);

            if (!ViewsManager.DownloadTaskFile(machine, task, out targetZipFile, task.GetSharedPath()))
            {
                return;
            }

            try
            {
                ZipFiles.Decompress(targetPath, targetZipFile);
            }
            catch (Exception e)
            {
                Logger.AddException(e);
            }
        }