/// <summary> /// Generate the necessary parameters /// </summary> public List <KeyValuePair <string, string> > GetParams() { var p = new List <KeyValuePair <string, string> >(); if (Binding != null) { p.Add(new KeyValuePair <string, string>("Binding", Binding)); } if (FriendlyName != null) { p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName)); } if (FactorType != null) { p.Add(new KeyValuePair <string, string>("FactorType", FactorType.ToString())); } if (Config != null) { p.Add(new KeyValuePair <string, string>("Config", Config)); } return(p); }
private BaseFactor GetFactors(FactorType factorType) { var factors = (from factor in base.SimpleStreamAxis(FileName, factorType.ToString()) select new BaseFactor { High = Convert.ToDouble(factor.ElementAnyNS(EmissionsFactorType.High.ToString()).Value), Medium = Convert.ToDouble(factor.ElementAnyNS(EmissionsFactorType.Medium.ToString()).Value), Low = Convert.ToDouble(factor.ElementAnyNS(EmissionsFactorType.Low.ToString()).Value), }).Select(x => { x.ErrorMessages = x.Validate(); return(x); }).FirstOrDefault(); return(factors); }
/// <summary> /// Generate the necessary parameters /// </summary> public List <KeyValuePair <string, string> > GetParams() { var p = new List <KeyValuePair <string, string> >(); if (FriendlyName != null) { p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName)); } if (FactorType != null) { p.Add(new KeyValuePair <string, string>("FactorType", FactorType.ToString())); } if (BindingAlg != null) { p.Add(new KeyValuePair <string, string>("Binding.Alg", BindingAlg)); } if (BindingPublicKey != null) { p.Add(new KeyValuePair <string, string>("Binding.PublicKey", BindingPublicKey.ToString())); } if (ConfigAppId != null) { p.Add(new KeyValuePair <string, string>("Config.AppId", ConfigAppId)); } if (ConfigNotificationPlatform != null) { p.Add(new KeyValuePair <string, string>("Config.NotificationPlatform", ConfigNotificationPlatform.ToString())); } if (ConfigNotificationToken != null) { p.Add(new KeyValuePair <string, string>("Config.NotificationToken", ConfigNotificationToken)); } if (ConfigSdkVersion != null) { p.Add(new KeyValuePair <string, string>("Config.SdkVersion", ConfigSdkVersion)); } return(p); }
private decimal ExecuteFactor(FactorType type, Dictionary <FactorType, List <FactorInfo> > factors, Dictionary <FactorType, List <FactorInfo> > defenderFactors, Hero hero, Creature creature, TextWriter log, decimal i2 = 1, decimal r2 = 1) { decimal value = 0; if (!factors.ContainsKey(type)) { return(value); } List <FactorInfo> factorInfos = factors[type]; foreach (FactorInfo info in factorInfos) { log.WriteLine("Executing bonus: {0} for {1}. Factor type: {2}", info.ParentRef.Name, creature.Name, type.ToString()); object modificator = null; if (info.Factor.Item is Modificator) { modificator = info.Factor.Item; } else if (info.Factor.Item is Reference) { object refModificator = World.Modificators[((Reference)info.Factor.Item).Name]; modificator = (Modificator)refModificator; } else if (info.Factor.Item is LevelModificator) { modificator = info.Factor.Item; } value += EvalModificator(modificator, info, defenderFactors, hero, creature, log, i2, r2); } log.WriteLine("Factor Type: {0} evaluationg finished with value: '{1}' for {2}.", type.ToString(), value, creature.Name); return(value); }