Пример #1
0
        private void InitSettingManager()
        {
            try {
                this.jsonSettingAdapter = JsonSettingAdapter.FromApplicationDataPath(SettingStore_VendorName, SettingStore_AssetName);
                this.jsonSettingAdapter.Load();
            }
            catch (Rotorz.Json.JsonParserException ex) {
                Debug.LogError("JsonParserException: Was unable to parse '" + SettingStore_AssetName + "' configuration.\nSettings.json" + ex.Message);

                try {
                    // Create backup of invalid configuration file since it will be
                    // automatically overwritten when settings are next saved.
                    if (File.Exists(this.jsonSettingAdapter.Path))
                    {
                        string backupPath = GetUniqueFilePath(this.jsonSettingAdapter.Path + ".bak");
                        File.Move(this.jsonSettingAdapter.Path, backupPath);
                    }
                }
                catch (Exception ex2) {
                    Debug.LogError("Failed to move invalid '" + SettingStore_AssetName + "' configuration (see exception in next log entry).");
                    Debug.LogException(ex2);
                }
            }

            this.settingManager = new SettingManager(this.jsonSettingAdapter);
            this.settingManager.MessageFeedback += this._settingManager_MessageFeedback;
        }
Пример #2
0
 private void CleanupSettingManager()
 {
     if (this.settingManager != null)
     {
         this.settingManager.Save();
         this.settingManager.MessageFeedback -= this._settingManager_MessageFeedback;
         this.settingManager = null;
     }
     this.jsonSettingAdapter = null;
 }