private void menuBuild_Click(object sender, EventArgs e) { string exportFolder = PathHelper.FolderExport + "release" + Path.DirectorySeparatorChar + (_ProjectManager.CurrentProject.ExportWithDateFolder ? string.Format("{0:yyyyMMdd-HHmmss}", DateTime.Now) + Path.DirectorySeparatorChar : string.Empty); if (!Directory.Exists(exportFolder) || (Directory.Exists(exportFolder) && MessageBox.Show(string.Format(UIStrings.WARN_EXPORT_FOLDER_EXISTS, exportFolder), UIStrings.CAPTION_PACK_REBUILD, MessageBoxButtons.YesNo) == DialogResult.Yes)) { MessageBox.Show(string.Format(UIStrings.INFO_PACK_REBUILD, _ProjectManager.CurrentProject.ProjectExportFolder), UIStrings.CAPTION_PACK_REBUILD); _ProjectManager.RebuildRFAndPatchlist(); } }
static void Main(string[] Args) { if (Args.Length == 0) { var handle = GetConsoleWindow(); ShowWindow(handle, SW_HIDE); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Main main = new Main(Args); if (main.MainLoaded) { Application.Run(main); } } else { Sm4shProject _ProjectManager = new Sm4shProject(); switch (Args[0]) { case "help": case "--help": Console.WriteLine("Possible arguments:"); Console.WriteLine("To setup configuration: \'gamedump [path/to/gameDump]\'"); Console.WriteLine("To build with packing: \'build\'"); break; case "gamedump": case "--gamedump": if (Args.Length != 2) { Console.WriteLine("Expected arguments: \'gamedump [path/to/gameDump]\'"); return; } string gameFolder = Args[1]; if (gameFolder[gameFolder.Length - 1] != Path.DirectorySeparatorChar) { gameFolder += Path.DirectorySeparatorChar; } if (!PathHelper.IsItSmashFolder(gameFolder)) { Console.WriteLine(UIStrings.ERROR_LOADING_GAME_FOLDER); return; } if (!PathHelper.DoesItHavePatchFolder(gameFolder)) { Console.WriteLine(UIStrings.ERROR_LOADING_GAME_PATCH_FOLDER); return; } LogHelper.Info("Creating configuration file..."); Sm4shMod newProject = _ProjectManager.CreateNewProject(GlobalConstants.CONFIG_FILE, gameFolder); Console.WriteLine(UIStrings.CREATE_PROJECT_SUCCESS); break; case "build": case "--build": if (!File.Exists(GlobalConstants.CONFIG_FILE)) { Console.WriteLine("No configuration exists. Run \'sm4shexplorer.exe gamedump [path/to/gameDump]\'"); return; } _ProjectManager.LoadProject(GlobalConstants.CONFIG_FILE); if (_ProjectManager.CurrentProject == null) { return; } Options _Options = new Options(_ProjectManager.CurrentProject); _ProjectManager.RebuildRFAndPatchlist(); break; default: Console.WriteLine("Unsupported argument. Supported arguments include: help, gamedump, build"); break; } } }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorkerInstance bw = e.Argument as BackgroundWorkerInstance; if (bw == null) { return; } Console.SetOut(_ConsoleProgress); _CurrentBackgroundInstance = bw; switch (bw.Mode) { case BackgroundWorkerMode.ProjectLoading: LoadConfig(); break; case BackgroundWorkerMode.BuildProject: string exportedFolder = _ProjectManager.RebuildRFAndPatchlist((bool)bw.Object); string sdCardPath = _ProjectManager.GetSDFolder(); if (exportedFolder != string.Empty && !string.IsNullOrEmpty(sdCardPath)) { string wsName = GetWorkspaceName(exportedFolder); if (wsName == null) { string defaultName = PathHelper.FolderWorkplace.TrimEnd(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) .Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) .Last(); using (ModpackName box = new ModpackName(defaultName)) { if (box.ShowDialog() == DialogResult.OK) { _ProjectManager.SendToSD(exportedFolder, box._ModpackName); } } } else if (MessageBox.Show($"Do you want to copy your newly built modpack to your SD card or USB?\nModpack name: {wsName}", UIStrings.CAPTION_PACK_REBUILD, MessageBoxButtons.YesNo) == DialogResult.Yes) { _ProjectManager.SendToSD(exportedFolder, wsName); } } break; case BackgroundWorkerMode.SendToSD: string workspaceName = GetWorkspaceName((string)bw.Object); if (workspaceName == null) { string defaultName = PathHelper.FolderWorkplace.TrimEnd(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) .Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) .Last(); using (ModpackName box = new ModpackName(defaultName)) { if (box.ShowDialog() == DialogResult.OK) { _ProjectManager.SendToSD((string)bw.Object, box._ModpackName); } } } else { _ProjectManager.SendToSD((string)bw.Object, workspaceName); } break; } }