public async Task Compile() { string outputFile = $"{ModlistSettings.ModListName}{ExtensionManager.Extension}"; if (!string.IsNullOrWhiteSpace(Parent.OutputLocation.TargetPath)) { outputFile = Path.Combine(Parent.OutputLocation.TargetPath, outputFile); } try { ActiveCompilation = new VortexCompiler( game: SelectedGame.Game, gamePath: GameLocation.TargetPath, vortexFolder: VortexCompiler.TypicalVortexFolder(), downloadsFolder: DownloadsLocation.TargetPath, stagingFolder: StagingLocation.TargetPath, outputFile: outputFile) { ModListName = ModlistSettings.ModListName, ModListAuthor = ModlistSettings.AuthorText, ModListDescription = ModlistSettings.Description, ModListImage = ModlistSettings.ImagePath.TargetPath, ModListWebsite = ModlistSettings.Website, ModListReadme = ModlistSettings.ReadmeIsWebsite ? ModlistSettings.ReadmeWebsite : ModlistSettings.ReadmeFilePath.TargetPath, ReadmeIsWebsite = ModlistSettings.ReadmeIsWebsite, }; await ActiveCompilation.Begin(); } finally { StatusTracker = null; ActiveCompilation.Dispose(); ActiveCompilation = null; } }
public async Task Install() { AInstaller installer; var download = VortexCompiler.RetrieveDownloadLocation(TargetGame); var staging = VortexCompiler.RetrieveStagingLocation(TargetGame); installer = new VortexInstaller( archive: Parent.ModListLocation.TargetPath, modList: Parent.ModList.SourceModList, outputFolder: staging, downloadFolder: download); await Task.Run(async() => { try { var workTask = installer.Begin(); ActiveInstallation = installer; await workTask; } finally { ActiveInstallation = null; } }); }
public async Task <bool> Install() { AInstaller installer; var download = VortexCompiler.RetrieveDownloadLocation(TargetGame); var staging = VortexCompiler.RetrieveStagingLocation(TargetGame); using (installer = new VortexInstaller( archive: Parent.ModListLocation.TargetPath, modList: Parent.ModList.SourceModList, outputFolder: staging, downloadFolder: download, 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; } })); } }
protected VortexCompiler MakeCompiler() { return(new VortexCompiler( game: utils.Game, gamePath: utils.GameFolder, vortexFolder: VortexCompiler.TypicalVortexFolder(), downloadsFolder: VortexCompiler.RetrieveDownloadLocation(utils.Game), stagingFolder: VortexCompiler.RetrieveStagingLocation(utils.Game), outputFile: $"test{ExtensionManager.Extension}")); }
public VortexInstallerVM(InstallerVM installerVM) { Parent = installerVM; _TargetGame = installerVM.WhenAny(x => x.ModList.SourceModList.GameType) .ToProperty(this, nameof(TargetGame)); CanInstall = Observable.CombineLatest( this.WhenAny(x => x.TargetGame) .Select(game => VortexCompiler.IsActiveVortexGame(game)), installerVM.WhenAny(x => x.ModListLocation.InError), resultSelector: (isVortexGame, modListErr) => isVortexGame && !modListErr); }
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 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(); }
public async Task <GetResponse <ModList> > Compile() { string outputFile = $"{ModlistSettings.ModListName}{Consts.ModListExtension}"; if (!string.IsNullOrWhiteSpace(Parent.OutputLocation.TargetPath)) { outputFile = Path.Combine(Parent.OutputLocation.TargetPath, outputFile); } try { using (ActiveCompilation = new VortexCompiler( game: SelectedGame.Game, gamePath: GameLocation.TargetPath, vortexFolder: VortexCompiler.TypicalVortexFolder(), downloadsFolder: DownloadsLocation.TargetPath, stagingFolder: StagingLocation.TargetPath, outputFile: outputFile) { ModListName = ModlistSettings.ModListName, ModListAuthor = ModlistSettings.AuthorText, ModListDescription = ModlistSettings.Description, ModListImage = ModlistSettings.ImagePath.TargetPath, ModListWebsite = ModlistSettings.Website, ModListReadme = ModlistSettings.ReadmeIsWebsite ? ModlistSettings.ReadmeWebsite : ModlistSettings.ReadmeFilePath.TargetPath, ReadmeIsWebsite = ModlistSettings.ReadmeIsWebsite, }) { Parent.MWVM.Settings.Performance.AttachToBatchProcessor(ActiveCompilation); var success = await ActiveCompilation.Begin(); return(GetResponse <ModList> .Create(success, ActiveCompilation.ModList)); } } finally { StatusTracker = null; ActiveCompilation.Dispose(); ActiveCompilation = null; } }
public IgnoreVortex(ACompiler compiler) : base(compiler) { _vortex = (VortexCompiler)compiler; }
public VortexCompilerVM(CompilerVM parent) { Parent = parent; GameLocation = new FilePickerVM() { ExistCheckOption = FilePickerVM.CheckOptions.On, PathType = FilePickerVM.PathTypeOptions.Folder, PromptTitle = "Select Game Folder Location" }; DownloadsLocation = new FilePickerVM() { ExistCheckOption = FilePickerVM.CheckOptions.On, PathType = FilePickerVM.PathTypeOptions.Folder, PromptTitle = "Select Downloads Folder" }; StagingLocation = new FilePickerVM() { ExistCheckOption = FilePickerVM.CheckOptions.On, PathType = FilePickerVM.PathTypeOptions.Folder, PromptTitle = "Select Staging Folder" }; // Load custom ModList settings when game type changes _modListSettings = (this).WhenAny(x => x.SelectedGame) .Select(game => { if (game == null) { return(null); } var gameSettings = _settings.ModlistSettings.TryCreate(game.Game); return(new ModlistSettingsEditorVM(gameSettings.ModlistSettings)); }) // Interject and save old while loading new .Pairwise() .Do(pair => { var(previous, current) = pair; previous?.Save(); current?.Init(); }) .Select(x => x.Current) .ToGuiProperty(this, nameof(ModlistSettings)); CanCompile = Observable.CombineLatest( this.WhenAny(x => x.GameLocation.InError), this.WhenAny(x => x.DownloadsLocation.InError), this.WhenAny(x => x.StagingLocation.InError), this.WhenAny(x => x.ModlistSettings) .Select(x => x?.InError ?? Observable.Return(false)) .Switch(), (g, d, s, ml) => !g && !d && !s && !ml) .Publish() .RefCount(); // Load settings _settings = parent.MWVM.Settings.Compiler.VortexCompilation; SelectedGame = _gameOptions.FirstOrDefault(x => x.Game == _settings.LastCompiledGame) ?? _gameOptions[0]; parent.MWVM.Settings.SaveSignal .Subscribe(_ => Unload()) .DisposeWith(CompositeDisposable); // Load custom game settings when game type changes (this).WhenAny(x => x.SelectedGame) .Select(game => _settings.ModlistSettings.TryCreate(game.Game)) .Pairwise() .Subscribe(pair => { // Save old var(previous, current) = pair; if (previous != null) { previous.GameLocation = GameLocation.TargetPath; } // Load new GameLocation.TargetPath = current?.GameLocation; if (string.IsNullOrWhiteSpace(GameLocation.TargetPath)) { SetGameToSteamLocation(); } if (string.IsNullOrWhiteSpace(GameLocation.TargetPath)) { SetGameToGogLocation(); } DownloadsLocation.TargetPath = current?.DownloadLocation; if (string.IsNullOrWhiteSpace(DownloadsLocation.TargetPath)) { DownloadsLocation.TargetPath = VortexCompiler.RetrieveDownloadLocation(SelectedGame.Game); } StagingLocation.TargetPath = current?.StagingLocation; if (string.IsNullOrWhiteSpace(StagingLocation.TargetPath)) { StagingLocation.TargetPath = VortexCompiler.RetrieveStagingLocation(SelectedGame.Game); } }) .DisposeWith(CompositeDisposable); // Find game commands FindGameInSteamCommand = ReactiveCommand.Create(SetGameToSteamLocation); FindGameInGogCommand = ReactiveCommand.Create(SetGameToGogLocation); // Add additional criteria to download/staging folders DownloadsLocation.AdditionalError = this.WhenAny(x => x.DownloadsLocation.TargetPath) .Select(path => path == null ? ErrorResponse.Success : VortexCompiler.IsValidDownloadsFolder(path)); StagingLocation.AdditionalError = this.WhenAny(x => x.StagingLocation.TargetPath) .Select(path => path == null ? ErrorResponse.Success : VortexCompiler.IsValidBaseStagingFolder(path)); }
public IgnoreDisabledVortexMods(ACompiler compiler) : base(compiler) { _vortexCompiler = (VortexCompiler)compiler; }