private void MainForm_Load(object sender, EventArgs e) { int_token = 0; /*AuthForm = new AuthentificationForm(); * RegForm = new RegistartionForm(); * SmileForm = new Smiles(); * PForm = new Port();*/ TextBox_username = fieldUsername; try { config = IMainFunction.FromJsonFile <Config>("config.json"); } catch { config = new Config() { _Width = 622, //622 _Height = 441, //441 _Update_rate = 1000, //1000 _Port = "5000" //5000 }; IMainFunction.ToJsonFile("config.json", config); } Width = config._Width; Height = config._Height; updateLoop.Interval = config._Update_rate; }
private void button1_Click(object sender, EventArgs e) { config = IMainFunction.FromJsonFile <Config>("config.json"); config._Port = textBox1.Text; IMainFunction.ToJsonFile("config.json", config); MessageBox.Show("Вы поменяли порт.", "Изменение порта", MessageBoxButtons.OK, MessageBoxIcon.Information); mForm.Show(); this.Visible = false; Application.Restart(); }
private void AuthentificationForm_Load(object sender, EventArgs e) { try { config = IMainFunction.FromJsonFile <Config>("config.json"); } catch { config = new Config() { _Port = "5000"//5000 }; IMainFunction.ToJsonFile("config.json", config); } }