private void NewProject_ProjectCreated(SA_Tools.Game game, string projectName, string fullProjectPath) { newProject.Hide(); MessageBox.Show("Project creation complete!"); projectActions.Init(game, projectName, fullProjectPath); projectActions.Show(); }
public void Init(SA_Tools.Game game, string projectName, string projectFolder) { this.game = game; this.projectName = projectName; ProjectNameLAbel.Text = projectName + " : " + game.ToString(); this.projectFolder = projectFolder; SADXLVL2Button.Enabled = game == SA_Tools.Game.SADX; SADXTweaker2Button.Enabled = game == SA_Tools.Game.SADX; }
/// <summary> /// Gets the primary game content folder. /// For SADX PC this is called 'System', /// for SA2PC it's called 'gd_PC' /// </summary> /// <param name="game"></param> /// <returns></returns> public static string GetSystemPathName(SA_Tools.Game game) { switch (game) { case SA_Tools.Game.SA1: case SA_Tools.Game.SA2: throw new System.NotSupportedException(); case SA_Tools.Game.SADX: return("system"); case SA_Tools.Game.SA2B: return("resource/gd_PC"); default: throw new System.NotSupportedException(); } }
private string GetIniFolderForGame(SA_Tools.Game game) { switch (game) { case SA_Tools.Game.SA1: return("SA1"); case SA_Tools.Game.SADX: return("SADXPC"); case SA_Tools.Game.SA2: return("SA2"); case SA_Tools.Game.SA2B: return("SA2PC"); default: break; } return(""); }
private void ProjectSelect_ProjectSelceted(SA_Tools.Game game, string projectName, string fullProjectPath) { this.Hide(); projectActions.Init(game, projectName, fullProjectPath); projectActions.Show(); }
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 }