Skip to content

Commit

Permalink
Possible fix for Message (DateTime) parsing issues at DUE.
Browse files Browse the repository at this point in the history
Added DateTimeStyles.AllowWhiteSpaces to allow for whitespaces in the date format.
  • Loading branch information
marcelltoth committed Sep 9, 2019
1 parent 7bb5942 commit d084fbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.infinitx.neptunlite" android:versionName="1.19.152" android:versionCode="36">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.infinitx.neptunlite" android:versionName="1.19.154" android:versionCode="37">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
8 changes: 4 additions & 4 deletions NeptunLight/NeptunLight/DataAccess/WebNeptunInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public async Task<IReadOnlyDictionary<Semester, IReadOnlyCollection<Exam>>> Refr
string type = dataRow.Cells[4].GetFirstLineOfText();
string attemptType = dataRow.Cells[5].GetFirstLineOfText();
string startTimeText = dataRow.Cells[6].GetFirstLineOfText();
DateTime startTime = DateTime.ParseExact(startTimeText, "yyyy.MM.dd. H:mm:ss", DateTimeFormatInfo.InvariantInfo);
DateTime startTime = DateTime.ParseExact(startTimeText, "yyyy.MM.dd. H:mm:ss", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowWhiteSpaces);
string location = dataRow.Cells[7].GetFirstLineOfText();
IEnumerable<string> instructors = dataRow.Cells[8].GetFirstLineOfText().Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).Select(i => i.Trim());
string[] placeCountParts = dataRow.Cells[9].GetFirstLineOfText().Split(' ')[0].Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
Expand Down Expand Up @@ -405,8 +405,8 @@ public async Task<IReadOnlyCollection<Period>> RefreshPeriodsAsnyc()
{
if (dataRow.ClassList.Contains("NoMatch"))
continue;
DateTime startTime = DateTime.ParseExact(dataRow.Cells[1].TextContent, "yyyy.MM.dd. H:mm:ss", DateTimeFormatInfo.InvariantInfo);
DateTime endTime = DateTime.ParseExact(dataRow.Cells[2].TextContent, "yyyy.MM.dd. H:mm:ss", DateTimeFormatInfo.InvariantInfo);
DateTime startTime = DateTime.ParseExact(dataRow.Cells[1].TextContent, "yyyy.MM.dd. H:mm:ss", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowWhiteSpaces);
DateTime endTime = DateTime.ParseExact(dataRow.Cells[2].TextContent, "yyyy.MM.dd. H:mm:ss", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowWhiteSpaces);
string type = dataRow.Cells[3].TextContent;
string name = dataRow.Cells[4].TextContent;

Expand All @@ -431,7 +431,7 @@ private static IList<MailHeader> ParseMailHeaderTable(IHtmlTableElement table, I
foreach (IHtmlTableRowElement row in table.Bodies[0].Rows)
try
{
DateTime receiveTime = DateTime.ParseExact(row.Cells[7].TextContent, "yyyy.MM.dd. H:mm:ss", DateTimeFormatInfo.InvariantInfo);
DateTime receiveTime = DateTime.ParseExact(row.Cells[7].TextContent, "yyyy.MM.dd. H:mm:ss", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowWhiteSpaces);
string sender = row.Cells[4].TextContent;
string title = row.Cells[6].TextContent;
long trid = Int64.Parse(row.Id.Substring(4));
Expand Down

0 comments on commit d084fbc

Please sign in to comment.