예제 #1
0
        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);
                }
            }
        }
예제 #2
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);
                }
            }
        }
예제 #3
0
 internal static void InitializePathHelper(Sm4shMod project)
 {
     if (project == null)
     {
         throw new Exception("Project null");
     }
     _Project = project;
 }
예제 #4
0
        public CreationProjectInfo(Sm4shMod config, Sm4shProject project)
        {
            InitializeComponent();

            _Config  = config;
            _Project = project;

            ddpGameRegion.Items.Add("JPN (Zone 1)");
            ddpGameRegion.Items.Add("USA (Zone 2)");
            ddpGameRegion.Items.Add("??? (Zone 3)");
            ddpGameRegion.Items.Add("EUR (Zone 4)");
        }
예제 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Sm4shMod mod = _Project.CurrentProject;

            mod.PluginsOrder = new List <string>();
            foreach (Sm4shBasePlugin plugin in _Project.Plugins)
            {
                mod.PluginsOrder.Add(plugin.Filename);
            }

            _Project.SaveProject();

            this.Close();
        }
예제 #6
0
 internal static void InitializeLogHelper(Sm4shMod project)
 {
     _Project = project;
 }
예제 #7
0
        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;
                }
            }
        }
예제 #8
0
 public Options(Sm4shMod project)
 {
     InitializeComponent();
     _Project = project;
 }