public ConfigModel getConfigModel(string openId) { UserProvider provider = new UserProvider(); ConfigModel model = ConfigConverter.configEntityToModel(provider.getUserConfig(openId)); return(model); }
private void Awake() { if (instance != null) { Logger.log?.Warn($"Instance of {this.GetType().Name} already exists, destroying."); GameObject.DestroyImmediate(this); return; } GameObject.DontDestroyOnLoad(this); instance = this; string path = Path.Combine(UnityGame.UserDataPath, $"{Plugin.Name}.ini"); string backupPath = backupPath = Path.Combine(UnityGame.UserDataPath, Plugin.Name, "OldProfiles"); if (File.Exists(path)) { RootConfig rootConfig = new RootConfig(path); if (!Directory.Exists(backupPath)) { Directory.CreateDirectory(backupPath); } File.Copy(path, Path.Combine(backupPath, $"{Plugin.Name}.ini"), true); File.Delete(path); } ConfigConverter.ProfileConverter(); SceneManager.activeSceneChanged += this.OnActiveSceneChanged; CameraUtilities.CreateMainDirectory(); CameraUtilities.CreateExampleScript(); ConfigConverter.DefaultConfigConverter(); }
public void SyncConfiguration() { if (this._cache != null) { Hashtable config = ConfigConverter.ToHashtable(this.CacheProps); this._cache.ConfigString = ConfigReader.ToPropertiesString(config); } }
public void updateUserConfig(string model) { ConfigModel user = JsonConvert.DeserializeObject <ConfigModel>(model); tbl_userConfig config = ConfigConverter.configModelToEntity(user); UserProvider provider = new UserProvider(); provider.updateUserConfig(config); }
private static void LoadConfig(string fileName, ref Hashtable properties) { ConfigurationBuilder builder = new ConfigurationBuilder(fileName); builder.RegisterRootConfigurationObject(typeof(Alachisoft.NCache.Config.NewDom.CacheServerConfig)); builder.ReadConfiguration(); Alachisoft.NCache.Config.NewDom.CacheServerConfig[] newCaches = new NewDom.CacheServerConfig[builder.Configuration.Length]; builder.Configuration.CopyTo(newCaches, 0); properties = ConfigConverter.ToHashtable(convertToOldDom(newCaches)); }
/// <summary> /// Get string props representation of config /// </summary> /// <param name="config"></param> /// <returns></returns> private static string GetProps(CacheServerConfig config) { ///[Ata] This is until we change the use of properties in Cache ///from props stirng or hashtable to Dom /// Hashtable table = ConfigConverter.ToHashtable(config); string props = ConfigReader.ToPropertiesString(table); return(props); }
private Config() { ConfigConverter <int> intConfig = new ConfigConverter <int>(); this.CheckFrequency = intConfig.GetValue("CheckFrequency", 30); this.RepeatMessageInterval = intConfig.GetValue("RepeatMessageInterval", 60); ConfigConverter <bool> boolConfig = new ConfigConverter <bool>(); this.LoggingVerbose = boolConfig.GetValue("Logging.Verbose", false); this.CheckOnStartup = boolConfig.GetValue("CheckOnStartUp", true); this.ZeroBytesIsFailure = boolConfig.GetValue("ZeroBytesIsFailure", true); this.SendStartupMessage = boolConfig.GetValue("Startup.SendMessage", true); if ((this.SendStartupMessage) && (String.IsNullOrEmpty(ConfigurationManager.AppSettings["Startup.MessageRecipients"]))) { throw new ApplicationException("Startup.MessageRecipients key must be added to app.config if Startup.SendMessage is true"); } this.mStartupRecipientAddresses = ConfigurationManager.AppSettings["Startup.MessageRecipients"].Split(';'); this.NotificationStartTime = TimeSpan.Parse(ConfigurationManager.AppSettings["Notification.StartTime"]); this.NotificationEndTime = TimeSpan.Parse(ConfigurationManager.AppSettings["Notification.EndTime"]); CheckUniqueSiteNames(); }
/// <summary> /// Populates the object from specified configuration object. /// </summary> /// <param name="configuration"></param> /// <returns></returns> public static CacheConfig FromDom(CacheServerConfig config) { Hashtable props = ConfigConverter.ToHashtable(config); return(FromProperties(props)); }
internal void Init(string fileName) { try { List <string> schemeNames = new List <string>(); foreach (IMControlScheme controlScheme in this.ParentWindow.SelectedConfig.ControlSchemes) { schemeNames.Add(controlScheme.Name); } this.mSchemesStackPanel.Children.Clear(); JObject jobject1 = JObject.Parse(File.ReadAllText(fileName)); int? configVersion = ConfigConverter.GetConfigVersion(jobject1); int num1 = 14; IMConfig deserializedImConfigObject; if (configVersion.GetValueOrDefault() < num1 & configVersion.HasValue) { JObject jobject2 = ConfigConverter.Convert(jobject1, "14", false, true); JsonSerializerSettings serializerSettings = Utils.GetSerializerSettings(); serializerSettings.Formatting = Formatting.Indented; JsonSerializerSettings settings = serializerSettings; deserializedImConfigObject = KMManager.GetDeserializedIMConfigObject(JsonConvert.SerializeObject((object)jobject2, settings), false); } else { configVersion = ConfigConverter.GetConfigVersion(jobject1); int num2 = 16; if (configVersion.GetValueOrDefault() < num2 & configVersion.HasValue && Utils.CheckIfImagesArrayPresentInCfg(jobject1)) { JObject jobject2 = jobject1; foreach (JObject scheme in (IEnumerable <JToken>)jobject1["ControlSchemes"]) { scheme["Images"] = (JToken)ConfigConverter.ConvertImagesArrayForPV16(scheme); } jobject2["MetaData"][(object)"Comment"] = (JToken)string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Generated automatically from ver {0}", (object)(int)jobject2["MetaData"][(object)"ParserVersion"]); jobject2["MetaData"][(object)"ParserVersion"] = (JToken)16; JsonSerializerSettings serializerSettings = Utils.GetSerializerSettings(); serializerSettings.Formatting = Formatting.Indented; deserializedImConfigObject = KMManager.GetDeserializedIMConfigObject(JsonConvert.SerializeObject((object)jobject2, serializerSettings), false); } else { deserializedImConfigObject = KMManager.GetDeserializedIMConfigObject(fileName, true); } } this.mStringsToImport = deserializedImConfigObject.Strings; this.mNumberOfSchemesSelectedForImport = 0; deserializedImConfigObject.ControlSchemes.Where <IMControlScheme>((Func <IMControlScheme, bool>)(scheme => scheme.BuiltIn)).ToList <IMControlScheme>().ForEach((System.Action <IMControlScheme>)(scheme => AddSchemeToImportCheckbox(scheme))); deserializedImConfigObject.ControlSchemes.Where <IMControlScheme>((Func <IMControlScheme, bool>)(scheme => !scheme.BuiltIn)).ToList <IMControlScheme>().ForEach((System.Action <IMControlScheme>)(scheme => { if (this.dict.Keys.Contains <string>(scheme.Name.ToLower(CultureInfo.InvariantCulture).Trim())) { scheme.Name += " (Edited)"; scheme.Name = KMManager.GetUniqueName(scheme.Name, (IEnumerable <string>)schemeNames); } AddSchemeToImportCheckbox(scheme); })); void AddSchemeToImportCheckbox(IMControlScheme scheme) { this.dict.Add(scheme.Name.ToLower(CultureInfo.InvariantCulture).Trim(), scheme); ImportSchemesWindowControl schemesWindowControl1 = new ImportSchemesWindowControl(this, this.ParentWindow); schemesWindowControl1.Width = this.mSchemesStackPanel.Width; ImportSchemesWindowControl schemesWindowControl2 = schemesWindowControl1; schemesWindowControl2.mContent.Content = (object)scheme.Name; schemesWindowControl2.Margin = new Thickness(0.0, 1.0, 0.0, 1.0); foreach (string key in this.ParentWindow.SelectedConfig.ControlSchemesDict.Keys) { if (string.Equals(key.Trim(), schemesWindowControl2.mContent.Content.ToString().Trim(), StringComparison.InvariantCultureIgnoreCase)) { schemesWindowControl2.mBlock.Visibility = Visibility.Visible; schemesWindowControl2.mImportName.Text = KMManager.GetUniqueName(schemesWindowControl2.mContent.Content.ToString().Trim(), (IEnumerable <string>)schemeNames); break; } } this.mSchemesStackPanel.Children.Add((UIElement)schemesWindowControl2); } } catch (Exception ex) { Logger.Error("Error in import window init err: " + ex.ToString()); } }