Ejemplo n.º 1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            Settings settings = new Settings(JarPathBox.Text, DigitalStorageValue.Parse(RamBox.Text + RamUnitBox.Text), VanillaJarBox.Checked);

            settings.SaveSettingsFile();
            Settings.LoadSettingsFile();
        }
Ejemplo n.º 2
0
        private static Settings LoadSettingsFile(string settingsFilePath)
        {
            if (!File.Exists(settingsFilePath))
            {
                throw new FileNotFoundException("Settings file " + settingsFilePath + " could not be found.");
            }

            //Reads settings
            StreamReader  sr    = new StreamReader(settingsFilePath);
            List <string> lines = new List <string>();

            while (!sr.EndOfStream)
            {
                lines.Add(sr.ReadLine());
            }
            sr.Close();

            string serverJarPath             = lines[3];
            DigitalStorageValue dedicatedRam = DigitalStorageValue.Parse(lines[6]);
            bool defaultJar = Boolean.Parse(lines[9]);

            return(new Settings(serverJarPath, dedicatedRam, defaultJar));
        }