// TODO: TEST BMP, png etc public ExifTool(IProcessUtility processUtility, ILogger <ProcessUtility> logger) { _processUtility = processUtility ?? throw new ArgumentNullException(nameof(processUtility)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _processUtility.ProcessMessageFired += ProcessUtility_ProcessMessageFired; _processUtility.ProcessErrorFired += ProcessUtility_ProcessErrorFired; }
public MediaInspector(string ffprobeFileName, IProcessRunner processRunner, IProcessUtility processUtility, ISerializer<string> serializer) : this(ffprobeFileName, processRunner, processUtility, serializer, TimeSpan.FromSeconds(5)) { }
public MediaInspector(string ffprobeFileName, IProcessRunner processRunner, IProcessUtility processUtility, ISerializer<string> serializer, TimeSpan timeout) { _ffprobeFileName = ffprobeFileName; _processRunner = processRunner; _processUtility = processUtility; _serializer = serializer; _timeout = timeout; }
static async Task ExtractPackageAsync(string packageFilePath, IProcessUtility processUtility, string versionDirectoryPath, string fileName) { await processUtility.ExecuteCommandAsync(Path.Combine(AssemblyDirectory, "7za.exe"), $"e \"{packageFilePath}\" -o\"{versionDirectoryPath}\" {fileName} -r -y", CancellationToken.None) .ConfigureAwait(false); }
public static async Task ExtractPackageAndApplyActionAsync(string packageFilePath, IProcessUtility processUtility, string extractionTempPath, Func <string, string, Task> processPackageAsync) { _ = processPackageAsync ?? throw new ArgumentNullException(nameof(processPackageAsync)); _ = extractionTempPath ?? throw new ArgumentNullException(nameof(extractionTempPath)); _ = packageFilePath ?? throw new ArgumentNullException(nameof(packageFilePath)); _ = processUtility ?? throw new ArgumentNullException(nameof(processUtility)); var packageInfo = ParseNugetPackageInfoForPath(packageFilePath) ?? throw new InvalidOperationException("Package info is null"); var tempPackagePath = Path.Combine(extractionTempPath, packageInfo.ToString()); if (!Directory.Exists(tempPackagePath)) { Directory.CreateDirectory(tempPackagePath); } var dllFileName = $"{packageInfo.Name}.dll"; var nuspecFileName = $"{packageInfo.Name}.nuspec"; await ExtractPackageAsync(packageFilePath, processUtility, tempPackagePath, dllFileName).ConfigureAwait(false); await ExtractPackageAsync(packageFilePath, processUtility, tempPackagePath, nuspecFileName).ConfigureAwait(false); var dllFilePath = Path.Combine(tempPackagePath, dllFileName); var nuspecFilePath = Path.Combine(tempPackagePath, nuspecFileName); await processPackageAsync(dllFilePath, nuspecFilePath).ConfigureAwait(false); Directory.Delete(tempPackagePath, true); }
public CmdUtility([NotNull] IProcessUtility processUtility, [NotNull] IMessageHub messageHub, [NotNull] ICancellationTokenSourceProvider cancellationTokenSourceProvider) { _processUtility = processUtility ?? throw new ArgumentNullException(nameof(processUtility)); _messageHub = messageHub ?? throw new ArgumentNullException(nameof(messageHub)); _cancellationTokenSourceProvider = cancellationTokenSourceProvider; }
static async Task PushNugetAsync(ILogger logger, IProcessUtility processUtility, string lastPackagePath) { await processUtility.ExecuteCommandAsync("dotnet", $"nuget push \"{lastPackagePath}\" -s {NugetServerUrl} -k {NugetServerApiKey}", CancellationToken.None).ConfigureAwait(false); logger.LogInformation("Nuget file {PackageName} was pushed to {NugetServerUrl}", NugetUtilities.ParseNugetPackageInfoForPath(lastPackagePath)?.ToString(), NugetServerUrl); }
public MainViewModel( [NotNull] SynchronizationContext synchronizationContext, [NotNull] IProcessUtility processUtility, [NotNull] IMessageHub messageHub, [NotNull] ICmdUtility cmdUtility, [NotNull] IGitUtility gitUtility, [NotNull] Func <string, GitInfo, TfsInfo, ShelveViewModel> shelveViewModelFactory, [NotNull] Func <string, GitInfo, TfsInfo, UnshelveViewModel> unshelveViewModelFactory, [NotNull] Func <string, TfsInfo, PullViewModel> pullViewModelFactory, [NotNull] IGitTfsUtility gitTfsUtility, [NotNull] ITfsUtility tfsUtility, [NotNull] ICancellationTokenSourceProvider cancellationTokenSourceProvider, [NotNull] Func <string, bool, ConfirmationViewModel> confirmationViewModelFactory, [NotNull] Func <ConfirmationViewModel, IConfirmationWindow> confirmationWindowFactory, [NotNull] ICommandManager commandManager, [NotNull] IRateLimiter rateLimiter) : base(commandManager) { _ = rateLimiter ?? throw new ArgumentNullException(nameof(rateLimiter)); _tfsUtility = tfsUtility; _cancellationTokenSourceProvider = cancellationTokenSourceProvider ?? throw new ArgumentNullException(nameof(cancellationTokenSourceProvider)); _confirmationViewModelFactory = confirmationViewModelFactory ?? throw new ArgumentNullException(nameof(confirmationViewModelFactory)); _confirmationWindowFactory = confirmationWindowFactory ?? throw new ArgumentNullException(nameof(confirmationWindowFactory)); _rateLimiter = rateLimiter; _pullViewModelFactory = pullViewModelFactory ?? throw new ArgumentNullException(nameof(pullViewModelFactory)); _synchronizationContext = synchronizationContext ?? throw new ArgumentNullException(nameof(synchronizationContext)); processUtility = processUtility ?? throw new ArgumentNullException(nameof(processUtility)); _messageHub = messageHub ?? throw new ArgumentNullException(nameof(messageHub)); _cmdUtility = cmdUtility ?? throw new ArgumentNullException(nameof(cmdUtility)); _gitUtility = gitUtility ?? throw new ArgumentNullException(nameof(gitUtility)); _gitTfsUtility = gitTfsUtility ?? throw new ArgumentNullException(nameof(gitTfsUtility)); _shelveViewModelFactory = shelveViewModelFactory ?? throw new ArgumentNullException(nameof(shelveViewModelFactory)); _unshelveViewModelFactory = unshelveViewModelFactory ?? throw new ArgumentNullException(nameof(unshelveViewModelFactory)); processUtility.ProcessMessageFired += ProcessUtility_ProcessMessageFired; processUtility.ProcessErrorFired += ProcessUtility_ProcessErrorFired; ChooseDirectoryCommand = AddCommand(ChooseDirectoryAsync, () => CanBrowse); SetDirectoryCommand = AddCommand <string>(SetDirectoryAsync, directory => CanBrowse); PullCommand = AddCommand(GitTfsPull, () => CanExecuteGitTfsAction); OpenShelveDialogCommand = AddCommand(OpenShelveDialogAsync, () => CanExecuteGitTfsAction); OpenUnshelveDialogCommand = AddCommand(OpenUnshelveDialogAsync, () => CanExecuteGitTfsAction); WindowClosingCommand = AddCommand(WindowClosing); CancelCommand = AddCommand(Cancel, () => CanCancel); CopyShelvesetToClipboardCommand = AddCommand(CopyShelvesetToClipboard, () => CreatedShelvesetName != null); OpenShelvesetInBrowserCommand = AddCommand(OpenShelvesetInBrowser, () => _createdShelvesetUrl != null); ShowLogsCommand = AddCommand(ProcessCommands.ViewLogs); _dialog = new CommonOpenFileDialog { IsFolderPicker = true, InitialDirectory = DirectoryPath }; var savedUsedPaths = Settings.Default.UsedDirectoryPaths; UsedPaths = string.IsNullOrEmpty(savedUsedPaths) ? new ObservableCollection <string>() : new ObservableCollection <string>(savedUsedPaths.Split(UsedPathsSeparator).Select(x => x.Trim()).Where(x => x != string.Empty)); if (!string.IsNullOrWhiteSpace(Settings.Default.DirectoryPath)) { _ = SetDirectoryAsync(Settings.Default.DirectoryPath); } _subscriptionTokens.Add(messageHub.Subscribe <Message>(OnNewMessage)); _subscriptionTokens.Add(messageHub.Subscribe <TaskState>(OnTaskAction)); _subscriptionTokens.Add(messageHub.Subscribe <CancellationState>(OnCancellationStateChange)); _subscriptionTokens.Add(messageHub.Subscribe <DialogType>(OnDialogChanged)); _subscriptionTokens.Add(messageHub.Subscribe <GitInfo>(OnGitInfoChanged)); _subscriptionTokens.Add(messageHub.Subscribe <TfsInfo>(OnTfsInfoChanged)); _subscriptionTokens.Add(messageHub.Subscribe <ShelvesetData>(OnShelvesetEvent)); _fileSystemWatcher = new FileSystemWatcher { Filter = "HEAD.lock", IncludeSubdirectories = true, InternalBufferSize = 64 * 1024 }; _fileSystemWatcher.Changed += FileSystemWatcher_Changed; Version = GetProgramVersion(); }