Ejemplo n.º 1
0
        void ReadFormat()
        {
            string line;
            Regex  formatLineRegex = new Regex(@"\[(?<path>'[\w:_\.\/$]*') (?<elements>(\(\w* \w*[? \w:_\.\/$+]*\) *)*)\]");
            Regex  elementsRegex   = new Regex(@"\((?<type>float|int|string|b64texture) (?<name>\w*)(?<units>[ \w:_\.\/$+]*)\)");

            m_logLineDescriptors.Clear();

            while (!(line = m_logDataStream.ReadLine()).Equals("<\\format>"))
            {
                Match formatLineMatch         = formatLineRegex.Match(line);
                PerfStatLogLineDescriptor lld = new PerfStatLogLineDescriptor();

                string idValue = formatLineMatch.Groups["path"].Value;
                string path    = idValue.Substring(1, idValue.Length - 2);

                lld.m_path = path;

                if (path.Contains("$"))
                {
                    lld.m_formatElements.Add(new PerfStatFrameElement("string", "path", "units"));
                }

                string          elements        = formatLineMatch.Groups["elements"].Value;
                MatchCollection elementsMatches = elementsRegex.Matches(elements);

                foreach (Match elementMatch in elementsMatches)
                {
                    string type  = elementMatch.Groups["type"].Value;
                    string name  = elementMatch.Groups["name"].Value;
                    string units = elementMatch.Groups["units"].Value;

                    PerfStatFrameElement fe = new PerfStatFrameElement(type, name, units);
                    lld.m_formatElements.Add(fe);
                }

                lld.CreateRegex();

                m_logLineDescriptors.Add(lld);
            }
        }
Ejemplo n.º 2
0
        void ReadFormat()
        {
            uint nDataGroups = m_logDataStream.ReadUInt32();

            m_logLineDescriptors.Clear();

            for (uint i = 0; i < nDataGroups; i++)
            {
                PerfStatLogLineDescriptor lld = new PerfStatLogLineDescriptor();

                string path = ReadString();

                lld.m_path = path;

                // Add new format element for each "$" placeholder
                int numOfPlaceholders = path.Split('$').Length - 1;
                for (int j = 0; j < numOfPlaceholders; j++)
                {
                    lld.m_formatElements.Add(new PerfStatFrameElement("string", "path", "units"));
                }

                uint numElems = m_logDataStream.ReadUInt32();

                for (uint j = 0; j < numElems; j++)
                {
                    EFrameElementType type     = ReadFrameElementType();
                    string            str      = ReadString();
                    string[]          elements = str.Split(new char[] { ' ' });
                    string            name     = elements[0];
                    string            units    = elements.Length > 1 ? elements[1] : "";

                    PerfStatFrameElement fe = new PerfStatFrameElement(type, name, units);
                    lld.m_formatElements.Add(fe);
                }

                m_logLineDescriptors.Add(lld);
            }
        }