/// <summary> /// Try to load the file. /// Possibly this might raise an exception. That exception is not caught here /// </summary> /// <param name="file">The file that needs to be loaded</param> public override void TryLoading(string file) { var subdirname = Path.GetFileName(Path.GetDirectoryName(file)).ToLowerInvariant(); if (subdirname == "openrails") { //todo Need good examples for this. Might not actually be found via SIMIS header //Also not clear if this needs a global tracksection or not var TSectionDat = new TrackSectionsFile(file); } else { _globalTsection.AddRouteTSectionDatFile(file); } }
/// <summary> /// Try to load the file. /// Possibly this might raise an exception. That exception is not caught here /// </summary> /// <param name="file">The file that needs to be loaded</param> public override void TryLoading(string file) { string subdirname = Path.GetFileName(Path.GetDirectoryName(file)); if (subdirname.Equals("openrails", System.StringComparison.OrdinalIgnoreCase)) { //todo Need good examples for this. Might not actually be found via SIMIS header //Also not clear if this needs a global tracksection or not _ = new TrackSectionsFile(file); } else { globalTsection.AddRouteTSectionDatFile(file); } }
internal async Task LoadTrackData(bool?useMetricUnits, CancellationToken cancellationToken) { List <Task> loadTasks = new List <Task>(); FolderStructure.ContentFolder.RouteFolder routeFolder = FolderStructure.Route(routePath); RouteFile routeFile = new RouteFile(routeFolder.TrackFileName); RouteName = routeFile.Route.Name; UseMetricUnits = useMetricUnits.GetValueOrDefault(routeFile.Route.MilepostUnitsMetric); loadTasks.Add(Task.Run(() => { string tdbFile = routeFolder.TrackDatabaseFile(routeFile); if (!File.Exists(tdbFile)) { Trace.TraceError($"Track Database File not found in {tdbFile}"); return; } TrackDB = new TrackDatabaseFile(tdbFile).TrackDB; }, cancellationToken)); loadTasks.Add(Task.Run(() => { TrackSections = new TrackSectionsFile(routeFolder.TrackSectionFile); if (File.Exists(routeFolder.RouteTrackSectionFile)) { TrackSections.AddRouteTSectionDatFile(routeFolder.RouteTrackSectionFile); } }, cancellationToken)); loadTasks.Add(Task.Run(() => { string rdbFile = routeFolder.RoadTrackDatabaseFile(routeFile); if (!File.Exists(rdbFile)) { Trace.TraceError($"Road Database File not found in {rdbFile}"); return; } RoadTrackDB = new RoadDatabaseFile(rdbFile).RoadTrackDB; }, cancellationToken)); loadTasks.Add(Task.Run(() => SignalConfig = new SignalConfigurationFile(routeFolder.SignalConfigurationFile, routeFolder.ORSignalConfigFile), cancellationToken)); await Task.WhenAll(loadTasks).ConfigureAwait(false); }