Skip to content

Commit

Permalink
0.9.0.0 General Update
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelight committed Feb 11, 2018
1 parent 372d733 commit f875639
Show file tree
Hide file tree
Showing 8 changed files with 483 additions and 323 deletions.
5 changes: 1 addition & 4 deletions Dslog/BinaryReader2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public override Int64 ReadInt64()
return BitConverter.ToInt64(a64, 0);
}

public override UInt64 ReadUInt64()
public override UInt64 ReadUInt64()
{
a64 = base.ReadBytes(8);
Array.Reverse(a64);
Expand All @@ -51,8 +51,5 @@ public override UInt16 ReadUInt16()
Array.Reverse(a16);
return BitConverter.ToUInt16(a16, 0);
}



}
}
28 changes: 24 additions & 4 deletions Dslog/DSEVENTSReader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dslog;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -29,13 +30,14 @@ class DSEVENTSReader
public DateTime StartTime;
public List<InfoEntry> EntryList;

public DSEVENTSReader(string path)
public DSEVENTSReader(string path, int numToRead)
{
EntryList = new List<InfoEntry>();
readFile(path);
readFile(path, numToRead);
}

private void readFile(string path)

private void readFile(string path, int numToRead)
{
if (File.Exists(path))
{
Expand All @@ -46,6 +48,8 @@ private void readFile(string path)
if (Version == 3)
{
StartTime = FromLVTime(reader.ReadInt64(), reader.ReadUInt64());
int tempRead = 0;
bool FMSMatch = false;
while (reader.BaseStream.Position != reader.BaseStream.Length)
{
DateTime time = FromLVTime(reader.ReadInt64(), reader.ReadUInt64());
Expand All @@ -54,6 +58,22 @@ private void readFile(string path)
EntryList.Add(new InfoEntry(time, s));
//if (s.StartsWith("Warning <Code> 44008")) ReadWarning44008(s, time);
//if (s.StartsWith("Warning <Code> 44004")) ReadWarning44004(s, time);
if (s.Contains("FMS Connected: Qualification") || s.Contains("FMS Connected: Elimination") || s.Contains("FMS Connected: Practice") || s.Contains("FMS Connected: None")) FMSMatch = true;

//Make sure we don't read every line for the listView
if (numToRead != -1)
{
if(FMSMatch)
{
if (s.Contains("FMS Event Name: ")) break;
}
else if (numToRead < tempRead) break;
tempRead++;
}




}
}

Expand All @@ -66,7 +86,7 @@ private DateTime FromLVTime(long unixTime, UInt64 ummm)
{
var epoch = new DateTime(1904, 1, 1, 0, 0, 0, DateTimeKind.Utc);
epoch = epoch.AddSeconds(unixTime);
epoch = epoch.AddHours(-4);
epoch = TimeZoneInfo.ConvertTimeFromUtc(epoch, TimeZoneInfo.Local);
return epoch.AddSeconds(((double)ummm / UInt64.MaxValue));
}
}
Expand Down
4 changes: 2 additions & 2 deletions Dslog/DSLOGReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ protected DateTime FromLVTime(long unixTime, UInt64 ummm)
{
var epoch = new DateTime(1904, 1, 1, 0, 0, 0, DateTimeKind.Utc);
epoch = epoch.AddSeconds(unixTime);
epoch = epoch.AddHours(-4);
epoch = TimeZoneInfo.ConvertTimeFromUtc(epoch, TimeZoneInfo.Local);

return epoch.AddSeconds(((double)ummm / UInt64.MaxValue));
}

Expand Down
77 changes: 53 additions & 24 deletions Dslog/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f875639

Please sign in to comment.