public Model Load(string fileName) { var document = new XmlDocument(); if (fileName.EndsWith(".tcn")) { var file = new ZipFile(new FileStream(fileName, FileMode.Open, FileAccess.Read)); var enumerator = file.GetEnumerator(); while (enumerator.MoveNext()) { if (((ZipEntry)enumerator.Current).Name.EndsWith(".xml")) { document.Load(file.GetInputStream((ZipEntry)enumerator.Current)); break; } } } else if (fileName.EndsWith(".xml")) document.Load(fileName); else throw new FileLoadException(); var tcnModel = new TCNFile(); tcnModel.Parse(document.DocumentElement); return tcnModel.Convert(); }
public Model Load(string fileName) { var document = new XmlDocument(); if (fileName.EndsWith(".tcn")) { var file = new ZipFile(new FileStream(fileName, FileMode.Open, FileAccess.Read)); var enumerator = file.GetEnumerator(); while (enumerator.MoveNext()) { if (((ZipEntry)enumerator.Current).Name.EndsWith(".xml")) { document.Load(file.GetInputStream((ZipEntry)enumerator.Current)); break; } } } else if (fileName.EndsWith(".xml")) { document.Load(fileName); } else { throw new FileLoadException(); } var tcnModel = new TCNFile(); tcnModel.Parse(document.DocumentElement); return(tcnModel.Convert()); }