static void ParseListEntryForSeasonalAchievement(string equipmentString, string timePlayedString, string description, string startDateString, string endDateString) { if (string.IsNullOrEmpty(equipmentString) || string.IsNullOrEmpty(timePlayedString) || string.IsNullOrEmpty(description)) { return; } var equipmentType = (BibaEquipmentType)Enum.Parse(typeof(BibaEquipmentType), equipmentString); var timePlayed = Convert.ToInt32(timePlayedString); var startDate = DateTime.ParseExact(startDateString, BibaEditorConstants.DATETIME_PARSE_EXACT_FORMAT, CultureInfo.InvariantCulture); var endDate = DateTime.ParseExact(endDateString, BibaEditorConstants.DATETIME_PARSE_EXACT_FORMAT, CultureInfo.InvariantCulture); var configToWrite = new BibaSeasonalAchievementConfig() { EquipmentType = equipmentType, TimePlayed = timePlayed, StartDate = startDate, EndDate = endDate, DescriptionSuffix = description }; _achievementSettings.AchievementSettings.Add(configToWrite); }
static void ParseTimedMilestone(Dictionary <string, string> paramDict) { //Parse StartDate and EndDate var dateMatchGroups = Regex.Match(paramDict[VALUE3], BibaEditorConstants.REGEX_STARTDATE_ENDDATE).Groups; var startDate = DateTime.ParseExact(dateMatchGroups[BibaEditorConstants.REGEX_GROUP_STARTDATE].Value, BibaEditorConstants.DATETIME_PARSE_EXACT_FORMAT, CultureInfo.InvariantCulture); var endDate = DateTime.ParseExact(dateMatchGroups[BibaEditorConstants.REGEX_GROUP_ENDDATE].Value, BibaEditorConstants.DATETIME_PARSE_EXACT_FORMAT, CultureInfo.InvariantCulture); var configToWrite = new BibaSeasonalAchievementConfig() { EquipmentType = (BibaEquipmentType)Enum.Parse(typeof(BibaEquipmentType), paramDict[VALUE2]), TimePlayed = Convert.ToInt32(paramDict [VALUE1]), StartDate = startDate, EndDate = endDate, DescriptionSuffix = paramDict [DESCRIPTION2] }; _achievementSettings.AchievementSettings.Add(configToWrite); }