private void initInfo(GTMProduct p, string currencyISO, string List = "", string productUrl = "") { List <GTMProduct> li = new List <GTMProduct> { p }; Dictionary <string, object> configWrap = new Dictionary <string, object>(); Dictionary <string, object> ecomWrap = new Dictionary <string, object>(); Dictionary <string, object> actionWrap = new Dictionary <string, object>(); Dictionary <string, object> actionFieldWrap = new Dictionary <string, object>(); actionFieldWrap["list"] = List; actionWrap["actionField"] = actionFieldWrap; actionWrap["products"] = li.Select(i => i.Info).ToArray(); ecomWrap[_actionString] = actionWrap; ecomWrap["currencyCode"] = currencyISO; configWrap["event"] = _eventString; configWrap["ecommerce"] = ecomWrap; //Use below if callbacks are needed - however right now the thought is not to make the links dependant on gtm success. //Don't break navigation because gtm js fails - so let the non-js href work at risk of losing a gtm hit due to race conditions //if (!string.IsNullOrEmpty(productUrl)) //{ // var navFunctionFormat = "function() {{ document.location = {0};}}"; // var cb = string.Format(navFunctionFormat, productUrl); // configWrap["eventCallback"] = new JRaw(cb); //} _commerceConfig = new ConfigurationObject(configWrap); }
static void Main(string[] args) { string datasetDirectory = Directory.GetCurrentDirectory() + @"\DataSets\"; string word2vecDirectory = Directory.GetCurrentDirectory() + @"\Word2VecFiles\"; ConfigurationObject configuration = new ConfigurationObject() { ConnectionString = "name=SPG.DataAccess2", TagVenueFile = datasetDirectory + "tag-venue-dataset.txt", TipVenueFile = datasetDirectory + "tip-venue-dataset.txt", UserVenueFile = datasetDirectory + "user-venue-dataset.txt", PrefixFile = datasetDirectory + "prefix-dataset.txt", SuffixFile = datasetDirectory + "suffix-dataset.txt", TrainFile = word2vecDirectory + "source-word-2-vec-file.txt", OutputFile = word2vecDirectory + "vector.txt", VocabularyFile = word2vecDirectory + "vocub.txt" }; System.Console.WriteLine("Initialization started!"); DataContext dc = new DataContext(configuration.ConnectionString); DataContextInitializer dci = new DataContextInitializer(configuration); dci.InitializeDatabase(dc); System.Console.WriteLine("Done!"); }
public void Dynamic() { var obj = (dynamic)ConfigurationObject.Create(JObject.Parse("{ \"*\": \"abc\" }")); Assert.AreEqual((string)obj.test, "abc"); Assert.AreEqual((string)obj["test"], "abc"); }
/// <summary> /// Called for redesign inspector fields /// </summary> public override void OnInspectorGUI() { base.OnInspectorGUI(); var reference = (InputManager)target; if (reference.HMUTransform == null) { reference.AutoSetHMU = EditorGUILayout.Toggle("Auto set HMU", reference.AutoSetHMU); if (!reference.AutoSetHMU) { EditorGUILayout.HelpBox(Globals.NO_HMU_SET_MSG, MessageType.Warning); } } if (reference.Configuration == null) { EditorGUILayout.HelpBox(Globals.NO_CONFIG_ASSET_MSG, MessageType.Error); if (GUILayout.Button("Create configuration")) { var config = new ConfigurationObject { }; AssetDatabase.CreateAsset(config, "Assets/Resources/StylusConfig2.asset"); reference.Configuration = config; } } }
public ConfigurationObjectViewModel(ConfigurationObject obj, bool isDefault) { IsDefault = isDefault; Name = obj.Name; Value = obj.Value; Description = obj.Description; }
public void NullableTest() { var obj = ConfigurationObject.Create(JObject.Parse("{ \"test1\": false }")); Assert.AreEqual((bool?)obj["test1"], false); Assert.AreEqual((bool?)obj["test2"], null); }
private void initInfo(GTMProduct p, string currencyISO, string List = "") { List <GTMProduct> li = new List <GTMProduct>(); if (p != null) { li.Add(p); } Dictionary <string, object> configWrap = new Dictionary <string, object>(); Dictionary <string, object> ecomWrap = new Dictionary <string, object>(); Dictionary <string, object> actionWrap = new Dictionary <string, object>(); Dictionary <string, object> actionFieldWrap = new Dictionary <string, object>(); actionFieldWrap["list"] = List; actionWrap["actionField"] = actionFieldWrap; actionWrap["products"] = li.Select(i => i.Info).ToArray(); ecomWrap[_actionString] = actionWrap; ecomWrap["currencyCode"] = currencyISO; configWrap["event"] = _eventString; configWrap["ecommerce"] = ecomWrap; _commerceConfig = new ConfigurationObject(configWrap); }
public T ConvertToType <T>(ConfigurationObject configurationObject) { if (configurationObject == null) { return(default(T)); } object returnValue = configurationObject.Value; string lowerTypeName = configurationObject.Type.ToLowerInvariant(); if (lowerTypeName == "boolean") { returnValue = configurationObject.Value == "1"; } if (lowerTypeName == "int") { returnValue = int.Parse(configurationObject.Value); } if (lowerTypeName == "double") { returnValue = double.Parse(configurationObject.Value); } return((T)returnValue); }
public override string RenderCommand() { var eventInfo = new Dictionary <string, object> { { "hitType", "event" }, { "eventCategory", _category }, { "eventAction", _action }, { "eventLabel", _label } }; if (_value.HasValue) { eventInfo.Add("eventValue", _value.Value); } if (_nonInteraction) { eventInfo.Add("nonInteraction", true); } if (_useBeacon) { eventInfo.Add("useBeacon", true); } var config = new ConfigurationObject(eventInfo); return(string.Format("ga('send', {0});", config.Render())); }
public MSManager() { WorldServers = new List <WorldServer>(); LoginServers = new List <IScsServiceClient>(); ConnectedAccounts = new ThreadSafeGenericList <AccountConnection>(); AuthentificatedClients = new List <long>(); ConfigurationObject = new ConfigurationObject { RateXP = int.Parse(ConfigurationManager.AppSettings["RateXp"]), RateHeroicXP = int.Parse(ConfigurationManager.AppSettings["RateHeroicXp"]), RateDrop = int.Parse(ConfigurationManager.AppSettings["RateDrop"]), MaxGold = long.Parse(ConfigurationManager.AppSettings["MaxGold"]), RateGoldDrop = int.Parse(ConfigurationManager.AppSettings["GoldRateDrop"]), RateGold = int.Parse(ConfigurationManager.AppSettings["RateGold"]), RateFairyXP = int.Parse(ConfigurationManager.AppSettings["RateFairyXp"]), MaxLevel = byte.Parse(ConfigurationManager.AppSettings["MaxLevel"]), MaxJobLevel = byte.Parse(ConfigurationManager.AppSettings["MaxJobLevel"]), MaxSPLevel = byte.Parse(ConfigurationManager.AppSettings["MaxSPLevel"]), MaxHeroLevel = byte.Parse(ConfigurationManager.AppSettings["MaxHeroLevel"]), HeroicStartLevel = byte.Parse(ConfigurationManager.AppSettings["HeroicStartLevel"]), MaxUpgrade = byte.Parse(ConfigurationManager.AppSettings["MaxUpgrade"]), SceneOnCreate = bool.Parse(ConfigurationManager.AppSettings["SceneOnCreate"]), SessionLimit = int.Parse(ConfigurationManager.AppSettings["SessionLimit"]), WorldInformation = bool.Parse(ConfigurationManager.AppSettings["WorldInformation"]), Act4IP = ConfigurationManager.AppSettings["Act4IP"], Act4Port = int.Parse(ConfigurationManager.AppSettings["Act4Port"]), MallBaseURL = ConfigurationManager.AppSettings["MallBaseURL"], MallAPIKey = ConfigurationManager.AppSettings["MallAPIKey"], UseChatLogService = bool.Parse(ConfigurationManager.AppSettings["UseChatLogService"]) }; }
public void InheritTest6() { { var obj = ConfigurationObject.Create(JObject.Parse("{ \"A\": { Test: \"test\" }, \"A.B.C\": { Test1: \"test\" } }")); Assert.AreEqual((string)obj["A.B.C"]["Test"], "test"); } }
/// <summary> /// Converts a given configuration object to a string. /// </summary> /// <param name="configurationObject">The configuration object to be converted.</param> /// <param name="cache">The cached converted constructed objects.</param> /// <returns>The string representation of the configuration object.</returns> private string ConfigurationObjectToString(ConfigurationObject configurationObject, Dictionary <ConstructedConfigurationObject, string> cache) { switch (configurationObject) { // If we have a loose object, simply check the dictionary case LooseConfigurationObject looseObject: return(_looseObjectsId[looseObject].ToString()); // If we have a constructed object... case ConstructedConfigurationObject constructedObject: // Then check the cache first if (cache.ContainsKey(constructedObject)) { return(cache[constructedObject]); } // If it's not there, we need to actually convert it by gluing the construction var result = $"{_constructionsId[constructedObject.Construction]}" + // And the joined arguments $"({constructedObject.PassedArguments.Select(argument => ArgumentToString(argument, cache)).ToJoinedString(",")})"; // Now we can cache it cache.Add(constructedObject, result); // And return it return(result); // Unhandled cases default: throw new ConfigurationGeneratorException($"Unhandled type of {nameof(ConfigurationObject)}: {configurationObject.GetType()}"); } }
public ConfigurationObject LoadConfigFile(string filename) { if (!File.Exists(filename)) { throw new Exception("Configuration File Not Found!"); } BinaryFormatter bf = new BinaryFormatter(); // -- loading data FileStream loadFile = File.Open(filename, FileMode.Open); ConfigurationObject loadedConfObject = bf.Deserialize(loadFile) as ConfigurationObject; loadFile.Close(); // -- printing out data to double check //for (int i = 0; i < loadedConfObject.spawners.Count; i++) //{ // SpawnerSaveObject loadedSO = loadedConfObject.spawners[i]; // print("Spawner " + i + ":"); // print(loadedSO.spawnRate); // print(loadedSO.position[0]); // print(loadedSO.position[1]); // print(loadedSO.enemyType); //} return(loadedConfObject); }
public ConfigurationObject CreateConfigurationObject() { ConfigurationObject result = new ConfigurationObject(); result.Name = ConfigurationObjectName; result.Value = ConfigurationObjectValue; return(result); }
private ConfigurationEntity Convert(ConfigurationObject obj) { ConfigurationEntity result = new ConfigurationEntity(); result.Value = obj.Value; result.Name = obj.Name; return(result); }
///Use 'name' from ConfigurationConstants! public ConfigurationObject ReadOrDefaultConfigurationObject(string name) { //var currentObject = _databaseAdapter.GetConfigurationObjectOld(name); var currentObject = _databaseAdapter.GetConfigurationObject(name); return(currentObject ?? ConfigurationObject.CreateConfiguration(name, ConfigurationConstants.GetDefault(name), ConfigurationConstants.GetDescription(name))); }
private ConfigurationObject GetModelFromViewModel(ConfigurationObjectViewModel viewModel) { ConfigurationObject result = new ConfigurationObject(); result.Value = viewModel.Value; result.Name = viewModel.Name; return(result); }
public override string RenderCommand() { var sb = new StringBuilder(); var pcfg = new ConfigurationObject(_product.Info); sb.AppendFormat("ga('ec:addProduct', {0});", pcfg.Render()); sb.AppendLine(); sb.AppendLine("ga('ec:setAction', 'detail');"); return sb.ToString(); }
public MSManager() { WorldServers = new List <WorldServer>(); LoginServers = new List <IScsServiceClient>(); ConnectedAccounts = new ThreadSafeGenericList <AccountConnection>(); AuthentificatedClients = new ThreadSafeGenericLockedList <long>(); ConfigurationObject = new ConfigurationObject { RateXP = int.Parse(ConfigurationManager.AppSettings["RateXp"]), RateHeroicXP = int.Parse(ConfigurationManager.AppSettings["RateHeroicXp"]), RateDrop = int.Parse(ConfigurationManager.AppSettings["RateDrop"]), MaxGold = long.Parse(ConfigurationManager.AppSettings["MaxGold"]), RateGoldDrop = int.Parse(ConfigurationManager.AppSettings["GoldRateDrop"]), RateGold = int.Parse(ConfigurationManager.AppSettings["RateGold"]), RateReputation = int.Parse(ConfigurationManager.AppSettings["RateReputation"]), RateFairyXP = int.Parse(ConfigurationManager.AppSettings["RateFairyXp"]), PartnerSpXp = long.Parse(ConfigurationManager.AppSettings["PartnerSpXp"]), MaxLevel = byte.Parse(ConfigurationManager.AppSettings["MaxLevel"]), MaxJobLevel = byte.Parse(ConfigurationManager.AppSettings["MaxJobLevel"]), MaxSPLevel = byte.Parse(ConfigurationManager.AppSettings["MaxSPLevel"]), MaxHeroLevel = byte.Parse(ConfigurationManager.AppSettings["MaxHeroLevel"]), HeroicStartLevel = byte.Parse(ConfigurationManager.AppSettings["HeroicStartLevel"]), MaxUpgrade = byte.Parse(ConfigurationManager.AppSettings["MaxUpgrade"]), SceneOnCreate = bool.Parse(ConfigurationManager.AppSettings["SceneOnCreate"]), SessionLimit = int.Parse(ConfigurationManager.AppSettings["SessionLimit"]), WorldInformation = bool.Parse(ConfigurationManager.AppSettings["WorldInformation"]), IsAntiCheatEnabled = bool.Parse(ConfigurationManager.AppSettings["IsAntiCheatEnabled"]), AntiCheatClientKey = ConfigurationManager.AppSettings["AntiCheatClientKey"], AntiCheatServerKey = ConfigurationManager.AppSettings["AntiCheatServerKey"], Act4IP = ConfigurationManager.AppSettings["Act4IP"], Act4Port = int.Parse(ConfigurationManager.AppSettings["Act4Port"]), MallBaseURL = ConfigurationManager.AppSettings["MallBaseURL"], MallAPIKey = ConfigurationManager.AppSettings["MallAPIKey"], UseLogService = bool.Parse(ConfigurationManager.AppSettings["UseLogService"]), QuestDropRate = int.Parse(ConfigurationManager.AppSettings["QuestDropRate"]), HalloweenEvent = bool.Parse(ConfigurationManager.AppSettings["HalloweenEvent"]), ChristmasEvent = bool.Parse(ConfigurationManager.AppSettings["ChristmasEvent"]), EasterEvent = bool.Parse(ConfigurationManager.AppSettings["EasterEvent"]), LockSystem = bool.Parse(ConfigurationManager.AppSettings["LockSystem"]), AutoLootEnable = bool.Parse(ConfigurationManager.AppSettings["AutoLootEnable"]), BCardsInArenaTalent = bool.Parse(ConfigurationManager.AppSettings["BCardsInArenaTalent"]), Act4Rate = int.Parse(ConfigurationManager.AppSettings["Act4Rate"]), SPJLvl = int.Parse(ConfigurationManager.AppSettings["SPJLvl"]), DoubleXP = bool.Parse(ConfigurationManager.AppSettings["DoubleXP"]), DoubleFairyXP = bool.Parse(ConfigurationManager.AppSettings["DoubleFairyXP"]), DoubleRaidBox = bool.Parse(ConfigurationManager.AppSettings["DoubleRaidBox"]), DoubleSpUp = bool.Parse(ConfigurationManager.AppSettings["DoubleSpUp"]), DoubleEqUp = bool.Parse(ConfigurationManager.AppSettings["DoubleEqUp"]), DoubleBet = bool.Parse(ConfigurationManager.AppSettings["DoubleBet"]), DoublePerfectionUp = bool.Parse(ConfigurationManager.AppSettings["DoublePerfectionUp"]), DoubleXPFamily = bool.Parse(ConfigurationManager.AppSettings["DoubleXPFamily"]), DoubleGold = bool.Parse(ConfigurationManager.AppSettings["DoubleGold"]), DoubleReput = bool.Parse(ConfigurationManager.AppSettings["DoubleReput"]), DoubleDrop = bool.Parse(ConfigurationManager.AppSettings["DoubleDrop"]), MultiEvent = bool.Parse(ConfigurationManager.AppSettings["MultiEvent"]) }; }
public override string RenderMessage(string dataLayerName) { var vals = new Dictionary <string, object> { { "event", _eventName } }; var obj = new ConfigurationObject(vals); return(Push(dataLayerName, obj)); }
public void Render_IntValue_RendersInt() { var subj = new ConfigurationObject(new Dictionary <string, object> { { "mykey", 1234 } }); var rendered = subj.Render(); Assert.That(rendered, Is.StringContaining("{'mykey': 1234}")); }
public override string RenderMessage() { var vals = new Dictionary <string, object> { { _name, _value } }; var obj = new ConfigurationObject(vals); return(Push(obj)); }
public void Render_StringValue_RendersEscapedString() { var subj = new ConfigurationObject(new Dictionary <string, object> { { "mykey", "my'val" } }); var rendered = subj.Render(); Assert.That(rendered, Is.StringContaining(@"{'mykey': 'my\u0027val'}")); }
public void AddConfigurationObject(string name, string value) { var config = new ConfigurationObject() { Name = name, Value = value }; //_databaseAdapter.WriteConfigurationObjectOld(config); _databaseAdapter.WriteConfigurationObject(config); }
/// <summary> /// Initializes a new instance of the <see cref="TheoremObject"/> class. /// </summary> /// <param name="configurationObject">The configuration object corresponding to this object.</param> protected BaseTheoremObject(ConfigurationObject configurationObject = null) { ConfigurationObject = configurationObject; // Make sure the object has the right type, if it's set if (ConfigurationObject != null && ConfigurationObject.ObjectType != Type) { throw new GeoGenException($"The {GetType()} should be defined by an object of type {Type}, but the type is {ConfigurationObject.ObjectType}."); } }
public override string RenderCommand() { var sb = new StringBuilder(); var pcfg = new ConfigurationObject(_product.Info); sb.AppendFormat("ga('ec:addProduct', {0});", pcfg.Render()); sb.AppendLine(); sb.AppendLine("ga('ec:setAction', 'detail');"); return(sb.ToString()); }
public override string RenderCommand() { var pageInfo = new Dictionary<string, object> { {"hitType", "pageview"}, {"page", _page}, {"title", _title} }; var config = new ConfigurationObject(pageInfo); return string.Format("ga('send', {0});", config.Render()); }
public void Render_ArrayValue_RendersArray() { var value = new[] { "val1", "val2" }; var subj = new ConfigurationObject(new Dictionary <string, object> { { "mykey", value } }); var rendered = subj.Render(); Assert.That(rendered, Is.StringContaining("{'mykey': ['val1','val2']}")); }
public void InheritGlobalTest() { { var obj = ConfigurationObject.Create(JObject.Parse("{ \"global-test\": 1, \"A\":{ \"test\": 2 } }")); Assert.AreEqual((int?)obj[".A"]["test"], 2); } { var obj = ConfigurationObject.Create(JObject.Parse("{ \"global-test\": 1, \"A\":{ \"test\": 2 } }")); Assert.AreEqual((int?)obj[".A"]["global-test"], 1); } }
public static void Init() { RT.load("arcadia/config"); RT.var("arcadia.config", "update!").invoke(); if (_clojureConfigurationObject == null) { _clojureConfigurationObject = ScriptableObject.CreateInstance <ConfigurationObject>(); } Selection.activeObject = _clojureConfigurationObject; }
public override string RenderCommand() { var pageInfo = new Dictionary <string, object> { { "hitType", "pageview" }, { "page", _page }, { "title", _title } }; var config = new ConfigurationObject(pageInfo); return(string.Format("ga('send', {0});", config.Render())); }
public ConfigurationApiModel ConvertConfiguration(ConfigurationObject configurationObject) { if (configurationObject == null) { return(null); } return(new ConfigurationApiModel { Key = configurationObject.Key, Value = configurationObject.Value }); }
public override string RenderCommand() { var sb = new StringBuilder(); var ccfg = new ConfigurationObject(_checkoutAction.Info); sb.AppendFormat("ga('ec:setAction', 'checkout_option', {0});", ccfg.Render()); sb.AppendLine(); if (_trackingEvent != null) sb.Append(_trackingEvent.RenderCommand()); return sb.ToString(); }
public override string RenderCommand() { var sb = new StringBuilder(); var lcfg = new ConfigurationObject(_product.Info); sb.AppendFormat("ga('ec:addProduct', {0});", lcfg.Render()); sb.AppendLine(); sb.AppendLine("ga('ec:setAction', 'add');"); if (_trackingEvent != null) sb.Append(_trackingEvent.RenderCommand()); return sb.ToString(); }
public override string RenderCommand() { var sb = new StringBuilder(); foreach (var impression in _impressions) { var icfg = new ConfigurationObject(impression.Info); sb.AppendFormat("ga('ec:addImpression', {0});", icfg.Render()); sb.AppendLine(); } if (_trackingEvent != null) sb.Append(_trackingEvent.RenderCommand()); return sb.ToString(); }
public override string RenderCommand() { var sb = new StringBuilder(); foreach (var lineItem in _lineItems) { var lcfg = new ConfigurationObject(lineItem.Info); sb.AppendFormat("ga('ec:addProduct', {0});", lcfg.Render()); sb.AppendLine(); } var ccfg = new ConfigurationObject(_checkoutAction.Info); sb.AppendFormat("ga('ec:setAction', 'checkout', {0});", ccfg.Render()); sb.AppendLine(); return sb.ToString(); }
public override string RenderCommand() { var sb = new StringBuilder(); var transactionConfig = new ConfigurationObject(_transactionInfo.Info); sb.AppendFormat("ga('ecommerce:addTransaction', {0});", transactionConfig.Render()); sb.AppendLine(); foreach (var item in _transactionInfo.Items) { var itenConfig = new ConfigurationObject(item.Info); sb.AppendFormat("ga('ecommerce:addItem', {0});", itenConfig.Render()); sb.AppendLine(); } sb.AppendLine("ga('ecommerce:send');"); return sb.ToString(); }
public override string RenderCommand() { var eventInfo = new Dictionary<string, object> { {"hitType", "event"}, {"eventCategory", _category}, {"eventAction", _action}, {"eventLabel", _label} }; if(_value.HasValue) eventInfo.Add("eventValue", _value.Value); if (_nonInteraction) eventInfo.Add("nonInteraction", true); if(_useBeacon) eventInfo.Add("useBeacon", true); var config = new ConfigurationObject(eventInfo); return string.Format("ga('send', {0});", config.Render()); }
public Configuration(ConfigurationObject originalConfiguration) { _originalConfiguration = originalConfiguration; InitializeComponent(); Paths.Items.AddRange(originalConfiguration.IronPythonScriptPaths); }
public override string RenderMessage(string dataLayerName) { var vals = new Dictionary<string, object> { { _name, _value } }; var obj = new ConfigurationObject(vals); return Push(dataLayerName, obj); }
protected string Push(string dataLayerName, ConfigurationObject obj) { return string.Format("{0}.push({1});",dataLayerName, obj.Render()); }