private static Time parseTime(string time) { var parsedTime = new Time(); //Replace "," by "." as "," wouldn't parse in most cultures parsedTime.RealTime = TimeSpanParser.ParseNullable(time.Replace(',', '.')); //Null is stored as a zero time in FaceSplit Splits if (parsedTime.RealTime == TimeSpan.Zero) { parsedTime.RealTime = null; } return(parsedTime); }
//[DataRow("Elapsed time: 0:00:00.0001497")] public void PrefixDummyTest(string testString) { Console.WriteLine(testString); Dictionary <string, TimeSpan?> minuteMatches; bool success2 = TimeSpanParser.TryParsePrefixed(testString, prefixes, minuteOptions, out minuteMatches); Console.WriteLine(PrettyPrintTimeDict(minuteMatches, "minuteExpected")); Assert.IsTrue(success2); Dictionary <string, TimeSpan?> matches; bool success = TimeSpanParser.TryParsePrefixed(testString, prefixes, defaultOptions, out matches); Console.WriteLine(PrettyPrintTimeDict(matches, "expected")); //Assert.IsTrue(success); }
private ParsingResults ParseCell(object value, int rowIndex, int columnIndex, bool v) { if (string.IsNullOrWhiteSpace(value.ToString())) { value = null; if (columnIndex == COLUMNINDEX_DELAY) { splitToEventList[rowIndex].Delay = 0; SetDirty(); } return(new ParsingResults(true, value)); } if (columnIndex == COLUMNINDEX_EVENT) { var values = Enum.GetValues(typeof(SplitEventType)).Cast <Enum>().Select(enumValues => new { (Attribute.GetCustomAttribute(enumValues.GetType().GetField(enumValues.ToString()), typeof(DescriptionAttribute)) as DescriptionAttribute).Description, enumValues }).ToList(); var enumVal = values.FindIndex(x => x.Description == value.ToString()); splitToEventList[rowIndex].EventType = (SplitEventType)enumVal; SetDirty(); } try { value = TimeSpanParser.Parse(value.ToString()); if (columnIndex == COLUMNINDEX_DELAY) { var tempValue = (uint)((TimeSpan)value).TotalSeconds; if (tempValue > 1800) { tempValue = 1800; } splitToEventList[rowIndex].Delay = tempValue; SetDirty(); } return(new ParsingResults(true, value)); } catch { } return(new ParsingResults(false, null)); }
public IRun Create(IComparisonGeneratorsFactory factory) { var run = new Run(factory); var json = JSON.FromStream(Stream); run.CategoryName = json.title as string; run.AttemptCount = json.attempt_count; run.Offset = TimeSpanParser.Parse(json.start_delay as string); //Best Split Times can be used for the Segment History //Every single best split time should be included as its own run, //since the best split times could be apart from each other less //than the best segments, so we have to assume they are from different runs. var attemptHistoryIndex = 1; var segments = json.splits as IEnumerable <dynamic>; foreach (var segment in segments) { var segmentName = segment.title as string; var pbSplitTime = parseTime(segment.time as string); var bestSegment = parseTime(segment.best_segment as string); var parsedSegment = new Segment(segmentName, pbSplitTime, bestSegment); var bestSplitTime = parseTime(segment.best_time as string); if (bestSplitTime.RealTime != null) { run.AttemptHistory.Add(new Attempt(attemptHistoryIndex, default(Time), null, null)); //Insert a new run that skips to the current split foreach (var alreadyInsertedSegment in run) { alreadyInsertedSegment.SegmentHistory.Add(attemptHistoryIndex, default(Time)); } parsedSegment.SegmentHistory.Add(attemptHistoryIndex, bestSplitTime); attemptHistoryIndex++; } run.Add(parsedSegment); } return(run); }
private void txtBoxTimeCutoff_Validating(object sender, CancelEventArgs e) { if (string.IsNullOrEmpty(txtBoxTimeCutoff.Text)) { return; } try { TimeSpanParser.Parse(txtBoxTimeCutoff.Text); } catch { e.Cancel = true; txtBoxTimeCutoff.Select(0, txtBoxTimeCutoff.Text.Length); } }
public void TimeSpanTicks(string parseThis, long ticks) { // 10,000 ticks is one millisecond // 10 ticks is one microsecond // 0.01 tick is one nanosecond // 100 ns is one tick var expected = new TimeSpan(ticks); var options = new TimeSpanParserOptions(); options.FormatProvider = new CultureInfo("en-US"); TimeSpan actual = TimeSpanParser.Parse(parseThis, options); Assert.AreEqual(expected, actual); }
private void txtBoxTimeCutoff_Validated(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtBoxTimeCutoff.Text)) { CutoffTime = null; } else { try { CutoffTime = TimeSpanParser.Parse(txtBoxTimeCutoff.Text); } catch { } } }
[DataRow("-1.5:00:00:00", "-1:12:00:00", "-1:12:00:00")] // 1.5 days (even with allowing, because too many colons) public void WithAndWithoutAllowingDotSeperatorTests(string parseThis, string regularExpected, string withoutAllowing) { var options = new TimeSpanParserOptions(); options.AllowDotSeparatedDayHours = false; Console.WriteLine(parseThis); Console.WriteLine("number of colons: " + parseThis.Count(ch => ch == ':')); var actualRegular = TimeSpanParser.Parse(parseThis); var expectRegular = TimeSpan.Parse(regularExpected); var actualWithoutAllowing = TimeSpanParser.Parse(parseThis, options); var expectWithoutAllowing = TimeSpan.Parse(withoutAllowing); Assert.AreEqual(expectRegular, actualRegular); Assert.AreEqual(expectWithoutAllowing, actualWithoutAllowing); }
/*The CanBet check might break stuff if you enable the bets in the middle of a run. If someone has a better solution, go for it*/ private void StartBets(object sender, EventArgs e) { if (CanBet) { try { SegmentBeginning = State.CurrentTime; Bets[State.CurrentSplitIndex] = new Dictionary <string, Tuple <TimeSpan, double> >(); var timeFormatter = new ShortTimeFormatter(); var timeFormatted = timeFormatter.Format(GetTime(State.CurrentSplit.BestSegmentTime)); SendMessage("Place your bets for " + State.CurrentSplit.Name + "!" + (TimeSpanParser.Parse(timeFormatted) > new TimeSpan(0, 0, 0) ? (" Best segment for this split is " + timeFormatted + (Settings.UseGlobalTime?" but remember that global time is used!":"")) : " No best segment for this split :(")); } catch (Exception ex) { LogException(ex); } } }
public static GenericEmailViewModel MapToViewModel(this EmailDto email) { var sanitizer = new HtmlSanitizer(); return(new GenericEmailViewModel { Id = email.Id.ToString(), DateReceived = email.Received.ToLocalTime().ToString("dd.MM.yyyy HH:mm"), HasAttachments = email.NumberOfAttachments > 0, SenderEmail = email.SenderEmail, SenderName = email.SenderName, Status = email.Status.ToString(), Subject = sanitizer.Sanitize(email.Subject), TimeSinceCurrentStatus = TimeSpanParser.StatusParser(email), ToCurrentStatus = email.ToCurrentStatus, MessageId = email.GmailMessageId, Attachments = email.Attachments.Select(e => e.MapToViewModel()).ToList() }); }
[DataRow("1:12:24:02.04", 1, 12, 23, 62, 40)] // US format public void FutureParseUSFormatWithFR(string parseThis) { //TODO: make this pass by fixing parser to try French format first, then fallback to invariant. Perhaps allowing a mix if unambiguous Console.WriteLine(parseThis); var fr = new CultureInfo("fr-FR"); var options = new TimeSpanParserOptions(); options.FormatProvider = fr; // TimeSpan can parse it with fr (so why can't we?) var expected = TimeSpan.Parse(parseThis, fr); TimeSpan actual; bool success = TimeSpanParser.TryParse(parseThis, options, out actual); Assert.IsTrue(success); Assert.AreEqual(expected, actual); }
private void Grid_SplitSettings_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (e.ColumnIndex == COLUMNINDEX_DELAY) { if (string.IsNullOrWhiteSpace(e.FormattedValue.ToString())) { return; } try { TimeSpanParser.Parse(e.FormattedValue.ToString()); } catch { e.Cancel = true; grid_SplitSettings.Rows[e.RowIndex].ErrorText = "Invalid Time"; } } }
//TODO: test with DefaultColoned too public void TooManyColonsNoAutoUnitsTests(string parseThis, bool expectSuccess) { var options = new TimeSpanParserOptions(); options.AllowDotSeparatedDayHours = true; options.AutoUnitsIfTooManyColons = false; if (expectSuccess) { Console.WriteLine(parseThis); Console.WriteLine("number of colons: " + parseThis.Count(ch => ch == ':')); var actual = TimeSpanParser.Parse(parseThis); // should all pass //TODO: expected value too } else { Assert.ThrowsException <ArgumentException>(() => TimeSpanParser.Parse(parseThis)); //Assert.ThrowsException<FormatException>(() => TimeSpanParser.Parse(parseThis)); } }
public void SetSettings(XmlNode node) { var element = (XmlElement)node; TextColor = SettingsHelper.ParseColor(element["TextColor"]); OverrideTextColor = SettingsHelper.ParseBool(element["OverrideTextColor"]); TimeColor = SettingsHelper.ParseColor(element["TimeColor"]); OverrideTimeColor = SettingsHelper.ParseBool(element["OverrideTimeColor"]); BackgroundColor = SettingsHelper.ParseColor(element["BackgroundColor"]); BackgroundColor2 = SettingsHelper.ParseColor(element["BackgroundColor2"]); GradientString = SettingsHelper.ParseString(element["BackgroundGradient"]); Text1 = SettingsHelper.ParseString(element["Text1"]); GoalTime = TimeSpanParser.Parse(SettingsHelper.ParseString(element["GoalTime"])); ShowBest = SettingsHelper.ParseBool(element["ShowBest"]); Font1 = SettingsHelper.GetFontFromElement(element["Font1"]); Font2 = SettingsHelper.GetFontFromElement(element["Font2"]); OverrideFont1 = SettingsHelper.ParseBool(element["OverrideFont1"]); OverrideFont2 = SettingsHelper.ParseBool(element["OverrideFont2"]); Display2Rows = SettingsHelper.ParseBool(element["Display2Rows"], false); }
public void GuideSettingOptionsTests2() { // Note that days, hour, minutes and seconds must be in big-to-small order (just as English-speakers always write them). Assert.AreEqual( TimeSpanParser.Parse("7 days 1 hour 10 minutes 40 seconds"), TimeSpan.Parse("7.1:10:40")); // And parsing will stop when the order is broken (here "7 days 1 hour" is ignored) Assert.AreEqual( TimeSpanParser.Parse("10 minutes 40 seconds 7 days 1 hour"), TimeSpan.Parse("00:10:40")); // ...Unless you turn off "StrictBigToSmall" Assert.AreEqual( TimeSpanParser.Parse("10 minutes 40 seconds 7 days 1 hour", new TimeSpanParserOptions() { StrictBigToSmall = false }), TimeSpan.Parse("7.1:10:40")); }
/// <inheritdoc/> public override string ToString() { var sb = new StringBuilder(); sb.Append("{ Mode : "); sb.Append(_mode.ToString()); if (_tagSets.Count > 0) { sb.Append(", TagSets : ["); sb.Append(string.Join(", ", _tagSets)); sb.Append("]"); } if (_maxStaleness.HasValue) { sb.Append(", MaxStaleness : "); sb.Append(TimeSpanParser.ToString(_maxStaleness.Value)); } sb.Append(" }"); return(sb.ToString()); }
private void ValidateAndAddHangBasedProcessDumpParameters(XmlElement collectDumpNode) { foreach (XmlAttribute blameAttribute in collectDumpNode.Attributes) { switch (blameAttribute) { case XmlAttribute attribute when string.Equals(attribute.Name, Constants.TestTimeout, StringComparison.OrdinalIgnoreCase): if (!string.IsNullOrWhiteSpace(attribute.Value) && TimeSpanParser.TryParse(attribute.Value, out var timeout)) { this.inactivityTimespan = timeout; } else { this.logger.LogWarning(this.context.SessionDataCollectionContext, string.Format(CultureInfo.CurrentUICulture, Resources.Resources.UnexpectedValueForInactivityTimespanValue, attribute.Value)); } break; case XmlAttribute attribute when string.Equals(attribute.Name, Constants.HangDumpTypeKey, StringComparison.OrdinalIgnoreCase): if (string.Equals(attribute.Value, Constants.FullConfigurationValue, StringComparison.OrdinalIgnoreCase) || string.Equals(attribute.Value, Constants.MiniConfigurationValue, StringComparison.OrdinalIgnoreCase)) { this.processFullDumpEnabled = string.Equals(attribute.Value, Constants.FullConfigurationValue, StringComparison.OrdinalIgnoreCase); } else { this.logger.LogWarning(this.context.SessionDataCollectionContext, string.Format(CultureInfo.CurrentUICulture, Resources.Resources.BlameParameterValueIncorrect, attribute.Name, Constants.FullConfigurationValue, Constants.MiniConfigurationValue)); } break; default: this.logger.LogWarning(this.context.SessionDataCollectionContext, string.Format(CultureInfo.CurrentUICulture, Resources.Resources.BlameParameterKeyIncorrect, blameAttribute.Name)); break; } } }
private void txtGameTime_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { try { var timeSpans = txtGameTime.Text.Replace(" ", "").Split('+'); var totalTime = TimeSpan.Zero; foreach (var time in timeSpans) { totalTime += TimeSpanParser.Parse(time); } var newGameTime = totalTime + (Settings.UseSegmentTimes ? Model.CurrentState.CurrentTime.GameTime : TimeSpan.Zero); Model.CurrentState.SetGameTime(newGameTime); Model.Split(); txtGameTime.Text = ""; } catch { } } }
/// <inheritdoc /> public override async ValueTask <Result <ExpiryDate> > TryParseAsync(string value, CancellationToken ct = default) { if (PermanentAliases.Contains(value.ToLowerInvariant())) { return(new ExpiryDate()); } var timeSpanParser = new TimeSpanParser(); var parseTimeSpanResult = await timeSpanParser.TryParseAsync(value, ct); if (!parseTimeSpanResult.IsSuccess) { return(new ParsingError <ExpiryDate>( $"Could not parse matches amount \"{value}\" into a valid {nameof(ExpiryDate)}")); } var dateTimeOffset = DateTimeOffset.UtcNow.Add(parseTimeSpanResult.Entity); return(new ExpiryDate { Value = dateTimeOffset.ToUnixTimeMilliseconds() }); }
public static TimeSpan ParseTimeSpan(this String value, TemporaryPunishmentType?type = null) { try { if (Int32.TryParse(value, out Int32 seconds)) { return(new TimeSpan(0, 0, seconds)); } if (TimeSpanParser.TryParse(value, out TimeSpan time)) { return(time); } else { return(type switch { TemporaryPunishmentType.Mute => TimeSpan.Parse((String)InsanityBot.Config["insanitybot.commands.default_mute_time"]), TemporaryPunishmentType.Ban => TimeSpan.Parse((String)InsanityBot.Config["insanitybot.commands.default_ban_time"]), _ => new TimeSpan(00, 30, 00) }); }
/// <inheritdoc/> public override string ToString() { var parts = new List <string>(); if (_w != null) { if (_w is WMode) { parts.Add(string.Format("w : \"{0}\"", _w)); } else { parts.Add(string.Format("w : {0}", _w)); } } if (_wTimeout != null) { parts.Add(string.Format("wtimeout : {0}", TimeSpanParser.ToString(_wTimeout.Value))); } if (_fsync != null) { parts.Add(string.Format("fsync : {0}", _fsync.Value ? "true" : "false")); } if (_journal != null) { parts.Add(string.Format("journal : {0}", _journal.Value ? "true" : "false")); } if (parts.Count == 0) { return("{ }"); } else { return(string.Format("{{ {0} }}", string.Join(", ", parts.ToArray()))); } }
[DataRow(".000000001 s ", "0:00:00.000000001", 0, false)] // overflow public void OverflowExceptionTest(string tsp, string traditional, int ticks, bool successExpected) { if (successExpected) { var expected = TimeSpan.Parse(traditional); var actual = TimeSpanParser.Parse(tsp); Console.WriteLine($"actual:"); Console.WriteLine(tsp); Console.WriteLine($"parsed: {actual:G}"); Console.WriteLine($" ticks: {actual.Ticks}"); Console.WriteLine($"expected:"); Console.WriteLine(traditional); Console.WriteLine($"parsed: {expected:G}"); Console.WriteLine($" ticks: {expected.Ticks}"); Assert.AreEqual(expected, actual); Assert.AreEqual(ticks, expected.Ticks); } else { try { var parsed = TimeSpan.Parse(traditional); Console.WriteLine(tsp); Console.WriteLine($"expected:"); Console.WriteLine(traditional); Console.WriteLine($"parsed: {parsed:G}"); Console.WriteLine($" ticks: {parsed.Ticks}"); } catch (OverflowException e) { } // TimeSpan.Parse() does not reliably throw OverflowExceptions, so ignore this Assert //Assert.ThrowsException<OverflowException>(() => TimeSpan.Parse(traditional)); Assert.ThrowsException <OverflowException>(() => TimeSpanParser.Parse(tsp)); } }
public static TimeSpan ParseTimeSpan(this String value, Nullable <TemporaryPunishmentType> type = null) { try { if (TimeSpanParser.TryParse(value, out var time)) { return(time); } else { return type switch { TemporaryPunishmentType.Mute => TimeSpan.Parse((String)InsanityBot.Config["insanitybot.commands.default_mute_time"]), TemporaryPunishmentType.Ban => TimeSpan.Parse((String)InsanityBot.Config["insanitybot.commands.default_ban_time"]), _ => new TimeSpan(00, 30, 00) } }; } catch { InsanityBot.Client.Logger.LogError(new EventId(9980, "TimeSpanParser"), $"Could not parse \"{value}\" as TimeSpan"); return(new TimeSpan(00, 30, 00)); } }
public async Task <IActionResult> Update(UpdateUserStatusModel input) { var userId = this.User .FindFirstValue(ClaimTypes.NameIdentifier); var course = this.courseUserService .FindCourseUser(input.CourseId, input.UserId); if (course == null || course.UserStatus == null || course.UserStatus == input.Status) { return(this.BadRequest()); } var result = await this.courseUserService .UpdateStatusAsync <CourseUserModel>(input.CourseId, input.UserId, input.Status); if (result == null) { return(this.StatusCode(500)); } var user = await this.userManager.FindByIdAsync(input.UserId); if (result.Status == "Accepted") { await this.userManager.AddClaimAsync(user, new Claim(CourseRoleName.Member, course.Id)); } else { var claim = user.Claims.FirstOrDefault(x => x.ClaimType == CourseRoleName.Member && x.ClaimValue == course.Id); user.Claims.Remove(claim); } result.Date = TimeSpanParser.Parse((DateTime)(result.ModifiedOn ?? result.CreatedOn)); return(this.Ok(result)); }
public void SetSettings(System.Xml.XmlNode settings) { if (settings["Version"] != null && settings["Version"].InnerText == "0.2") { CanUnBet = bool.Parse(settings["UnBet"].InnerText); UnBetPenalty = int.Parse(settings["UnbetPenalty"].InnerText); MinimumTime = TimeSpanParser.Parse(settings["MinimumTime"].InnerText); NbScores = int.Parse(settings["NbScores"].InnerText); UseGlobalTime = bool.Parse(settings["UseGlobalTime"].InnerText); Method = settings["TimingMethod"].InnerText; AllowMods = bool.Parse(settings["AllowMods"].InnerText); } else { // Default values CanUnBet = true; UnBetPenalty = 50; MinimumTime = new TimeSpan(0, 0, 1); NbScores = 5; UseGlobalTime = false; Method = "Current Timing Method"; AllowMods = false; } }
public IRun Create(IComparisonGeneratorsFactory factory) { var run = new Run(factory); var reader = new StreamReader(Stream); var line = reader.ReadLine(); var titleInfo = line.Split('|'); run.CategoryName = titleInfo[0].Substring(1); run.AttemptCount = Int32.Parse(titleInfo[1]); TimeSpan totalTime = TimeSpan.Zero; while ((line = reader.ReadLine()) != null) { if (line.Length > 0) { var majorSplitInfo = line.Split('|'); totalTime += TimeSpanParser.Parse(majorSplitInfo[1]); while (!reader.EndOfStream && reader.Read() == (int)('*')) { line = reader.ReadLine(); run.AddSegment(line); } var newTime = new Time(run.Last().PersonalBestSplitTime); newTime.GameTime = totalTime; run.Last().PersonalBestSplitTime = newTime; } else { break; } } return(run); }
public static bool TryParse(string text, [MaybeNullWhen(false)] out TimeSpanValue timeSpanValue) { CultureInfo currentCulture = CultureInfo.CurrentCulture; DateTimeFormatInfo timeFmt = currentCulture.DateTimeFormat; NumberFormatInfo numFmt = currentCulture.NumberFormat; // Try using our custom TimeSpan parser first. It differs in a few ways // from .NET's standard TimeSpan parsing: // * It defaults to M:S instead of H:M if only two fields are specified. // * It will return negative values if a negative sign is used in the text. // * It handles out-of-bounds values correctly (e.g., 79:30 --> 1 hr 19 min 30 sec). // // If our custom parser can't parse it, then we'll fall back to the system's // parsing logic and see what it says. It may deal with other cultures // better, so I don't want to skip it entirely. bool result = TimeSpanParser.TryParse(text, timeFmt, numFmt, out timeSpanValue); if (!result) { result = SystemTryParse(text, timeFmt, numFmt, out timeSpanValue); } return(result); }
public void cannot_parse_invalid_input(string input) { var result = TimeSpanParser.Parser(new Input(input)); Assert.False(result.WasSuccessful && result.Remainder.AtEnd); }
//TODO Errors management with Twitch messages, will be useful for alpha release in case of bugs private void Bet(TwitchChat.User user, string argument) { if (!CanBet) { return; } switch (State.CurrentPhase) { case TimerPhase.NotRunning: SendMessage("Timer is not running, bets are closed"); return; case TimerPhase.Paused: SendMessage("Timer is paused, bets are paused too"); return; case TimerPhase.Ended: SendMessage("Run is ended, there is nothing to bet!"); return; } if (Bets[State.CurrentSplitIndex].ContainsKey(user.Name)) { SendMessage(user.Name + ", You already bet, silly!"); return; } var percentage = GetTime((State.CurrentTime - SegmentBeginning)).Value.TotalSeconds / GetTime(State.CurrentSplit.BestSegmentTime).Value.TotalSeconds; if (percentage > 0.75) { SendMessage("Too late to bet for this split, wait for the next one!"); return; } try { if (argument.ToLower().StartsWith("kappa")) { argument = "4:20.69"; SendMessage(user.Name + " bet 4:20.69 Kappa"); } var time = TimeSpanParser.Parse(argument); if (Settings.UseGlobalTime) { time -= GetTime(SegmentBeginning).Value; } if (time.CompareTo(Settings.MinimumTime) <= 0) { SendMessage(user.Name + ", Nice try, but it's invalid"); return; } var t = new Tuple <TimeSpan, double>(time, Math.Exp(-2 * Math.Pow(percentage, 2))); Bets[State.CurrentSplitIndex].Add(user.Name, t); } catch { SendMessage(user.Name + ", Invalid time, please retry"); } }
private void btnSubmit_Click(object sender, EventArgs e) { Uri videoUri = null; if (!string.IsNullOrEmpty(txtVideo.Text)) { var videoText = txtVideo.Text; if (!videoText.StartsWith("http")) { videoText = "http://" + videoText; } if (Uri.IsWellFormedUriString(videoText, UriKind.Absolute)) { videoUri = new Uri(videoText); } else { MessageBox.Show(this, "You didn't provide a valid Video URL.", "Submitting Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } var comment = txtComment.Text; DateTime?date = null; if (!hasPersonalBestDateTime) { date = new DateTime(datePicker.Value.Year, datePicker.Value.Month, datePicker.Value.Day, 0, 0, 0, DateTimeKind.Utc); } if (txtGameTime != null) { try { var gameTime = TimeSpanParser.ParseNullable(txtGameTime.Text); patchGameTime(gameTime); } catch { MessageBox.Show(this, "You didn't enter a valid Game Time.", "Submitting Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } TimeSpan?withoutLoads = null; if (txtWithoutLoads != null) { try { withoutLoads = TimeSpanParser.ParseNullable(txtWithoutLoads.Text); patchGameTime(withoutLoads); } catch { MessageBox.Show(this, "You didn't enter a valid Real Time without Loads.", "Submitting Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string reason; var submitted = SpeedrunCom.SubmitRun(metadata.LiveSplitRun, out reason, comment: comment, videoUri: videoUri, date: date, withoutLoads: withoutLoads); if (submitted) { Process.Start(metadata.Run.WebLink.AbsoluteUri); DialogResult = DialogResult.OK; Close(); } else { MessageBox.Show(this, reason, "Submitting Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }