コード例 #1
0
            /// <summary>
            /// initializes <see cref="SettingsContainer"/> with data from existing
            /// corresponding data file.
            /// </summary>
            /// <exception cref="FileReadException">
            /// thrown if reading from <see cref="SettingsContainer"/> data file failed
            /// </exception>
            /// <exception cref="JsonSerializationException">
            /// thrown if <see cref="SettingsContainer"/> data file content is not in a valid
            /// JSON format.
            /// </exception>
            /// <exception cref="SettingsContainerJsonObjectParseException">
            /// thrown if parsing <see cref="SettingsContainer"/> from <see cref="SettingsContainer"/>
            /// data file content failed
            /// </exception>
            private void initializeSettingsContainerFromExistingDataFile()
            {
                // initialize settings container with values from settings file
                string settingsContainerJsonString = FileIOUtils.ReadTextFromFile(SETTINGS_FILE_PATH);
                object settingsContainerJsonObject = JsonUtils.DeserializeObject <object>(
                    settingsContainerJsonString);

                this.settingsContainer = SettingsContainer.Parse(settingsContainerJsonObject);
            }