Exemple #1
0
        public MainForm()
        {
            InitializeComponent();
            ClientInfoSave cis = new ClientInfoSave();


            try
            {
                using (StreamReader sw = new StreamReader(Directory.GetCurrentDirectory() + "/settings.json"))
                {
                    string json = sw.ReadToEnd();
                    cis = JsonConvert.DeserializeObject <ClientInfoSave>(json);
                    ClientInfo.nickname      = cis.nickname;
                    ClientInfo.path          = cis.path;
                    ClientInfo.modpackstatus = cis.modpackstatus;
                    ClientInfo.exitonstart   = cis.exitonstart;
                    sw.Close();
                }
            }
            catch
            {
            }
            tbNickname.Text = ClientInfo.nickname;

            this.Text        = ServerInfo.servername + " launcher";
            bModpack.Enabled = ServerInfo.allowInstallModPack;
            if (!ServerInfo.allowInstallModPack)
            {
                bModpack.Hide();
            }
        }
Exemple #2
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            ClientInfoSave cis = new ClientInfoSave();

            cis.nickname      = ClientInfo.nickname;
            cis.path          = ClientInfo.path;
            cis.modpackstatus = ClientInfo.modpackstatus;
            cis.exitonstart   = ClientInfo.exitonstart;
            string serialized = JsonConvert.SerializeObject(cis);

            using (StreamWriter sw = new StreamWriter(Directory.GetCurrentDirectory() + "/settings.json"))
            {
                sw.Write(serialized);
                sw.Close();
            }
        }