/// <summary> /// Get Config from the CEngineConfig file through key /// </summary> public static string GetConfig(string key, bool showLog = true) { EnsureConfigTab(); var conf = ConfigsTable.FindByPrimaryKey(key); if (conf == null) { if (showLog) { Logger.LogError("Cannot get CosmosConfig: {0}", key); } return(null); } return(conf["Value"] as string); }
public static void SetConfig(string key, string value) { EnsureConfigTab(); if (!Application.isEditor) { Logger.LogError("Set Config is Editor only"); return; } var item = ConfigsTable.FindByPrimaryKey(key); var writer = new TabFileWriter(ConfigsTable); var row = writer.GetRow(item.RowNumber); var rowInfo = KEngineInfo.Wrap(row); rowInfo.Value = value; writer.Save(ConfigFilePath); }
/// <summary> /// Check whetehr exist a config key /// </summary> /// <param name="key"></param> /// <returns></returns> public static bool HasConfig(string key) { return(ConfigsTable.HasPrimaryKey(key)); }