public static ConfigSet getAppConfig() { string appconfigPath = AppDomain.CurrentDomain.BaseDirectory + "config\\app.set"; ConfigSet config = XmlClassHelper.LoadXML2Class <ConfigSet>(appconfigPath); return(config); }
public static bool ReadConfig() { string configJson = string.Empty; try { configJson = File.ReadAllText(ConfigPath); if (!string.IsNullOrEmpty(configJson)) { ConfigSet config = JsonHelper.DeserializeJsonToObject <ConfigSet>(configJson); Config.Domain = config.Domain; Config.SpanTime = config.SpanTime; Config.AccessKeyId = config.AccessKeyId; Config.AccessKeySecret = config.AccessKeySecret; Config.StartDdhsWithProgram = config.StartDdhsWithProgram; Config.StartWithSystem = config.StartWithSystem; return(true); } else { return(false); } } catch { return(false); } }
internal void execute(int messageId, object[] args, Action <int> action) { ConfigSet <int, MsgData> configSet = Coo.configManager.GetConfig <int, MsgData>(); MsgData config = configSet[messageId]; if (config == null) { Debug.LogError("[SysmsgManager] 系统消息没有找到对应ID配置 messageId=" + messageId); } /** 滚屏 */ if (config.Type == 0) { Coo.menuManager.OpenMenu(MenuType.MsgScroll, new MsgMenuData(config.Format(args))); } else if (config.Type == 1) { Coo.menuManager.OpenMenu(MenuType.MsgAlert, new MsgMenuData(config, config.Format(args), action)); } else if (config.Type == 2) { Coo.menuManager.OpenMenu(MenuType.MsgAlert, new MsgMenuData(config, config.Format(args), action)); } else if (config.Type == 3) { Coo.menuManager.OpenMenu(MenuType.MsgAlert, new MsgMenuData(config, config.Format(args), action)); } }
private void txt_value_CheckedChanged(object sender, EventArgs e) { ConfigSet appconfig = setXml.getAppConfig(); appconfig.ConfigParList.Find((ConfigPar par) => par.Name == this._name).Value = this.txt_value.Checked.ToString(); setXml.saveAppConfig(appconfig); }
private static void LoadConfig() { var configfileTa = Resources.Load <TextAsset>(_configFile); Config = JsonConvert.DeserializeObject <ConfigSet>(configfileTa.text); _config.Cursor = (Texture2D)Resources.Load("cursor"); }
public void SetConfig <T>(string key, T value) { var prop = (from property in GetType().GetProperties() where property.Name == key || ((property.GetCustomAttributes(false).OfType <YamlMemberAttribute>().FirstOrDefault())?.Alias == key) select property).FirstOrDefault(); // I like to do it this way sometimes. Don't judge. prop.SetValue(this, value); ConfigSet?.Invoke(this, key); }
public async Task LoadAsync(ConfiguratorPaths paths, CancellationToken token) { Current = await LoadConfigurationAsync(paths); _currentWatcher = Watch(paths.WorkspacePath, async() => { OnConfigurationChanged?.Invoke(this, new ConfigurationChangedArgs(await LoadConfigurationAsync(paths))); }); }
private void buttonConfigDelete_Click(object sender, EventArgs e) { RadListDataItem ldi = comboBoxTileConfig.SelectedItem; if (ldi != null) { ConfigSet cs = new ConfigSet((int)ldi.Value, ""); NetworkFunction.DeleteConfigSet(cs); } }
public bool ConfigSet(string configKey, string configValue) { ConfigSet operation = new ConfigSet(); operation.Key = configKey; operation.Value = configValue; ODocument document = _connection.ExecuteOperation(operation); return(document.GetField <bool>("IsCreated")); }
private void setAppShow() { ConfigSet config = setXml.getAppConfig(); foreach (ConfigPar par in config.ConfigParList) { showSet show = new showSet(); show.setValue(par); this.flowLayoutPanel1.Controls.Add(show); } }
private void buttonConfigNew_Click(object sender, EventArgs e) { string sConfigSetName = ""; this.InputBox("Create New Config Set", "Please enter the name of the new config set:", ref sConfigSetName); if (sConfigSetName.Length > 0) { ConfigSet cs = new ConfigSet(0, sConfigSetName); NetworkFunction.AddConfigSet(cs); } }
private void ShowConfigSet() { ConfigSet levelSet = (ConfigSet)EditorWindow.GetWindow(typeof(ConfigSet)); if (levelSet != null) { CellWars_Editor.crt_item = null; levelSet.Close(); } ConfigWnd.InstanceShow(); }
public ActionResult Delete(string name, string system, ConfigSet model) { var cs = reader.GetConfigSet(name, system); if (!cs.UserHasAccessTo()) { throw new UnauthorizedAccessException("Access denied to configset"); } ViewBag.Id = cs.Id; reader.DeleteConfigSet(cs); return(RedirectToAction("Index", "Home")); }
private void InitList() { int dataCount = CellWars_Editor.crt_config.GetDataCount(); EditorGUILayout.LabelField("data.Count:" + dataCount); scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(instance.minSize.x - 10), GUILayout.Height(instance.minSize.y - 40)); int groupIndex = 0; for (int i = 0; i < dataCount; i++) { if (groupIndex == 0) { EditorGUILayout.BeginHorizontal(); } groupIndex++; config_item_base item = CellWars_Editor.crt_config.GetItemAt(i); string itemName = " " + item.id; if (CellWars_Editor.crt_config.name == "config_cell") { config_cell_item config_cell_item = (config_cell_item)item; itemName = (int)config_cell_item.cell_type + " " + item.id; } if (CellWars_Editor.crt_config.name == "config_monster") { config_monster_item config_monster_item = (config_monster_item)item; itemName = (int)config_monster_item.monster_type + " " + item.id; } if (GUILayout.Button(itemName, GUILayout.Width(80))) { ConfigSet levelSet = (ConfigSet)EditorWindow.GetWindow(typeof(ConfigSet)); if (levelSet != null) { levelSet.Close(); } ConfigSet.InstanceShow(item.id); } if (groupIndex == 10) { groupIndex = 0; EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(" "); EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndScrollView(); }
private void radButtonConfigModify_Click(object sender, EventArgs e) { RadListDataItem ldi = comboBoxTileConfig.SelectedItem; if (ldi != null) { string sConfigSetName = ldi.Text; this.InputBox("Modify Config Set", "Please enter the new name of the config set:", ref sConfigSetName); ConfigSet cs = new ConfigSet((int)ldi.Value, sConfigSetName); NetworkFunction.ModifyConfigSet(cs); } }
private void XmlSave(string csName) { ConfigSet cs = config[csName]; if (cs == null) { cs = new ConfigSet(); } cs.Pattern = this.txtPattern.Text; cs.Text = this.txtText.Text; cs.Name = csName; XmlUtils.SerializeObject(config, XML_FILE_NAME); }
internal ThreadIsolationCommand(string instanceKey, string commandKey, string groupKey, string domain, Action <ICommandConfigSet> config, bool hasFallback) : base(instanceKey, commandKey, groupKey, domain, config) { if (hasFallback || HasFallback) { FallbackExecutionSemaphore = FallbackExecutionSemaphores.GetOrAdd(Key, key => new IsolationSemaphore(ConfigSet.FallbackMaxConcurrentCount)); } ConfigSet.SubcribeConfigChangeEvent((cf) => { this.UpdateMaxConcurrentCount(cf.CommandMaxConcurrentCount); this.UpdateCommandTimeoutInMilliseconds(cf.CommandTimeoutInMilliseconds); }); }
private void button1_Click(object sender, EventArgs e) { try { ConfigSet cs = new ConfigSet("Resources/Configure.ini", true); cs.SetConfigValue("Timing", txtTiming.Text.ToString()); cs.WriteConfigToFile(ConfigFile.newFile); MessageBox.Show("修改配置文件成功"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// initializing local config static public void Initialize(int mask) { if (Local == null && ((mask & 1) != 0)) { Local = new ConfigSet(); Local.Load(); } if (Remote == null && ((mask & 2) != 0)) { Remote = new RemoteConfig(); Remote.Load(); } }
public ConfigSet GetConfigSet(string configSetName) { if (this.ContainsKey(configSetName)) { return(this[configSetName] as ConfigSet); } else { ConfigSet returnValue = this.Add(configSetName, new ConfigSet(this.Instance)) as ConfigSet; this.Instance.SetUserData(); this.Instance.EnableHup(); return(returnValue); } }
private void Load() { if (_loaded) { return; } _loaded = true; Debug.Log("Formula.Load"); luaManager = Coo.luaManager; ConfigSet <int, FormulaConfig> configSet = Coo.configManager.GetConfig <int, FormulaConfig>(); configSet.Each(DoScript); }
public ActionResult Details(string name, string system, ConfigSet model) { var cs = reader.GetConfigSet(name, system); if (!cs.UserHasAccessTo()) { throw new UnauthorizedAccessException("Access denied to configset"); } cs.Description = model.Description; cs.LayerNames = model.LayerNames; reader.UpdateConfigSet(cs); ViewBag.Id = cs.Id; return(View(cs)); }
public static bool SaveConfig() { ConfigSet set = new ConfigSet() { Domain = Domain, SpanTime = SpanTime, AccessKeyId = AccessKeyId, AccessKeySecret = AccessKeySecret, StartDdhsWithProgram = StartDdhsWithProgram, StartWithSystem = StartWithSystem }; string jsonConfig = JsonHelper.SerializeObject(set); return(WriteFile(jsonConfig)); }
private void button1_Click(object sender, EventArgs e) { try { ConfigSet cs = new ConfigSet("Resources/Configure.ini", true); //http://wl.bkse.cn/Device/DeviceDataInput cs.SetConfigValue("Url", txtUrlConfig.Text.ToString()); cs.WriteConfigToFile(ConfigFile.newFile); MessageBox.Show("修改配置文件成功"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadTheClassInstance() { string Data = File.ReadAllText(ConfigPath); ConfigSet LoadedData = JsonUtility.FromJson <ConfigSet>(Data); foreach (var Preset in LoadedData.Presets) { MonoBehaviour.print("Se ha cargado el preset ---> " + Preset.PresetName); foreach (var Folder in Preset.FolderConfigs) { MonoBehaviour.print("--> Se ha cargado la carpeta: " + Folder.Name); } } ProjectConfig.Configurations = LoadedData; }
public ShowConfig(ConfigSet c) { InitializeComponent(); cs = c; var sb = new StringBuilder(); sb.AppendLine("Valid configuration file found: " + cs.FileExists.ToString()); sb.AppendLine("Sync to monitoring server enabled: " + cs.Syncs.ToString()); sb.AppendLine("Monitoring server URL: " + cs.ServerUrl); sb.AppendLine("Update frequency: " + cs.UpdateInterval.ToString()); sb.AppendLine("Upper threshold: " + cs.UpperThreshold + " celcius"); sb.AppendLine("Critical threshold: " + cs.CriticalThreshold + " celcius"); textBox1.Text = sb.ToString(); }
private void DeleteConfigSetList(ConnectionInfo connectionInfo, ConfigSet configSet) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTileconfigset vcs = m.VRTileconfigsets.Where(x => x.ID == configSet.ID).FirstOrDefault(); if (vcs != null) { vcs.IsDeleted = true; m.SaveChanges(); //m.Cache.Release(m.VRTileconfigsets); } } GetConfigSetList(connectionInfo); }
/// <summary> /// Sets a given config. /// </summary> /// <typeparam name="T">The config's type-</typeparam> /// <param name="key">The config's key.</param> /// <param name="value">The new value of the config.</param> public void SetConfig <T>(string key, T value) { if (HasKey(key)) { cfgHashMap.TryGetValue(key, out var curValue); if (!(curValue is T)) { throw new InvalidDataException($"Cannot convert { typeof(T).Name } to { curValue.GetType().Name }!"); } cfgHashMap.Remove(key); } cfgHashMap.Add(key, value); ConfigSet?.Invoke(this, key); }
private void AddConfigSetList(ConnectionInfo connectionInfo, ConfigSet configSet) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTileconfigset vcs = new VRTileconfigset() { Name = configSet.Name, IsDeleted = false }; m.Add(vcs); m.SaveChanges(); //m.Cache.Release(m.VRTileconfigsets); } GetConfigSetList(connectionInfo); }
public static string Get(string key) { #if UNITY_EDITOR if (!Application.isPlaying) { return(key); } #endif if (configSet == null) { configSet = Coo.configManager.GetConfig <string, LocalizationConfig>(); } LocalizationConfig config = configSet[key]; if (config != null) { return(config.content); } return(key); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); ConfigSet ds = new ConfigSet(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "IpAccessListDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { ConfigSet ds = new ConfigSet(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }