public void CheckValidInstallPath_DoesNotExist() { using (var tempDir = new TempFolder()) { Assert.IsTrue(MO2Installer.CheckValidInstallPath(Path.Combine(tempDir.Dir.FullName, "Subfolder"), downloadFolder: null).Succeeded); } }
public void CheckValidInstallPath_Empty() { using (var tempDir = new TempFolder()) { Assert.IsTrue(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName, downloadFolder: null).Succeeded); } }
public async Task <bool> Install() { using (var installer = new MO2Installer( archive: Parent.ModListLocation.TargetPath, modList: Parent.ModList.SourceModList, outputFolder: Location.TargetPath, downloadFolder: DownloadLocation.TargetPath, parameters: SystemParametersConstructor.Create())) { Parent.MWVM.Settings.Performance.AttachToBatchProcessor(installer); return(await Task.Run(async() => { try { var workTask = installer.Begin(); ActiveInstallation = installer; return await workTask; } finally { ActiveInstallation = null; } })); } }
public async Task CheckValidInstallPath_HasModlist() { await using var tempDir = new TempFolder(); await using var mo2 = tempDir.Dir.Combine("ModOrganizer.exe").Create(); await using var molist = tempDir.Dir.Combine(((RelativePath) "modlist")).WithExtension(Consts.ModListExtension).Create(); Assert.False(MO2Installer.CheckValidInstallPath(tempDir.Dir, downloadFolder: null).Succeeded); }
public void CheckValidInstallPath_Invalid() { using (var tempDir = new TempFolder()) { Assert.IsFalse(MO2Installer.CheckValidInstallPath($"{tempDir.Dir.FullName}/*", downloadFolder: null).Succeeded); } }
public async Task CheckValidInstallPath_ProperOverwrite() { await using var tempDir = await TempFolder.Create(); await using var tmp = tempDir.Dir.Combine(Consts.ModOrganizer2Exe).Create(); Assert.True(MO2Installer.CheckValidInstallPath(tempDir.Dir, downloadFolder: null).Succeeded); }
public void CheckValidInstallPath_ProperOverwrite() { using (var tempDir = new TempFolder()) { File.Create(Path.Combine(tempDir.Dir.FullName, $"ModOrganizer.exe")); Assert.IsTrue(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName, downloadFolder: null).Succeeded); } }
public void CheckValidInstallPath_ImproperOverwrite() { using (var tempDir = new TempFolder()) { File.Create(Path.Combine(tempDir.Dir.FullName, $"someFile.txt")); Assert.IsFalse(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName, downloadFolder: null).Succeeded); } }
public void CheckValidInstallPath_HasModlist() { using (var tempDir = new TempFolder()) { File.Create(Path.Combine(tempDir.Dir.FullName, $"ModOrganizer.exe")); File.Create(Path.Combine(tempDir.Dir.FullName, $"modlist{Consts.ModListExtension}")); Assert.IsFalse(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName, downloadFolder: null).Succeeded); } }
public async Task CheckValidInstallPath_OverwriteFilesInDownloads() { await using var tempDir = new TempFolder(); var downloadsFolder = tempDir.Dir.Combine("downloads"); downloadsFolder.CreateDirectory(); await using var tmp = tempDir.Dir.Combine($"downloads/someFile.txt").Create(); Assert.True(MO2Installer.CheckValidInstallPath(tempDir.Dir, downloadFolder: downloadsFolder).Succeeded); }
public async Task CheckValidInstallPath_ImproperOverwrite() { await using var tempDir = new TempFolder(); await tempDir.Dir.DeleteDirectory(); tempDir.Dir.CreateDirectory(); await using var tmp = tempDir.Dir.Combine($"someFile.txt").Create(); Assert.False(MO2Installer.CheckValidInstallPath(tempDir.Dir, downloadFolder: null).Succeeded); }
public void CheckValidInstallPath_OverwriteFilesInDownloads() { using (var tempDir = new TempFolder()) { var downloadsFolder = Path.Combine(tempDir.Dir.FullName, "downloads"); Directory.CreateDirectory(downloadsFolder); File.Create(Path.Combine(tempDir.Dir.FullName, $"downloads/someFile.txt")); Assert.IsTrue(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName, downloadFolder: downloadsFolder).Succeeded); } }
private async Task Install(MO2Compiler compiler) { var modlist = AInstaller.LoadFromFile(compiler.ModListOutputFile); var installer = new MO2Installer( archive: compiler.ModListOutputFile, modList: modlist, outputFolder: utils.InstallFolder, downloadFolder: utils.DownloadsFolder); installer.GameFolder = utils.GameFolder; await installer.Begin(); }
protected void Install(MO2Compiler compiler) { var modlist = AInstaller.LoadFromFile(compiler.ModListOutputFile); var installer = new MO2Installer( archive: compiler.ModListOutputFile, modList: modlist, outputFolder: utils.InstallFolder, downloadFolder: utils.DownloadsFolder); installer.WarnOnOverwrite = false; installer.GameFolder = utils.GameFolder; installer.Begin().Wait(); }
protected async Task Install(VortexCompiler vortexCompiler) { var modList = AInstaller.LoadFromFile(vortexCompiler.ModListOutputFile); var installer = new MO2Installer( archive: vortexCompiler.ModListOutputFile, modList: modList, outputFolder: utils.InstallFolder, downloadFolder: utils.DownloadsFolder, parameters: SystemParametersConstructor.Create()) { GameFolder = utils.GameFolder, }; await installer.Begin(); }
protected async Task Install(MO2Compiler compiler) { var modlist = AInstaller.LoadFromFile(compiler.ModListOutputFile); var installer = new MO2Installer( archive: compiler.ModListOutputFile, modList: modlist, outputFolder: utils.InstallFolder, downloadFolder: utils.DownloadsFolder, parameters: SystemParametersConstructor.Create()); installer.WarnOnOverwrite = false; installer.GameFolder = utils.GameFolder; await installer.Begin(); }
protected void Install(VortexCompiler vortexCompiler) { var modList = AInstaller.LoadFromFile(vortexCompiler.ModListOutputFile); var installer = new MO2Installer( archive: vortexCompiler.ModListOutputFile, modList: modList, outputFolder: utils.InstallFolder, downloadFolder: utils.DownloadsFolder) { GameFolder = utils.GameFolder, }; installer.Begin().Wait(); }
protected async Task Install(MO2Compiler compiler) { Utils.Log("Loading Modlist"); var modlist = AInstaller.LoadFromFile(compiler.ModListOutputFile); Utils.Log("Constructing Installer"); var installer = new MO2Installer( archive: compiler.ModListOutputFile, modList: modlist, outputFolder: utils.InstallFolder, downloadFolder: utils.DownloadsFolder, parameters: CreateDummySystemParameters()); installer.WarnOnOverwrite = false; installer.GameFolder = utils.GameFolder; Utils.Log("Starting Install"); await installer.Begin(); }
public async Task Install() { var installer = new MO2Installer( archive: Parent.ModListLocation.TargetPath, modList: Parent.ModList.SourceModList, outputFolder: Location.TargetPath, downloadFolder: DownloadLocation.TargetPath); await Task.Run(async() => { try { var workTask = installer.Begin(); ActiveInstallation = installer; await workTask; return(ErrorResponse.Success); } finally { ActiveInstallation = null; } }); }
public MO2InstallerVM(InstallerVM installerVM) { Parent = installerVM; Location = new FilePickerVM() { ExistCheckOption = FilePickerVM.CheckOptions.Off, PathType = FilePickerVM.PathTypeOptions.Folder, PromptTitle = "Select Installation Directory", }; DownloadLocation = new FilePickerVM() { ExistCheckOption = FilePickerVM.CheckOptions.Off, PathType = FilePickerVM.PathTypeOptions.Folder, PromptTitle = "Select a location for MO2 downloads", }; DownloadLocation.AdditionalError = this.WhenAny(x => x.DownloadLocation.TargetPath) .Select(x => Utils.IsDirectoryPathValid(x)); Location.AdditionalError = Observable.CombineLatest( this.WhenAny(x => x.Location.TargetPath), this.WhenAny(x => x.DownloadLocation.TargetPath), resultSelector: (target, download) => (target, download)) .ObserveOn(RxApp.TaskpoolScheduler) .Select(i => MO2Installer.CheckValidInstallPath(i.target, i.download)) .ObserveOnGuiThread(); CanInstall = Observable.CombineLatest( this.WhenAny(x => x.Location.InError), this.WhenAny(x => x.DownloadLocation.InError), installerVM.WhenAny(x => x.ModListLocation.InError), resultSelector: (loc, modlist, download) => { return(!loc && !download && !modlist); }); // Have Installation location updates modify the downloads location if empty this.WhenAny(x => x.Location.TargetPath) .Skip(1) // Don't do it initially .Subscribe(installPath => { if (string.IsNullOrWhiteSpace(DownloadLocation.TargetPath)) { DownloadLocation.TargetPath = Path.Combine(installPath, "downloads"); } }) .DisposeWith(CompositeDisposable); // Load settings _CurrentSettings = installerVM.WhenAny(x => x.ModListLocation.TargetPath) .Select(path => path == null ? null : installerVM.MWVM.Settings.Installer.Mo2ModlistSettings.TryCreate(path)) .ToGuiProperty(this, nameof(CurrentSettings)); this.WhenAny(x => x.CurrentSettings) .Pairwise() .Subscribe(settingsPair => { SaveSettings(settingsPair.Previous); if (settingsPair.Current == null) { return; } Location.TargetPath = settingsPair.Current.InstallationLocation; DownloadLocation.TargetPath = settingsPair.Current.DownloadLocation; AutomaticallyOverwrite = settingsPair.Current.AutomaticallyOverrideExistingInstall; }) .DisposeWith(CompositeDisposable); installerVM.MWVM.Settings.SaveSignal .Subscribe(_ => SaveSettings(CurrentSettings)) .DisposeWith(CompositeDisposable); // Hook onto user interventions, and intercept MO2 specific ones for customization this.WhenAny(x => x.ActiveInstallation) .Select(x => x?.LogMessages ?? Observable.Empty <IStatusMessage>()) .Switch() .Subscribe(x => { switch (x) { case ConfirmUpdateOfExistingInstall c: if (AutomaticallyOverwrite) { c.Confirm(); } break; default: break; } }) .DisposeWith(CompositeDisposable); }
public async Task CheckValidInstallPath_Empty() { await using var tempDir = await TempFolder.Create(); Assert.True(MO2Installer.CheckValidInstallPath(tempDir.Dir, null, null).Succeeded); }
public async Task CheckValidInstallPath_DoesNotExist() { await using var tempDir = await TempFolder.Create(); Assert.True(MO2Installer.CheckValidInstallPath(tempDir.Dir.Combine("Subfolder"), null, null).Succeeded); }
public async Task CheckValidInstallPath_NullPath() { var tempDir = new AbsolutePath("", true); Assert.True(MO2Installer.CheckValidInstallPath(tempDir, null, null).Succeeded == false); }
public async Task CheckValidInstallPath_Empty() { await using var tempDir = new TempFolder(); Assert.True(MO2Installer.CheckValidInstallPath(tempDir.Dir, downloadFolder: null).Succeeded); }