Ejemplo n.º 1
0
        public CtfEditorGamePage(System.IO.Stream fileStream, CtfEditorMainTabs _parentTab)
        {
            using (fileStream)
            {
                XmlDocument ctfSchema = new XmlDocument();
                ctfSchema.Load(fileStream);

                if (ctfSchema.DocumentElement is null)
                {
                    throw new InvalidDataException("The ctf schema does not have a root element.");
                }

                filterIndex = GetFilterIndex(ctfSchema.DocumentElement.GetAttribute("extension"));
                Int32.TryParse(ctfSchema.DocumentElement.GetAttribute("line"), out lineIndex);
                parentTab = _parentTab;

                ctfEntryInfo = new CtfEntryInfo[ctfSchema.DocumentElement.ChildNodes.Count];
                int i = 0;
                foreach (XmlElement entry in ctfSchema.DocumentElement.ChildNodes)
                {
                    ctfEntryInfo[i] = new CtfEntryInfo(i, entry);
                    i++;
                }

                files = new List <PerformanceFile>();
            }
        }
        public CtfEditorGamePage(System.IO.Stream fileStream, CtfEditorMainTabs _parentTab)
        {
            using (fileStream)
            {
                XmlDocument ctfSchema = new XmlDocument();
                ctfSchema.Load(fileStream);
                filterIndex = GetFilterIndex(ctfSchema.DocumentElement.GetAttribute("extension"));
                Int32.TryParse(ctfSchema.DocumentElement.GetAttribute("line"), out lineIndex);
                parentTab = _parentTab;

                ctfEntryInfo = new CtfEntryInfo[ctfSchema.DocumentElement.ChildNodes.Count];
                int i = 0;
                foreach (XmlElement entry in ctfSchema.DocumentElement.ChildNodes)
                {
                    ctfEntryInfo[i] = new CtfEntryInfo(i, entry);
                    i++;
                }

                files = new List<PerformanceFile>();
            }
        }