private void SetConfig(String workspaceFolder, ModProjectConfig projectConfig) { ModConfig = projectConfig; WorkspaceDirectory = workspaceFolder; // Reload cache based off the config. ResetLists(); // create any possible missing characters CharacterProject commonProject = new CharacterProject(); commonProject.Model = ModelType.Common; CharacterProject honokaProject = new CharacterProject(); honokaProject.Model = ModelType.Honoka; CharacterProject marieProject = new CharacterProject(); marieProject.Model = ModelType.MarieRose; for (int i = 0; i < projectConfig.CharacterMods.Count; i++) { switch (projectConfig.CharacterMods[i].Model) { case ModelType.Common: commonProject = projectConfig.CharacterMods[i]; break; case ModelType.Honoka: honokaProject = projectConfig.CharacterMods[i]; break; case ModelType.MarieRose: marieProject = projectConfig.CharacterMods[i]; break; } } // Update UI this.textBoxName.Text = projectConfig.Title; this.textBoxVersion.Text = projectConfig.Version; this.textBox1.Text = projectConfig.CostumeCustomizerMod; this.textBoxWorkspace.Text = workspaceFolder; this.textBoxWorkspace.Enabled = false; this.costumeBuilderCommon.SetConfig(commonProject); this.costumeBuilderHonoka.SetConfig(honokaProject); this.costumeBuilderMarieRose.SetConfig(marieProject); this.tabControl1.Enabled = true; }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { //try { ModProjectConfig updatedConfig = UpdateConfig(); updatedConfig.SaveConfig(Path.Combine(WorkspaceDirectory, "CostumeCustomizerModConfig.xml")); MessageBox.Show("Successfully saved Project Config."); } //catch (Exception ex) { // MessageBox.Show("Failed to save config.\nException: " + ex.ToString()); #if DEBUG // throw ex; #endif } }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { try { ModProjectConfig currentConfig = UpdateConfig(); INIGenerator generator = new INIGenerator(currentConfig); generator.GenerateINIs(WorkspaceDirectory); MessageBox.Show("Successfully export INI files.", "CC Mod Pack Generator", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Failed to export INI files.\nException: " + e.ToString(), "CC Mod Pack Generator", MessageBoxButtons.OK, MessageBoxIcon.Error); #if DEBUG throw new Exception("Uncaught exception during export.", ex); #endif } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.Filter = "Costume Customizer Mod Pack Project (CostumeCustomizerModConfig.xml)|CostumeCustomizerModConfig.xml"; openFileDialog1.DefaultExt = "CostumeCustomizerModConfig.xml"; openFileDialog1.InitialDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); DialogResult openResult = openFileDialog1.ShowDialog(); if (openResult == DialogResult.OK) { try { ModProjectConfig originalConfig = ModProjectConfig.ParseConfig(openFileDialog1.FileName); SetConfig(Path.GetDirectoryName(openFileDialog1.FileName), ModProjectConfig.ParseConfig(openFileDialog1.FileName)); } catch (Exception ex) { MessageBox.Show("Error loading " + openFileDialog1.FileName + Environment.NewLine + "Exception: " + ex.ToString(), "CC Mod Pack Generator", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public INIGenerator(ModProjectConfig config) { this.config = config; FilenameToResource = new Dictionary <string, string>(); ResourceContent = new Dictionary <string, string>(); }