/// <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 });
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); }
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 }); }
/// <summary> /// Indicates whether the module can create an archive of the specified kind. /// </summary> public virtual bool CanCreateArchive(ArchiveKind kind) { return(false); }
/// <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); }