Example #1
0
        public LogGroup(LogFileReader reader, string name)
        {
            Name       = name;
            FileReader = reader;

            var xmlData   = reader.ReadArchiveFile(name + "/Structure.xml");
            var xmlString = Encoding.ASCII.GetString(xmlData);

            using (var xmlReader = XmlTextReader.Create(new StringReader(xmlString)))
            {
                while (xmlReader.Read())
                {
                    if (xmlReader.NodeType == XmlNodeType.Element)
                    {
                        switch (xmlReader.Name)
                        {
                        case "entity":
                            if (xmlReader.GetAttribute("name") != this.Name)
                            {
                                Debug.WriteLine("Something is not right");
                            }
                            break;

                        case "field":
                            var fieldObj = new LogField(this, xmlReader.GetAttribute("name"),
                                                        xmlReader.GetAttribute("id"),
                                                        xmlReader.GetAttribute("type"));
                            _fields.Add(fieldObj);
                            break;
                        }
                    }
                }
            }

            var timeline = FileReader.ReadArchiveFile(Name + "/Time.bin");
            int index    = 0;

            while (index < timeline.Length)
            {
                int time   = BitConverter.ToInt32(timeline, index);
                int offset = BitConverter.ToInt32(timeline, index + 4);
                _timeline.Add(time, offset);
                index += 8;
            }
        }
Example #2
0
        public LogGroup(LogFileReader reader, string name)
        {
            Name = name;
            FileReader = reader;

            var xmlData = reader.ReadArchiveFile(name + "/Structure.xml");
            var xmlString = Encoding.ASCII.GetString(xmlData);

            using (var xmlReader = XmlTextReader.Create(new StringReader(xmlString)))
            {
                while(xmlReader.Read())
                {
                    if (xmlReader.NodeType == XmlNodeType.Element)
                    {
                        switch (xmlReader.Name)
                        {
                            case "entity":
                                if (xmlReader.GetAttribute("name") != this.Name)
                                    Debug.WriteLine("Something is not right");
                                break;

                            case "field":
                                var fieldObj = new LogField(this, xmlReader.GetAttribute("name"),
                                                            xmlReader.GetAttribute("id"),
                                                            xmlReader.GetAttribute("type"));
                                _fields.Add(fieldObj);
                                break;
                        }
                    }
                }
            }

            var timeline = FileReader.ReadArchiveFile(Name + "/Time.bin");
            int index = 0;

            while(index<timeline.Length)
            {
                int time = BitConverter.ToInt32(timeline, index);
                int offset = BitConverter.ToInt32(timeline, index + 4);
                _timeline.Add(time, offset);
                index += 8;
            }
        }