public void GetSettings() { Process p = new Process(); try { string layoutfile = Program.workfolder + "\\setup\\installfiles.layout"; co = layout.getcontainer(layoutfile); if (co.bask && Program.uilevel == 5) { string tempfile = Program.workfolder + "\\temp.settings"; AppendToLog("GetSettings()"); JSONPersister <Dictionary <string, string> > .Write(tempfile, co.dirmapinfo); p.StartInfo.FileName = Program.workfolder + "\\setup\\ConfigEditor.exe"; p.StartInfo.Arguments = "-f:\"" + tempfile + "\" -t:\"Update Target Directories\""; p.Start(); p.WaitForExit(); co.dirmapinfo = JSONPersister <Dictionary <string, string> > .Read(tempfile); layout.write(layoutfile, co, layout.getstoragenode(layoutfile)); } } catch (Exception ex) { AppendToLog("Exception:" + ex.Message); errormsg = ex.Message; throw; } }
private void button1_Click(object sender, EventArgs e) { var temps = ConfigurationSettings.AppSettings["Customize"]; if (string.IsNullOrEmpty(temps)) { string[] props = temps.Split(';'); foreach (var pp in props) { if (!cn.propmapinfo.ContainsKey(pp)) { cn.propmapinfo.Add(pp, ""); } } } string filename = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\temp.settings"; string exename = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\ConfigEditor.exe"; JSONPersister <Dictionary <string, string> > .Write(filename, cn.propmapinfo); Process p = new Process(); p.StartInfo.FileName = exename; p.StartInfo.Arguments = "-f:\"" + filename + "\" -t:\"Update Installer properties\""; p.Start(); p.WaitForExit(); cn.propmapinfo = JSONPersister <Dictionary <string, string> > .Read(filename); Activate(); }
private void cmdSave_Click(object sender, EventArgs e) { var settings = new Dictionary <string, string>(); foreach (DataGridViewRow dgr in dataGridView1.Rows) { if (dgr.Cells[0].Value == null) { MessageBox.Show("Name cannot be null"); return; } string val = ""; if (dgr.Cells[1].Value != null) { val = dgr.Cells[1].Value.ToString(); } settings.Add(dgr.Cells[0].Value.ToString(), val); } JSONPersister <Dictionary <string, string> > .Write(Program.settingsfile, settings); DialogResult = System.Windows.Forms.DialogResult.OK; Close(); }
public static storagenode getstoragenode(string filename) { object[] objs = JSONPersister <object[]> .Read(filename); string buffer = JSONPersister <object> .GetJSON((object)objs[1]); storagenode node = JSONPersister <storagenode> .SetJSON(buffer); mergepath(node, Path.GetDirectoryName(filename), false); return(node); }
public static container getcontainer(string filename) { object[] objs = JSONPersister <object[]> .Read(filename); string buffer = JSONPersister <object> .GetJSON((object)objs[0]); container cn = JSONPersister <container> .SetJSON(buffer); mergepath(cn, Path.GetDirectoryName(filename), false); return(cn); }
private void MainFrm_Load(object sender, EventArgs e) { if (Program.title != "") { this.Text = this.Text + " - " + Program.title; } dataGridView1.Rows.Clear(); var settings = JSONPersister <Dictionary <string, string> > .Read(Program.settingsfile); foreach (KeyValuePair <string, string> kv in settings) { dataGridView1.Rows.Add(new string[] { kv.Key, kv.Value }); } }
private void btnSetDir_Click(object sender, EventArgs e) { string filename = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\temp.settings"; string exename = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\ConfigEditor.exe"; JSONPersister <Dictionary <string, string> > .Write(filename, cn.dirmapinfo); Process p = new Process(); p.StartInfo.FileName = exename; p.StartInfo.Arguments = "-f:\"" + filename + "\" -t:\"Update Target Directories\""; p.Start(); p.WaitForExit(); cn.dirmapinfo = JSONPersister <Dictionary <string, string> > .Read(filename); Activate(); }
public static void write(string filename, container co, storagenode sn) { JSONPersister <object[]> .Write(filename, new object[] { co, sn }); }
public static Dictionary <string, Customaction> read(string filename) { return(JSONPersister <Dictionary <string, Customaction> > .Read(filename)); }
public static void write(string filename, Dictionary <string, Customaction> custacts) { JSONPersister <Dictionary <string, Customaction> > .Write(filename, custacts); }