private bool ParseTitle(PgPlayerTitle item, object value, string parsedFile, string parsedKey) { if (!(value is string ValueTitle)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Value '{value}' was expected to be a string")); } item.Title = StripStringTags(ValueTitle); return(true); }
private bool FinishItem(PgPlayerTitle item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey) { bool Result = true; foreach (KeyValuePair <string, object> Entry in contentTable) { string Key = Entry.Key; object Value = Entry.Value; switch (Key) { case "Title": Result = ParseTitle(item, Value, parsedFile, parsedKey); break; case "Tooltip": Result = SetStringProperty((string valueString) => item.Tooltip = valueString, Value); break; case "Keywords": Result = StringToEnumConversion <TitleKeyword> .TryParseList(Value, item.KeywordList); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } return(Result); }