Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions MAT.SQLRace.HelloData/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static void Main(string[] args)
//Benchmark();
//LoadAssociated();

//LoadSSNWithAssociatedMerge();
//LoadSSNWithAssociated();
//AddEvents();
//LoadLiveSessionAndWaitForLapEvents();
//LoadLiveSessionAndWaitForEvents();
Expand Down Expand Up @@ -294,13 +294,13 @@ private static void LoadAssociated()
var sessionManager = SessionManager.CreateSessionManager();
var sessionSummaries = sessionManager.LoadAssociatesForSession(sessionKey, ConnectionString);
var additionalSessionKey = sessionSummaries.OrderBy(ss => ss.TimeOfRecording).Last();
IClientSession clientSession = sessionManager.Load(sessionKey, ConnectionString, new[] { additionalSessionKey.Key });
ICompositeSession compositeSession = sessionManager.LoadCompositeSession(sessionKey, ConnectionString, new[] { additionalSessionKey.Key });

var containsChannel = clientSession.Session.ContainsParameter(parameterIdentifier);
var containsChannel = compositeSession.ContainsParameter(parameterIdentifier);
Console.WriteLine(
$"Parameter {parameterIdentifier} exists in session: {containsChannel}");

using (var pda = clientSession.Session.CreateParameterDataAccess(parameterIdentifier))
using (var pda = compositeSession.CreateParameterDataAccess(parameterIdentifier))
{
Console.WriteLine(
$"PDA {parameterIdentifier} successfully created");
Expand Down Expand Up @@ -886,21 +886,21 @@ private static void LoadSSN()
var fileSessionManager = FileSessionManager.CreateFileSessionManager();

//var session01 = fileSessionManager.Load(@"C:\Session Location\Session To Load.ssn");
var session01 = fileSessionManager.Load(@"C:\Session Location\Session To Load.ssn", new List<string>
ICompositeSession compositeSession = fileSessionManager.LoadCompositeSession(@"C:\Session Location\Session To Load.ssn", new List<string>
{
@"C:\Session Location\Session To Load.VTS.001.ssv"
}); // session with associates

if (session01 == null)
if (compositeSession == null)
{
Console.WriteLine("Session not found");
return;
}

var vCarIdentifier = "vCar:Chassis";
using (var pda = session01.Session.CreateParameterDataAccess(vCarIdentifier))
using (var pda = compositeSession.CreateParameterDataAccess(vCarIdentifier))
{
pda.GoTo(session01.Session.StartTime + (session01.Session.EndTime - session01.Session.StartTime) / 2);
pda.GoTo(compositeSession.StartTime + (compositeSession.EndTime - compositeSession.StartTime) / 2);
var samples = pda.GetNextSamples(10);

Console.WriteLine($"** Data for {vCarIdentifier}");
Expand All @@ -911,7 +911,7 @@ private static void LoadSSN()
}
}

private static void LoadSSNWithAssociatedMerge()
private static void LoadSSNWithAssociated()
{
//SQLite ssn style connection string
ConnectionString = $@"DbEngine=SQLite;Data Source={
Expand All @@ -934,14 +934,13 @@ private static void LoadSSNWithAssociatedMerge()
Console.WriteLine("Loading session...");
var sessionManager = SessionManager.CreateSessionManager();

var session01 = sessionManager.Load(sessionSummary01.Key, ConnectionString, new[] { sessionSummary01.Associates.Last() });
var session = session01.Session;
ICompositeSession compositeSession = sessionManager.LoadCompositeSession(sessionSummary01.Key, ConnectionString, new[] { sessionSummary01.Associates.Last() });
Console.WriteLine("Session loaded");

var muTyreRLIdentifier = "muTyreRL:MRLTyres";
using (var pda = session01.Session.CreateParameterDataAccess(muTyreRLIdentifier))
using (var pda = compositeSession.CreateParameterDataAccess(muTyreRLIdentifier))
{
pda.GoTo(session.StartTime + (session.EndTime - session.StartTime) / 2);
pda.GoTo(compositeSession.StartTime + (compositeSession.EndTime - compositeSession.StartTime) / 2);
var samples = pda.GetNextSamples(10);

Console.WriteLine($"** Data for {muTyreRLIdentifier}");
Expand All @@ -952,9 +951,9 @@ private static void LoadSSNWithAssociatedMerge()
}

var vCarIdentifier = "vCar:Chassis";
using (var pda = session01.Session.CreateParameterDataAccess(vCarIdentifier))
using (var pda = compositeSession.CreateParameterDataAccess(vCarIdentifier))
{
pda.GoTo(session.StartTime + (session.EndTime - session.StartTime) / 2);
pda.GoTo(compositeSession.StartTime + (compositeSession.EndTime - compositeSession.StartTime) / 2);
var samples = pda.GetNextSamples(10);

Console.WriteLine($"** Data for {vCarIdentifier}");
Expand Down