Esempio n. 1
0
        public virtual void Publish(ExportDeploymentContext context, ExportDeployment deployment)
        {
            var destinationFolder = deployment.GetDeploymentFolder(true);

            if (destinationFolder.IsEmpty())
            {
                return;
            }

            if (!System.IO.Directory.Exists(destinationFolder))
            {
                System.IO.Directory.CreateDirectory(destinationFolder);
            }

            if (context.CreateZipArchive)
            {
                if (File.Exists(context.ZipPath))
                {
                    var destinationFile = Path.Combine(destinationFolder, Path.GetFileName(context.ZipPath));

                    File.Copy(context.ZipPath, destinationFile, true);

                    context.Log.Information("Copied zipped export data to " + destinationFile);
                }
            }
            else
            {
                if (!FileSystemHelper.CopyDirectory(new DirectoryInfo(context.FolderContent), new DirectoryInfo(destinationFolder)))
                {
                    context.Result.LastError = context.T("Admin.DataExchange.Export.Deployment.CopyFileFailed");
                }

                context.Log.Information("Copied export data files to " + destinationFolder);
            }
        }
Esempio n. 2
0
        public virtual void Publish(ExportDeploymentContext context, ExportDeployment deployment)
        {
            var targetFolder = deployment.GetDeploymentFolder(true);

            if (!FileSystemHelper.CopyDirectory(new DirectoryInfo(context.FolderContent), new DirectoryInfo(targetFolder)))
            {
                context.Result.LastError = context.T("Admin.DataExchange.Export.Deployment.CopyFileFailed");
            }

            context.Log.Information("Copied export data files to " + targetFolder);
        }
Esempio n. 3
0
        private void GetTheLatestScript()
        {
            //FileSystemHelper.ConnectServer(ExecutionConfig.PublishDirectory, ExecutionConfig.LocalNetworkDrive, ExecutionConfig.PublishServerUserName, ExecutionConfig.PublishServerPassword);

            if (Directory.Exists(ExecutionConfig.ScriptDirectory))
            {
                Directory.Delete(ExecutionConfig.ScriptDirectory, true);
            }

            DirectoryInfo localLocation = new DirectoryInfo(ExecutionConfig.LocalNetworkDrive + Path.DirectorySeparatorChar.ToString());
            //DirectoryInfo localLocation = new DirectoryInfo(ExecutionConfig.LocalNetworkDrive + Path.DirectorySeparatorChar.ToString());

            DirectoryInfo theLatestVersion = localLocation.GetDirectories("Mento_TSIR*").OrderByDescending(d => d.CreationTime).FirstOrDefault();

            FileSystemHelper.CopyDirectory(theLatestVersion.FullName, ExecutionConfig.ScriptDirectory);

            //FileSystemHelper.DisconnectServer(ExecutionConfig.LocalNetworkDrive);
        }
Esempio n. 4
0
        public virtual void Publish(ExportDeploymentContext context, ExportDeployment deployment)
        {
            string folderDestination = null;

            if (deployment.IsPublic)
            {
                folderDestination = Path.Combine(HttpRuntime.AppDomainAppPath, DataExporter.PublicFolder);
            }
            else if (deployment.FileSystemPath.IsEmpty())
            {
                return;
            }
            else if (deployment.FileSystemPath.StartsWith("/") || deployment.FileSystemPath.StartsWith("\\") || !Path.IsPathRooted(deployment.FileSystemPath))
            {
                folderDestination = CommonHelper.MapPath(deployment.FileSystemPath);
            }
            else
            {
                folderDestination = deployment.FileSystemPath;
            }

            if (!System.IO.Directory.Exists(folderDestination))
            {
                System.IO.Directory.CreateDirectory(folderDestination);
            }

            if (deployment.CreateZip)
            {
                var path = Path.Combine(folderDestination, deployment.Profile.FolderName + ".zip");

                if (FileSystemHelper.Copy(context.ZipPath, path))
                {
                    context.Log.Information("Copied ZIP archive " + path);
                }
            }
            else
            {
                FileSystemHelper.CopyDirectory(new DirectoryInfo(context.FolderContent), new DirectoryInfo(folderDestination));

                context.Log.Information("Copied export data files to " + folderDestination);
            }
        }
Esempio n. 5
0
        public void CopyFolder(string path, string destinationPath, bool overwrite = true)
        {
            var sourceDirectory = new DirectoryInfo(MapStorage(path));

            if (!sourceDirectory.Exists)
            {
                throw new DirectoryNotFoundException("Directory " + path + "does not exist.");
            }

            var targetPath    = Combine(MapStorage(destinationPath), sourceDirectory.Name);
            var destDirectory = new DirectoryInfo(targetPath);

            if (!overwrite && destDirectory.Exists)
            {
                throw new ArgumentException("Directory " + destinationPath + " already exists.");
            }

            if (!destDirectory.Exists)
            {
                destDirectory.Create();
            }

            FileSystemHelper.CopyDirectory(sourceDirectory, destDirectory, overwrite);
        }
Esempio n. 6
0
 private void CopyVSTestAdapter(string foldersVsAdapterFolderProjectBinaries, string foldersVsAdapterFolder)
 {
     FileSystemHelper.CopyDirectory(foldersVsAdapterFolderProjectBinaries, foldersVsAdapterFolder, true);
 }