コード例 #1
0
        public bool CreateConfig()
        {
            MessageBox.Show(this, UIStrings.CREATE_PROJECT_FIND_FOLDER, UIStrings.CAPTION_CREATE_PROJECT);
            while (true)
            {
                DialogResult result = folderBrowserDialog.ShowDialog(this);
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    string gameFolder = folderBrowserDialog.SelectedPath + Path.DirectorySeparatorChar;
                    if (!PathHelper.IsItSmashFolder(gameFolder))
                    {
                        MessageBox.Show(this, UIStrings.ERROR_LOADING_GAME_FOLDER, UIStrings.CAPTION_ERROR_LOADING_GAME_FOLDER);
                        continue;
                    }
                    if (!PathHelper.DoesItHavePatchFolder(gameFolder))
                    {
                        MessageBox.Show(this, UIStrings.ERROR_LOADING_GAME_PATCH_FOLDER, UIStrings.CAPTION_ERROR_LOADING_GAME_FOLDER);
                        continue;
                    }

                    LogHelper.Info("Creating configuration file...");
                    Sm4shMod newProject = _ProjectManager.CreateNewProject(UIConstants.CONFIG_FILE, gameFolder);
                    new CreationProjectInfo(newProject, _ProjectManager).ShowDialog(this);
                    MessageBox.Show(this, UIStrings.CREATE_PROJECT_SUCCESS, UIStrings.CAPTION_CREATE_PROJECT);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: jam1garner/Sm4shExplorer
        public bool CreateConfig()
        {
            MessageBox.Show(this, UIStrings.CREATE_PROJECT_FIND_FOLDER, UIStrings.CAPTION_CREATE_PROJECT);
            while (true)
            {
                CommonOpenFileDialog folderDialog = new CommonOpenFileDialog();
                folderDialog.IsFolderPicker = true;
                if (folderDialog.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    string gameFolder = folderDialog.FileName + Path.DirectorySeparatorChar;
                    if (!PathHelper.IsItSmashFolder(gameFolder))
                    {
                        MessageBox.Show(this, UIStrings.ERROR_LOADING_GAME_FOLDER, UIStrings.CAPTION_ERROR_LOADING_GAME_FOLDER);
                        continue;
                    }
                    if (!PathHelper.DoesItHavePatchFolder(gameFolder))
                    {
                        MessageBox.Show(this, UIStrings.ERROR_LOADING_GAME_PATCH_FOLDER, UIStrings.CAPTION_ERROR_LOADING_GAME_FOLDER);
                        continue;
                    }

                    LogHelper.Info("Creating configuration file...");
                    Sm4shMod newProject = _ProjectManager.CreateNewProject(GlobalConstants.CONFIG_FILE, gameFolder);
                    new CreationProjectInfo(newProject, _ProjectManager).ShowDialog(this);
                    MessageBox.Show(this, UIStrings.CREATE_PROJECT_SUCCESS, UIStrings.CAPTION_CREATE_PROJECT);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: jugeeya/Sm4shExplorer
        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;
                }
            }
        }