internal void OnDeserializedMethod(StreamingContext context) { if (KeywordIds == null) { return; } // TODO: Can be put into json. var tauntExceptions = new List <int> { 48100, 61028, 63623, 763, 1003, 43022, 63622, 63619, 48100 }; HasTaunt = KeywordIds.Contains(MinionKeyword.Taunt) && !tauntExceptions.Contains(Id); var rebornExceptions = new List <int>(); HasReborn = KeywordIds.Contains(MinionKeyword.Reborn) && !rebornExceptions.Contains(Id); var divineShieldExceptions = new List <int> { 61072, 38740, 60629 }; HasDivineShield = KeywordIds.Contains(MinionKeyword.DivineShield) && !divineShieldExceptions.Contains(Id); HasWindfury = KeywordIds.Contains(MinionKeyword.Windfury); }
/// <summary> /// Parses the supplied arguments. Logs errors for unrecognised or duplicate arguments. /// </summary> /// <param name="idToValueMap">A map of (argument id -> supplied value)</param> /// <returns></returns> private static bool ParseArguments(string[] commandLineArgs, ILogger logger, out IDictionary <KeywordIds, string> idToValueMap) { bool parsedOk = true; // Property bag of the values that have been recognised idToValueMap = new Dictionary <KeywordIds, string>(); foreach (string arg in commandLineArgs) { string prefix; ArgumentDescriptor descriptor; if (TryGetMatchingDescriptor(arg, out descriptor, out prefix)) { KeywordIds newId = descriptor.Id; if (idToValueMap.ContainsKey(newId)) { logger.LogError(Resources.ERROR_CmdLine_DuplicateArg, arg, idToValueMap[newId]); parsedOk = false; } else { // Store the argument string argValue = arg.Substring(prefix.Length); idToValueMap[newId] = argValue; } } else { logger.LogError(Resources.ERROR_CmdLine_UnrecognisedArg, arg); parsedOk = false; } } return(parsedOk); }
public void PopulateDropDownLists( IEnumerable <Document> documents, IEnumerable <Classification> classifications, IEnumerable <Keyword> keywords) { AvailableDocuments.AddRange(documents .OrderBy(d => d.Id) .Select(d => new SelectListItem { Value = d.Id.ToString(), Text = d.CatalogCode + " - " + d.Title, Selected = d.Id == Image.DocumentId })); AvailableKeywords.AddRange(keywords .OrderBy(k => k.Id) .ToList() .Select(k => new TranslatedViewModel <Keyword, KeywordTranslation>(k)) .Select(k => new SelectListItem { Value = k.Entity.Id.ToString(), Text = k.Translation.Value, Selected = KeywordIds.Contains(k.Entity.Id) })); AvailableClassifications.AddRange(classifications .OrderBy(c => c.Id) .ToList() .Select(c => new TranslatedViewModel <Classification, ClassificationTranslation>(c)) .Select(c => new SelectListItem { Value = c.Entity.Id.ToString(), Text = c.Translation.Value, Selected = Image.ClassificationId == c.Entity.Id })); }