public static void Execute() { if (!_initialized) { var file = IsAzureFunction(); var cfg = CfgManager.GetCfg(); if (CfgManager.CheckCfg(cfg, out string erroMsg)) { using (Deserializer deseralizer = new Deserializer()) { deseralizer.Execute(file); var kiroku_cfg = deseralizer.GetTag("sensor"); SensorManager.Initialize(kiroku_cfg); KManager.Configure(true); _initialized = true; } } else { throw new Exception(erroMsg); } } }
public static void Execute() { if (!_initialized) { var cfg = CfgManager.GetCfg(); if (CfgManager.CheckCfg(cfg, out string errorMsg)) { using (Deserializer deserilaizer = new Deserializer()) { var _file = @"D:\home\data\app\cfg\Config.ini"; //var _file = Directory.GetCurrentDirectory() + @"\Config.ini"; deserilaizer.Execute(_file); var plyqor_cfg = ConvertToDictionary(deserilaizer.GetTag("plyqor")); Dictionary <string, Dictionary <string, string> > cfgDictionary = new Dictionary <string, Dictionary <string, string> >(); cfgDictionary.Add("PlyQor", plyqor_cfg); PlyQorManager.Initialize(cfgDictionary); _initialized = true; } } } }
public static void Execute() { if (!_initialized) { var cfg = CfgManager.GetCfg(); if (CfgManager.CheckCfg(cfg, out string errorMsg)) { using (Deserializer deserilaizer = new Deserializer()) { var _file = @"D:\home\data\app\cfg\Config.ini"; deserilaizer.Execute(_file); var worker_cfg = ConvertToDictionary(deserilaizer.GetTag("worker")); Dictionary <string, Dictionary <string, string> > cfgDictionary = new Dictionary <string, Dictionary <string, string> >(); cfgDictionary.Add("Worker", worker_cfg); Configuration.Load(cfgDictionary); _initialized = true; } } } }
/// <summary> /// Extract configs from local machine. /// </summary> /// <returns></returns> private static bool GetAppConfigs() { var cfg = CfgManager.GetCfg(); if (CfgManager.CheckCfg(cfg, out string errorMsg)) { using (Deserializer deserilaizer = new Deserializer()) { var _file = @"D:\home\data\app\cfg\Config.ini"; deserilaizer.Execute(_file); _kqueryAppCfg = deserilaizer.GetTag("kquery"); _kqueryKLogCfg = deserilaizer.GetTag("kiroku_kquery"); _kcopyAppCfg = deserilaizer.GetTag("kcopy"); _kcopyKLogCfg = deserilaizer.GetTag("kiroku_kcopy"); _kloadAppCfg = deserilaizer.GetTag("kload"); _kloadKLogCfg = deserilaizer.GetTag("kiroku_kload"); } return(true); } else { _errorMsg = errorMsg; } return(false); }
public static void Execute() { if (!_initialized) { var file = IsAzureFunction(); var cfg = CfgManager.GetCfg(); if (CfgManager.CheckCfg(cfg, out string erroMsg)) { using (Deserializer deseralizer = new Deserializer()) { deseralizer.Execute(file); var kiroku_cfg = ConvertToDictionary(deseralizer.GetTag("kiroku-processor")); Configuration.Load(kiroku_cfg); _initialized = true; } SetupAppliances(); } } }
private void astCfgButton_Click(object sender, RoutedEventArgs e) { if (!good) { return; } try { AstManager.GetInstance().GenerateStructures(parsed, pkb); addLog("AST Create: Ok"); } catch (Exception ex) { addLog("AST Create: " + ex.GetType().Name + ": " + ex); good = false; return; } try { CfgManager.GetInstance().GenerateStructure(parsed, pkb); addLog("CFG Create: Ok"); } catch (Exception ex) { addLog("CFG Create: " + ex.GetType().Name + ": " + ex); good = false; return; } good = true; }
//Metoda odpowiada za ustawianie wartosci parametrów konfiguracji public static void SetValue <T>(Session session, string name, T value, AttributeType type) { using (var t = session.Logout(true)) { var cfgManager = new CfgManager(session); //wyszukiwanie gałęzi głównej var node1 = cfgManager.Root.FindSubNode("Soneta.Examples", false) ?? cfgManager.Root.AddNode("Soneta.Examples", CfgNodeType.Node); //wyszukiwanie liścia var node2 = node1.FindSubNode("Kursy Walut NBP", false) ?? node1.AddNode("Kursy Walut NBP", CfgNodeType.Leaf); //wyszukiwanie wartosci atrybutu w liściu var attr = node2.FindAttribute(name, false); if (attr == null) { node2.AddAttribute(name, type, value); } else { attr.Value = value; } t.CommitUI(); } }
// 更新检查完成 void OnDownloadFinish() { UpdateManager.Instance.UpdateVersion(); AssetBundleManager.InitDependenceInfo(); ResourceManager.Instance.Init(); LanguageManager.GetInstance().Init(); CfgManager.GetInstance().Init(); // 初始化lua engine LuaFileUtils loader = new LuaResLoader(); loader.beZip = GameConfig.EnableUpdate; // 是否读取assetbundle lua文件 Dictionary <string, string> localfiles = UpdateManager.Instance.LocalFiles; foreach (string file in localfiles.Keys) { if (file.Substring(0, 3) == "lua") { AssetBundle assetBundle = AssetBundleManager.GetAssetBundle(file); string name = Path.GetFileNameWithoutExtension(file); LuaFileUtils.Instance.AddSearchBundle(name, assetBundle); } } // LuaManager luaManager = LuaManager.Instance; luaManager.InitStart(); luaManager.DoFile("Game"); Util.CallMethod("Game", "OnInitOK"); }
//Metoda odpowiada za pobieranie wartosci parametrów konfiguracji public static T GetValue <T>(Session session, string name, T def) { var cfgManager = new CfgManager(session); var node1 = cfgManager.Root.FindSubNode("Soneta.Examples", false); //Jeśli nie znaleziono gałęzi, zwracamy wartosć domyślną if (node1 == null) { return(def); } var node2 = node1.FindSubNode("Kursy Walut NBP", false); if (node2 == null) { return(def); } var attr = node2.FindAttribute(name, false); if (attr == null) { return(def); } if (attr.Value == null) { return(def); } return((T)attr.Value); }
/// <summary> /// Read local master config, extracting configs for each application into backing fields. /// </summary> private static bool GetAppConfigs() { var cfg = CfgManager.GetCfg(); if (CfgManager.CheckCfg(cfg, out string errorMsg)) { using (Deserializer deserilaizer = new Deserializer()) { var _file = @"D:\home\data\app\cfg\Config.ini"; deserilaizer.Execute(_file); // TODO: *** *** _exampleAppCfg = deserilaizer.GetTag("example"); _exampleKLogCfg = deserilaizer.GetTag("kiroku_example"); // Add additional config requests as required. //_example2AppCfg = deserilaizer.GetTag("example2"); //_example2KLogCfg = deserilaizer.GetTag("kiroku_example2"); } return(true); } else { // TODO: add logging } return(false); }
public Skill(int id) { if (CfgManager.GetInstance().Skills.ContainsKey(id) == false) { Debug.LogErrorFormat("skill cfg not found: {0}", id); return; } CfgSkill cfg = CfgManager.GetInstance().Skills[id]; this.id = cfg.id; name = cfg.name; desc = cfg.desc; animation = cfg.animation; sound = cfg.sound; hiteffect = cfg.hiteffect; hitpoints = cfg.hitpoints; targettype = cfg.targettype; aoe = cfg.aoe; spcost = cfg.spcost; colddown = cfg.colddown; // skill effects int count = cfg.skilleffects.Length; if (count > 0) { skilleffects = new SkillEffect[count]; for (int i = 0; i < count; i++) { skilleffects[i] = SkillEffect.CreateSkillEffect(cfg.skilleffects[i], this); } } }
private void ClearAll() { ModelGroupDict.Clear(); CfgManager.Clear(); _clipboard.Clear(); _modelDict.Clear(); }
/// <summary> /// Restore configuration data from backup using all available contexts. /// </summary> protected void backupRestore() { if (CfgManager.IsExistCfg(ContextType.Solution)) { backupRestore(ContextType.Solution); } backupRestore(ContextType.Common); }
/// <summary> /// Updating of deep copies from configuration data using all available contexts. /// </summary> protected void backupUpdate() { backupUpdate(ContextType.Common); if (CfgManager.IsExistCfg(ContextType.Solution)) { backupUpdate(ContextType.Solution); } }
public static Skill CreateSkill(int id) { if (CfgManager.GetInstance().Skills.ContainsKey(id)) { return(new Skill(id)); } return(null); }
public static SkillEffect CreateSkillEffect(int id, Skill skill) { if (CfgManager.GetInstance().SkillEffects.ContainsKey(id)) { return(new SkillEffect(id, skill)); } return(null); }
public static CfgManager GetInstance() { if (_instance == null) { _instance = new CfgManager(); } return(_instance); }
public static Buff CreateBuff(int id) { if (CfgManager.GetInstance().Buffs.ContainsKey(id)) { return(new Buff(id)); } return(null); }
public void CfgMgr_Null_CfgSysType() { string path = Path.Combine(localFolder, file_txt_1); configManager = new CfgManager(path, typeof(NullConfigSystem)); configManager.ReadConfig(); Assert.AreEqual(0, configManager.GetDictionary().Count, "Dictionary Size should be 0"); }
public void SavePrefToManager(CfgManager mgr) { this.Log().Info("Trying to set the values of the preferences in the configuration manager"); mgr.SetValue(prefPrefix + "_format", ((int)format).ToString()); mgr.SetValue(prefPrefix + "_width", width.ToString()); mgr.SetValue(prefPrefix + "_height", height.ToString()); mgr.SetValue(prefPrefix + "_proportion", keepProportion.ToString()); }
public void CanLoadMultipleFilesForEnvironment() { var file1 = Util.GetEmbeddedResourceText("CfgDotNet.Test.good-cfg.json"); const string file2 = @"{""activeEnvironment"":""dev""}"; var cfg = new CfgManager(null, file1, file2); Assert.AreEqual("dev", cfg.ActiveEnvironmentName); }
public void CfgMgr_Xml_Read_Empty() { string path = Path.Combine(localFolder, file_1_empty); XmlConfigSystem cfgsys = new XmlConfigSystem(); configManager = new CfgManager(path, cfgsys); configManager.ReadConfig(); Assert.AreEqual(0, configManager.GetDictionary().Count, "Dictionary should be empty"); }
public SkillEffect(int id, Skill skill) { if (CfgManager.GetInstance().SkillEffects.ContainsKey(id) == false) { Debug.LogErrorFormat("SkillEffect cfg not found: {0}", id); return; } ownSkill = skill; cfg = CfgManager.GetInstance().SkillEffects[id]; }
public void CfgMgr_Ini_Read_NotExist() { string path = Path.Combine(localFolder, file_ini_1_notExist); IniConfigSystem cfgsys = new IniConfigSystem(); configManager = new CfgManager(path, cfgsys); configManager.ReadConfig(); Assert.AreEqual(0, configManager.GetDictionary().Count, "Dictionary should be empty"); }
public void LoadAll() { ClearAll(); _config = ActorConfig.Instance; CfgManager.ConfigDir = ConfigDir; CfgManager.LoadAll(); //--初始化资源路径 EUtil.GetAssetsInSubFolderRecursively(_config.CharacterRelativeDir, "*.prefab", ref AllCharacters); EUtil.GetAssetsInSubFolderRecursively(_config.AvatarRelativeDir, "*.prefab", ref AllAvatars); EUtil.GetAssetsInSubFolderRecursively(_config.EffectRelativeDir, "*.prefab", ref AllEffects); foreach (var item in AllCharacters) { string searchDir = item.Value.Substring(0, item.Value.LastIndexOf(@"/prefab")) + "/clips"; var selfClips = new Dictionary <string, string>(); EUtil.GetAssetsInSubFolderRecursively(searchDir, "*.anim", ref selfClips); AllCharacterClips[item.Key] = selfClips; } //--加载行为配置 foreach (var model in CfgManager.Model) { var modelName = model.Key; string path = string.Format("{0}/{1}.xml", ActionConfigPath, modelName); if (!File.Exists(path)) { var config = new XmlCfg.Skill.ActorConfig() { ModelName = modelName }; string savePath = string.Format("{0}/{1}.xml", ActorConfig.Instance.ActionConfigPath, modelName); var actor = new ActorEditor(savePath, config); actor.Save(true); Debug.LogFormat("<color=orange>新建Actor - {0}</color>", modelName); } } string[] files = Directory.GetFiles(ActionConfigPath, "*.xml", SearchOption.TopDirectoryOnly); foreach (var path in files) { var actor = new ActorEditor(path); AddActor(actor); } foreach (var item in _modelDict) { item.Value.InitBaseModelAction(); } var window = ActorEditorWindow.GetWindow <ActorEditorWindow>(); window.RefreshTree(); IsInit = true; Debug.Log("加载所有动作 完毕!"); }
public Enemy SpawnEnemy(int id, Vector3 pos, Quaternion rot) { if (CfgManager.GetInstance().Monsters.ContainsKey(id)) { string prefab = CfgManager.GetInstance().Monsters [id].prefab; Enemy enemy = CharacterManager.Instance.AddEnemy(prefab, pos, rot); CallMethod("enemy_spawn", enemy); return(enemy); } return(null); }
public void CanLoadMultipleFilesForCustomSections() { var file1 = Util.GetEmbeddedResourceText("CfgDotNet.Test.good-cfg.json"); const string file2 = @"{""environments"":{""prod"":{""elasticsearch"":{""user"":""elastic-user-test""}}}}"; var cfg = new CfgManager(null, file1, file2); var settings = new ElasticsearchSettings(); var user = cfg.GetConfigSection("elasticsearch", settings).User; Assert.AreEqual("elastic-user-test", user); }
public void CfgMgr_Xml_Write() { string path = Path.Combine(localFolder, file_xml_1_out); XmlConfigSystem cfgsys = new XmlConfigSystem(); configManager = new CfgManager(path, cfgsys); configManager.SetDictionary(dicoXml); configManager.WriteConfig(); Assert.IsTrue(XmlFileCompare(Path.Combine(localFolder, file_xml_1_out), Path.Combine(localFolder, file_xml_1)), "Files are not the same"); }
public void LoadPrefsFromManager(CfgManager mgr) { this.Log().Debug("Loading a preference set using the manager"); string input; int output; input = mgr.GetValue(prefPrefix + "_format"); if (input != "") { Int32.TryParse(input, out output); format = (prefFormat)output; } else { format = prefFormat.Bmp; } input = mgr.GetValue(prefPrefix + "_width"); if (input != "") { Int32.TryParse(input, out output); width = output; } else { width = 1024; } input = mgr.GetValue(prefPrefix + "_height"); if (input != "") { Int32.TryParse(input, out output); height = output; } else { height = 1024; } bool outputBool; input = mgr.GetValue(prefPrefix + "_proportion"); if (input != "") { bool.TryParse(input, out outputBool); keepProportion = outputBool; } else { keepProportion = true; } }
private void ClearAll() { IsInit = false; _modelGroupDict.Clear(); CfgManager.Clear(); _clipboard.Clear(); _modelDict.Clear(); AllCharacters.Clear(); AllAvatars.Clear(); AllCharacterClips.Clear(); AllEffects.Clear(); Resources.UnloadUnusedAssets(); }
private void MainDialog_FormClosing(object sender, FormClosingEventArgs e) { m_StockConfigs.clear(); foreach (SmpStock stock in lst_Stocks) { if (stock.Checked) { m_StockConfigs.setProperty(stock.Code, stock.Name); } } m_StockConfigs.store(); CfgManager.MapExeConfiguration(); }
private void MainDialog_Load(object sender, EventArgs e) { DialogLogin loginDlg = new DialogLogin(); loginDlg.SettingConfigs = m_SettingConfigs; if (loginDlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) { Environment.Exit(0); } this.Text = getCaption(loginDlg.apiSection.ApiElement.AppID); if (m_StockConfigs.load()) { foreach (KeyValuePair <string, string> kvce in m_StockConfigs.appConfigs) { SmpStock stock = new SmpStock(kvce.Key, kvce.Value); stock.Checked = true; lst_Stocks.Add(stock); } } if (m_NewsConfigs.load()) { foreach (KeyValuePair <string, string> kvce in m_NewsConfigs.appConfigs) { Links theNews = new Links(kvce.Key, kvce.Value); lst_News.Add(theNews); } } m_NewsPanel = new NewsPanel(lst_News); TabPage_News.Controls.Add(m_NewsPanel); m_StockPanel.InitData(lst_Stocks); m_UpdateTimer.Interval = 1000; m_UpdateTimer.Enabled = true; m_UpdateTimer.Tick += new EventHandler(UpdateTimer_Tick_EventHandler); m_UpdateTimer.Start(); m_SecondTimer.Interval = 1000; m_SecondTimer.Enabled = true; m_SecondTimer.Tick += new EventHandler(SecondTimer_Tick_EventHandler); m_SecondTimer.Start(); CfgManager.ReadConnectionStrings(); CfgManager.MapMachineConfiguration(); SNTPTime.calibrationTime(); m_HandleShowApi.BgWorkerCompleted += new EventHandler <BgWorkerEventArgs>(HandleShowApi_BgWorkerCompleted); }
public void CanLoadByPartialFilename() { var cfg = new CfgManager(null, @"good-cfg.json"); Assert.AreEqual("prod", cfg.ActiveEnvironmentName); }
public void SetUp() { var json = Util.GetEmbeddedResourceText("CfgDotNet.Test.good-cfg.json"); if (!Util.IsValidJson(json)) { throw new Exception("The good-cfg.json is not valid JSON"); } _cfgManagerProd = new CfgManager(null, json); }