public NemoPlatform(XmlNode platform, string scenarioDirectory, NemoScenario nemoScenario, ref int modeID) : base(platform) { try { Sources = new List<NemoSource>(); Trackdefs = new List<NemoTrackdef>(); Description = GetString("description"); Launcher = GetString("launcher"); Towwer = GetString("towwer"); RepeatCount = GetInt("repeatCount"); foreach (XmlNode cur in platform.ChildNodes) if (cur.Name == "trackDef") Trackdefs.Add(new NemoTrackdef(cur, scenarioDirectory)); foreach (XmlNode cur in platform.ChildNodes) if (cur.Name == "Source") Sources.Add(new NemoSource(cur, Math.Abs(Trackdefs[0].InitialHeight), ref modeID)); if (Trackdefs.Count == 0) throw new FormatException("Platform.trackDef: At least one trackDef is required for each Platform"); NemoScenario = nemoScenario; } catch (Exception e) { throw new PlatformException(string.Format("Error initializing platform {0}", Name), e); } }
public NemoFile(string fileName, string nemoDataDirectory) { try { FileName = fileName; _xmlDocument = new XmlDocument(); _xmlDocument.Load(FileName); Scenario = new NemoScenario(_xmlDocument["Scenario"], nemoDataDirectory); } catch (FileNotFoundException) { throw; } catch (Exception e) { throw new FileFormatException(string.Format("Error opening NEMO file \"{0}\"", FileName), e); } }