Exemplo n.º 1
0
        private void NewDoW2ModToolStripMenuItemClick(object sender, EventArgs e)
        {
            var dlgNewMod = new NewModDialog(ModManager.GameDirectory);

            if (dlgNewMod.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            ModCreator creator = new ModCreator(dlgNewMod.BaseModule, dlgNewMod.ModName, dlgNewMod.DisplayedModName,
                                                dlgNewMod.ModVersion, dlgNewMod.ModDescription, dlgNewMod.UCSBaseIndex,
                                                dlgNewMod.RepackAttribArchive);

            if (dlgNewMod.RepackAttribArchive)
            {
                ParameterizedThreadStart writeMod = x =>
                {
                    creator.WriteMod();
                    ModManager.LoadModule(creator.ModulePath);
                };
                var createThread = new Thread(writeMod);
                createThread.Start(null);
                ShowLoadForm();
                return;
            }

            try
            {
                creator.WriteMod();
            }
            catch (Exception ex)
            {
                LoggingManager.SendError("ModCreator - Failed to create Mod");
                LoggingManager.HandleException(ex);
                UIHelper.ShowError("Failed to create Mod. See logfile for more information.");
                return;
            }

            ParameterizedThreadStart load = x => ModManager.LoadModule(x as string);
            var loadThread = new Thread(load);

            loadThread.Start(creator.ModulePath);
            ShowLoadForm();
        }
Exemplo n.º 2
0
        private void NewDoW2ModToolStripMenuItemClick(object sender, EventArgs e)
        {
            var dlgNewMod = new NewModDialog(ModManager.GameDirectory);
            if (dlgNewMod.ShowDialog() != DialogResult.OK)
                return;

            ModCreator creator = new ModCreator(dlgNewMod.BaseModule, dlgNewMod.ModName, dlgNewMod.DisplayedModName,
                                                dlgNewMod.ModVersion, dlgNewMod.ModDescription, dlgNewMod.UCSBaseIndex,
                                                dlgNewMod.RepackAttribArchive);

            if (dlgNewMod.RepackAttribArchive)
            {
                ParameterizedThreadStart writeMod = x =>
                                                        {
                                                            creator.WriteMod();
                                                            ModManager.LoadModule(creator.ModulePath);
                                                        };
                var createThread = new Thread(writeMod);
                createThread.Start(null);
                ShowLoadForm();
                return;
            }

            try
            {
                creator.WriteMod();
            }
            catch (Exception ex)
            {
                LoggingManager.SendError("ModCreator - Failed to create Mod");
                LoggingManager.HandleException(ex);
                 UIHelper.ShowError("Failed to create Mod. See logfile for more information.");
                return;
            }

            ParameterizedThreadStart load = x => ModManager.LoadModule(x as string);
            var loadThread = new Thread(load);
            loadThread.Start(creator.ModulePath);
            ShowLoadForm();
        }