public void PutAll(Properties_ defaultSettings) { throw new NotImplementedException(); // todo }
// [SettingsVar] // public static bool testVarBool = true; // [SettingsVar(oldNames = { "testVarOldInt", "testVarVeryOldInt" } )] // public static int testVarInt = 88; // [SettingsVar] // public static String testVarStr = "heiner"; // ======================================================================= /// <summary> /// Load the settings from the hard disk. /// </summary> /// <param name="application">reference to the main object</param> public static void LoadSettings(JSoko application) { // First set os specific settings like the directories to load/save data from. OsSpecific.SetOsSpecificSettings(application); // The default settings of JSoko. defaultSettingsFilename = "settings.ini"; // Settings file for the user specific settings. string userSettingsFilename = OsSpecific.GetPreferencesDirectory() + "settings.ini"; if (!File.Exists(userSettingsFilename)) { userSettingsFilename = Utilities.GetBaseFolder() + "user_settings.ini"; // versions < 1.74 stored the file in the base folder } // The properties of this program (from skeleton). defaultSettings = new Properties_(); /** * Load the default settings file. */ var propertyInputStream = Utilities.GetBufferedReader(defaultSettingsFilename); if (propertyInputStream == null) { // Load language texts. Texts.LoadAndSetTexts(); MessageDialogs.ShowErrorString(application, Texts.GetText("message.fileMissing", "settings.ini")); Environment.Exit(-1); } try { defaultSettings.Load(propertyInputStream); } catch (IOException) { // Load language texts. Texts.LoadAndSetTexts(); MessageDialogs.ShowErrorString(application, Texts.GetText("message.fileMissing", "settings.ini")); Environment.Exit(-1); } try { propertyInputStream.Close(); } catch (IOException) { } /** * Load the user specific settings file. */ settings = new Properties_(); // The default settings are taken as initial content. settings.PutAll(defaultSettings); // The program version is always read from the default settings file. programVersion = GetString("version", ""); // Load the user settings. BufferedReader inStream = null; try { inStream = Utilities.GetBufferedReader(userSettingsFilename); settings.Load(inStream); inStream.Close(); inStream = null; // we are completely done with it } catch (Exception) { /* Program starts with default settings. */ } finally { if (inStream != null) { try { inStream.Close(); } catch (IOException) { } } } // Some Settings must always be set to the default value. /* empty */ // Set the program variables corresponding to the loaded settings. // Name changes for properties are also handled there. SetProgramVariablesFromSettings(); }