public static bool AnyGamesConfigured() { // sadx validity check string sadxpcfailreason = ""; bool sadxPCIsValid = GamePathChecker.CheckSADXPCValid(settings.SADXPCPath, out sadxpcfailreason); // sa2 valididty check next string sa2pcFailReason = ""; bool sa2PCIsValid = GamePathChecker.CheckSA2PCValid(settings.SA2PCPath, out sa2pcFailReason); return(sadxPCIsValid || sa2PCIsValid); }
private void GameConfig_FormClosing(object sender, FormClosingEventArgs e) { if (this.DialogResult == DialogResult.Abort) { return; } SaveSettings(); // check validitiy // check validity string sadxFailReason = ""; bool sadxpcValid = GamePathChecker.CheckSADXPCValid( Program.Settings.SADXPCPath, out sadxFailReason); if (!sadxpcValid) { MessageBox.Show(sadxFailReason, "SADX PC Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } string sa2PCFailReason = ""; bool sa2PCValid = GamePathChecker.CheckSA2PCValid( Program.Settings.SA2PCPath, out sa2PCFailReason); if (!sa2PCValid) { MessageBox.Show(sa2PCFailReason, "SA2 PC Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (!Program.AnyGamesConfigured()) { DialogResult dialogResult = MessageBox.Show("No games configured", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (dialogResult == DialogResult.Cancel) { this.DialogResult = DialogResult.Abort; e.Cancel = false; Application.Exit(); return; } else { return; } } e.Cancel = true; this.Hide(); }
public NewProject() { InitializeComponent(); sadxIsValid = GamePathChecker.CheckSADXPCValid( Program.Settings.SADXPCPath, out string sadxInvalidReason); sa2pcIsValid = GamePathChecker.CheckSA2PCValid( Program.Settings.SA2PCPath, out string sa2pcInvalidReason); backgroundWorker1.RunWorkerCompleted += BackgroundWorker1_RunWorkerCompleted; SADXPCButton.Checked = (sadxIsValid); SA2RadioButton.Checked = (false); SetControls(); }
void SetControls() { // check valid states again sadxIsValid = GamePathChecker.CheckSADXPCValid( Program.Settings.SADXPCPath, out string sadxInvalidReason); sa2pcIsValid = GamePathChecker.CheckSA2PCValid( Program.Settings.SA2PCPath, out string sa2pcInvalidReason); ProjectNameBox.Enabled = true; SA2RadioButton.Enabled = sa2pcIsValid; SADXPCButton.Enabled = sadxIsValid; BackButton.Enabled = true; AuthorTextBox.Enabled = true; DescriptionTextBox.Enabled = true; ControlBox = true; NextButton.Enabled = (ProjectNameBox.Text.Length > 0); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { #if !DEBUG try { #endif // we should disable all form controls SA_Tools.Game game = GetGameForRadioButtons(); using (ProgressDialog progress = new ProgressDialog("Creating project")) { Invoke((Action)progress.Show); // create the folder progress.StepProgress(); progress.SetStep("Creating Folder"); string gameFolder = GetGameFolder(); string outputFolder = GetOutputFolder(); Directory.CreateDirectory(outputFolder); // create our convenience folders string exportFolderPath = Path.Combine(outputFolder, "Exports"); Directory.CreateDirectory(exportFolderPath); string exportReadmePath = Path.Combine(exportFolderPath, "readme.txt"); File.WriteAllLines(exportReadmePath, new string[] { "Use this for storing models for export." }); string importFolderPath = Path.Combine(outputFolder, "Imports"); Directory.CreateDirectory(importFolderPath); string importReadmePath = Path.Combine(importFolderPath, "readme.txt"); File.WriteAllLines(importReadmePath, new string[] { "Use this for storing models for import." }); string sourceFolderPath = Path.Combine(outputFolder, "Source"); Directory.CreateDirectory(sourceFolderPath); string sourceReadmePath = Path.Combine(sourceFolderPath, "readme.txt"); File.WriteAllLines(sourceReadmePath, new string[] { "Use this folder for storing your source code." }); // get our ini files to split string iniFolder = ""; #if DEBUG iniFolder = Path.GetDirectoryName(Application.ExecutablePath) + "/../Configuration/" + GetIniFolderForGame(game); if (!Directory.Exists(iniFolder)) { iniFolder = Path.GetDirectoryName(Application.ExecutablePath) + "/../" + GetIniFolderForGame(game); } #endif #if !DEBUG iniFolder = Path.GetDirectoryName(Application.ExecutablePath) + "/../" + GetIniFolderForGame(game); #endif // we need to run split if (game == SA_Tools.Game.SADX) { DoSADXSplit(progress, gameFolder, iniFolder, outputFolder); } else if (game == SA_Tools.Game.SA2B) { DoSA2PCSplit(progress, gameFolder, iniFolder, outputFolder); } progress.StepProgress(); progress.SetStep("Creating mod.ini"); if (game == SA_Tools.Game.SADX) { GenerateSADXModFile(gameFolder, ProjectNameBox.Text); } else { GenerateSA2ModFile(gameFolder, ProjectNameBox.Text); } // create our system directory string systemPath = Path.Combine(outputFolder, GamePathChecker.GetSystemPathName(game)); Directory.CreateDirectory(systemPath); Invoke((Action)progress.Close); } #if !DEBUG } catch (Exception ex) { createError = ex; } #endif }