/// <summary> /// Open a service file, /// filePath includes full path and extension /// </summary> /// <param name="filePath"></param> public ServiceFile(string filePath) { using (STFReader stf = new STFReader(filePath, false)) stf.ParseFile(new STFReader.TokenProcessor[] { new STFReader.TokenProcessor("service_definition", () => { stf.MustMatch("("); stf.ParseBlock(new STFReader.TokenProcessor[] { new STFReader.TokenProcessor("serial", () => { Serial = stf.ReadIntBlock(null); }), new STFReader.TokenProcessor("name", () => { Name = stf.ReadStringBlock(null); }), new STFReader.TokenProcessor("train_config", () => { Train_Config = stf.ReadStringBlock(null); }), new STFReader.TokenProcessor("pathid", () => { PathID = stf.ReadStringBlock(null); }), new STFReader.TokenProcessor("maxwheelacceleration", () => { MaxWheelAcceleration = stf.ReadFloatBlock(STFReader.UNITS.Any, null); }), new STFReader.TokenProcessor("efficiency", () => { Efficiency = stf.ReadFloatBlock(STFReader.UNITS.Any, null); }), new STFReader.TokenProcessor("timetable", () => { TimeTable = new TimeTable(stf); }), }); }), }); }
// Used for explore in activity mode public ServiceFile() { Efficiency = 0.9f; TimeTable = new TimeTable(); }