示例#1
0
 /// <summary>
 /// Translates the specified archive kind.
 /// </summary>
 private static string TranslateArchiveKind(ArchiveKind archiveKind)
 {
     return(archiveKind switch
     {
         ArchiveKind.Current => ServerPhrases.CurrentArchiveKind,
         ArchiveKind.Historical => ServerPhrases.HistoricalArchiveKind,
         ArchiveKind.Events => ServerPhrases.EventsArchiveKind,
         _ => ServerPhrases.UnspecifiedArchiveKind
     });
示例#2
0
        ProcessStartInfo CreateExtractionArgs(string file, string contentDir, ArchiveKind kind, string vsInstallRoot, bool ignoreTarSymLinks = false)
        {
            ProcessArgumentBuilder args = null;

            switch (kind)
            {
            case ArchiveKind.Tgz:
                if (Platform.IsWindows)
                {
                    args = Build7ZipExtractionArgs(file, contentDir, User7ZipPath, ignoreTarSymLinks, vsInstallRoot);
                }
                else
                {
                    args = BuildTgzExtractionArgs(file, contentDir);
                }
                break;

            case ArchiveKind.Zip:
                if (Platform.IsWindows)
                {
                    args = Build7ZipExtractionArgs(file, contentDir, User7ZipPath, false, vsInstallRoot);
                }
                else
                {
                    args = BuildZipExtractionArgs(file, contentDir);
                }
                break;

            default:
                throw new ArgumentException("kind");
            }

            ProcessStartInfo psi = null;

            if (Platform.IsWindows)
            {
                psi = new ProcessStartInfo(args.ProcessPath, args.ToString())
                {
                    WorkingDirectory = null,
                    CreateNoWindow   = true
                }
            }
            ;
            else
            {
                psi = new ProcessStartInfo(args.ProcessPath, args.ToString())
                {
                    WorkingDirectory = contentDir,
                    CreateNoWindow   = true
                }
            };

            return(psi);
        }
示例#3
0
        ProcessStartInfo CreateExtractionArgs(string file, string contentDir, ArchiveKind kind)
        {
            ProcessArgumentBuilder args = null;

            switch (kind)
            {
            case ArchiveKind.Tgz:
                if (Platform.IsWindows)
                {
                    args = Build7ZipExtractionArgs(file, contentDir, User7ZipPath);
                }
                else
                {
                    args = BuildTgzExtractionArgs(file, contentDir);
                }
                break;

            case ArchiveKind.Zip:
                if (Platform.IsWindows)
                {
                    args = Build7ZipExtractionArgs(file, contentDir, User7ZipPath);
                }
                else
                {
                    args = BuildZipExtractionArgs(file, contentDir);
                }
                break;

            default:
                throw new ArgumentException("kind");
            }
            return(new ProcessStartInfo(args.ProcessPath, args.ToString())
            {
                WorkingDirectory = contentDir,
                CreateNoWindow = true
            });
        }
示例#4
0
 /// <summary>
 /// Indicates whether the module can create an archive of the specified kind.
 /// </summary>
 public virtual bool CanCreateArchive(ArchiveKind kind)
 {
     return(false);
 }
示例#5
0
 /// <summary>
 /// Indicates whether the module can create an archive of the specified kind.
 /// </summary>
 public override bool CanCreateArchive(ArchiveKind kind)
 {
     return(kind == ArchiveKind.Current || kind == ArchiveKind.Historical || kind == ArchiveKind.Events);
 }