private void quickLoadButton_Click(object sender, EventArgs e) { string output = ""; InputMediate.Show(true, "SDVXStarter - Quick Load", "Paste the fast config text here to fill settings:", out output); EA3Compiler loaded = new EA3Compiler(output, true); if (!loaded.CheckValidity()) { MessageBox.Show("The xml file you selected is invalid."); } else { SafeAdd(this.pcbidCombo.Items, loaded.PCBID); this.pcbidCombo.Text = loaded.PCBID; SafeAdd(this.urlCombo.Items, loaded.Services); this.urlCombo.Text = loaded.Services; if (loaded.UrlSlash.Equals("1")) { slashButton0.Checked = false; slashButton1.Checked = true; } else { slashButton0.Checked = true; slashButton1.Checked = false; } } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { bool selected = false; OpenFileDialog xmlSelector = new OpenFileDialog(); xmlSelector.Title = "Select the ea3-config.xml you'd like to load:"; xmlSelector.Filter = "ea3-config.xml|*.xml"; if (!path.Equals("(root path)") && !path.Equals("(Remove)") && !path.Equals("")) { xmlSelector.InitialDirectory = path; } else { xmlSelector.InitialDirectory = Application.StartupPath; } if (xmlSelector.ShowDialog() == DialogResult.OK) { if (string.IsNullOrEmpty(xmlSelector.FileName)) { MessageBox.Show(this, "Cannot process null path.", "SDVXStarter"); } else { RefreshView(); selected = true; this.pathContentLabel.Text = xmlSelector.FileName; this.verContentLabel.Text = this.storage.GetVersion(FindFatherPathContainSpice(xmlSelector.FileName, false)); } } if (selected) { EA3Compiler compiler = new EA3Compiler(xmlSelector.FileName); if (!compiler.CheckValidity()) { MessageBox.Show("The xml file you selected is invalid."); } else { SafeAdd(this.versionCombo.Items, compiler.Version); this.versionCombo.Text = compiler.Version; SafeAdd(this.pcbidCombo.Items, compiler.PCBID); this.pcbidCombo.Text = compiler.PCBID; SafeAdd(this.urlCombo.Items, compiler.Services); this.urlCombo.Text = compiler.Services; if (compiler.UrlSlash.Equals("1")) { slashButton0.Checked = false; slashButton1.Checked = true; } else { slashButton0.Checked = true; slashButton1.Checked = false; } this.brandNew = false; } } }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { string path = pathContentLabel.Text; bool propExist; if (pathContentLabel.Text.Equals("") || pathContentLabel.Text.Equals("(root path)") || pathContentLabel.Text.Equals("(Remove)")) { path = "\\prop\\ea3-config.xml"; } propExist = File.Exists(path); if (!propExist) { MessageBox.Show("The path you selected does not contain prop\\ea3-config.xml. \nPlease use save as function to save."); } else if (propExist) { EA3Compiler compiler = new EA3Compiler(path); if (!compiler.CheckValidity()) { MessageBox.Show("The ea3-config.xml in " + path + " is not valid."); } else { string preProcessPCBID = pcbidCombo.Text; string preProcessURL = urlCombo.Text; if (preProcessPCBID.Equals("(Default)")) { preProcessPCBID = "01020304050607080900"; } else if (preProcessPCBID.Equals("(Empty)")) { preProcessPCBID = ""; } if (preProcessURL.Equals("(Empty)") || preProcessURL.Equals("(Offline)")) { preProcessURL = ""; } compiler.PCBID = preProcessPCBID; compiler.Services = preProcessURL; if (slashButton1.Checked) { compiler.UrlSlash = "1"; } else { compiler.UrlSlash = "0"; } compiler.UpdateByRuntime(); compiler.SaveXml(path); MessageBox.Show("Successfully saved ea3-config.xml at path " + path); } } }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { if (brandNew) { MessageBox.Show("The current version does not support creating brand new ea3-config.\nPlease open an existing file to save."); } else { bool selected = false; SaveFileDialog xmlSelector = new SaveFileDialog(); xmlSelector.Title = "Select the ea3-config.xml you'd like to save:"; xmlSelector.FileName = "ea3-config.xml"; xmlSelector.Filter = "ea3-config.xml|*.xml"; if (!pathContentLabel.Text.Equals("(root path)") && !pathContentLabel.Text.Equals("(Remove)") && !pathContentLabel.Text.Equals("")) { xmlSelector.InitialDirectory = FindFatherPathContainSpice(pathContentLabel.Text, false); } else { xmlSelector.InitialDirectory = Application.StartupPath; } if (xmlSelector.ShowDialog() == DialogResult.OK) { if (string.IsNullOrEmpty(xmlSelector.FileName)) { MessageBox.Show(this, "Cannot process null path.", "SDVXStarter"); } else { selected = true; } } if (selected) { EA3Compiler compiler = new EA3Compiler(xmlSelector.FileName); if (!compiler.CheckValidity()) { MessageBox.Show("The xml file you selected is invalid."); } else { string preProcessPCBID = pcbidCombo.Text; string preProcessURL = urlCombo.Text; if (preProcessPCBID.Equals("(Default)")) { preProcessPCBID = "01020304050607080900"; } else if (preProcessPCBID.Equals("(Empty)")) { preProcessPCBID = ""; } if (preProcessURL.Equals("(Empty)") || preProcessURL.Equals("(Offline)")) { preProcessURL = ""; } compiler.PCBID = preProcessPCBID; compiler.Services = preProcessURL; if (slashButton1.Checked) { compiler.UrlSlash = "1"; } else { compiler.UrlSlash = "0"; } compiler.UpdateByRuntime(); compiler.SaveXml(xmlSelector.FileName); MessageBox.Show("Successfully saved ea3-config.xml at path " + xmlSelector.FileName); } } } }