示例#1
0
        private void DeployBin(string sourcePath, string destinationFolder)
        {
            var files = new[]
            {
                "Microsoft.SourceBrowser.Common.dll",
                "Microsoft.SourceBrowser.SourceIndexServer.dll",
                "Microsoft.Web.Infrastructure.dll",
                "Newtonsoft.Json.dll",
                "System.Net.Http.Formatting.dll",
                "System.Web.Helpers.dll",
                "System.Web.Http.dll",
                "System.Web.Http.WebHost.dll",
                "System.Web.Mvc.dll",
                "System.Web.Razor.dll",
                "System.Web.WebPages.dll",
                "System.Web.WebPages.Deployment.dll",
                "System.Web.WebPages.Razor.dll",
            };

            foreach (var file in files)
            {
                FileUtilities.CopyFile(
                    Path.Combine(sourcePath, file),
                    Path.Combine(destinationFolder, "bin", file));
            }
        }
示例#2
0
 public void OnChanged(object source, FileSystemEventArgs eventArgs)
 {
     OnEvent(eventArgs, "Changed", (string sourcePath, string targetPath) =>
     {
         if (FileUtilities.IsFile(sourcePath))
         {
             FileUtilities.CopyFile(sourcePath, targetPath);
         }
     });
 }
示例#3
0
        public static bool Duplicate(FilePath <FileNameUserAndId> source, string newFileId)
        {
            FilePath <FileNameUserAndId> dest =
                ClassificationFileAssist.AssembleClassfFilePath(newFileId, source.FolderPath);

            if (!ValidateProposedClassfFile(dest,
                                            false, "Duplicate a Classification File", "already exists"))
            {
                return(false);
            }

            if (!FileUtilities.CopyFile(source.FullFilePath, dest.FullFilePath))
            {
                return(false);
            }

            BaseDataFile <ClassificationFileData> df =
                new BaseDataFile <ClassificationFileData>();

            // df.Configure(dest.FolderPath, dest.FileName);
            df.Configure(dest.FolderPath, dest.FileNameNoExt, dest.FileExtensionNoSep);
            df.Admin.Read();

            if (!df.Info.Description.IsVoid())
            {
                df.Info.Description = "COPY OF " + df.Info.Description;
            }
            else
            {
                df.Info.Description = "This file holds the PDF sheet classification information";
            }

            if (!df.Info.Notes.IsVoid())
            {
                df.Info.Notes = "COPY OF " + df.Info.Notes;
            }
            else
            {
                df.Info.Notes = dest.FileNameObject.UserName + " created this file on " + DateTime.Now;
            }

            df.Admin.Write();

            df = null;

            return(true);
        }
示例#4
0
        public static FilePath <FileNameSimple> InstallSampleFile(string startingFolderPath, string sampleFolderPath)
        {
            FilePath <FileNameSimple> existFilePath = SelectSampleFile(startingFolderPath);
            FilePath <FileNameSimple> newFilePath   =
                new FilePath <FileNameSimple>(sampleFolderPath + FilePathUtil.PATH_SEPARATOR + existFilePath.FileName);

            if (!newFilePath.IsValid || newFilePath.IsFound)
            {
                return(null);
            }

            bool result = FileUtilities.CopyFile(existFilePath.FullFilePath, newFilePath.FullFilePath);

            if (!result)
            {
                return(null);
            }

            return(newFilePath);
        }
示例#5
0
        private async Task InstallUpdater(Action <int> onProgress = null)
        {
            var downloadedZipPath = string.Empty;
            var unzippedDirPath   = string.Empty;

            try
            {
                var latestVersions = await GetLatestVersionResponse();

                downloadedZipPath = await _downloadService.DownloadZipFile(
                    latestVersions.Updater.Url,
                    DownloadPath,
                    (progress) =>
                {
                    onProgress?.Invoke(progress);
                });

                unzippedDirPath = await _downloadService.UnzipFile(downloadedZipPath);

                var newUpdater    = Path.Combine(unzippedDirPath, UpdaterName);
                var targetUpdater = Path.Combine(FileUtilities.AppDataPath, UpdaterName);

                FileUtilities.CopyFile(newUpdater, targetUpdater, true);
            }
            finally
            {
                if (!string.IsNullOrEmpty(downloadedZipPath) && File.Exists(downloadedZipPath))
                {
                    File.Delete(downloadedZipPath);
                }

                if (!string.IsNullOrEmpty(unzippedDirPath) && Directory.Exists(unzippedDirPath))
                {
                    Directory.Delete(unzippedDirPath, true);
                }
            }
        }
示例#6
0
 public override IMessages Run()
 {
     return(FileUtilities.CopyFile(this.SourcePath, this.TargetPath, this.Overwrite));
 }