public MainForm() { InitializeComponent(); if (File.Exists("./config.json")) // load config file if exists. { DBSP2ClassGen.dbhandler d = new DBSP2ClassGen.dbhandler(); ConfigInfo ci = new ConfigInfo(); d.GetConfigInfo(ref ci); txtIP.Text = ci.IP.ToString(); txtPort.Text = ci.port.ToString(); txtUsername.Text = ci.Username.ToString(); txtPassword.Text = ci.password.ToString(); cbxDatabaseList.Text = ci.dbname.ToString(); if (ci.adHocFilename != null) { lblAdHoc.Text = ci.adHocFilename.ToString(); } } AppDefaultDir = System.Environment.CurrentDirectory; }
public dbhandler() { IP = new StringBuilder(); Port = new StringBuilder(); Username = new StringBuilder(); Password = new StringBuilder(); dbname = new StringBuilder(); ci = new ConfigInfo(); }
public void GetConfigInfo(ref ConfigInfo ci) { string jsonText = LoadJson("./config.json"); ci = JsonConvert.DeserializeObject<ConfigInfo>(jsonText); }
public void GetConfigInfo(ref ConfigInfo ci) { string jsonText = LoadJson("./config.json"); ci = JsonConvert.DeserializeObject <ConfigInfo>(jsonText); }