Exemple #1
0
        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();
        }
Exemple #2
0
        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());
        }