Exemple #1
0
        private string ReadName(DumpReader reader)
        {
            string name = reader.FindReadLineWord();

            while (reader.FindPeekLineWord() != "//")
            {
                name += " " + reader.FindReadLineWord();
            }
            return(name);
        }
Exemple #2
0
        private bool ReadValidation(DumpReader reader, IReadOnlyList <TreeDump> trees)
        {
            reader.FindContent();

            bool validation = false;

            reader.StartPeeking();
            if (reader.ReadWord() == "//")
            {
                if (reader.FindReadLineWord().StartsWith("==", StringComparison.InvariantCulture))
                {
                    validation = true;
                }
            }
            reader.FinishPeeking();

            if (validation)
            {
                reader.ValidateWord("//");
                reader.FindReadLineWord();
                reader.FindValidateEOL();
                reader.FindNextLine();

                reader.ValidateWord("//");
                reader.FindValidateLineWord("Successfully");
                reader.FindValidateLineWord("finished");
                reader.FindValidateLineWord(".");
                reader.FindValidateLineWord("Written");
                int written = reader.FindReadLineInt();
                reader.FindValidateLineWord("of");
                int count = reader.FindReadLineInt();
                reader.FindValidateEOL();

                if (trees.Count != count)
                {
                    throw new Exception($"Class count mismatch. Read {trees.Count} expected {count}");
                }
                int validCount = trees.Count(t => t.IsValid);
                if (validCount != written)
                {
                    throw new Exception($"Valid class count mismatch. Read {validCount} expected {written}");
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        private string ReadType(DumpReader reader)
        {
            string type = reader.FindReadLineWord();

            if (type == "unsigned")
            {
                string subType = reader.FindReadLineWord();
                return($"{type} {subType}");
            }
            else
            {
                return(type);
            }
        }
Exemple #4
0
        private void ReadHeader(DumpReader reader)
        {
            reader.ValidateWord("//");
            ClassID = ReadIntParameter(reader, "classID");
            reader.ValidateWord(":");
            ClassName = reader.FindReadLineWord();

            List <string> inheritance = new List <string>();

            while (reader.FindLineContent())
            {
                reader.ValidateWord("<-");
                string baseName = reader.FindReadLineWord();
                inheritance.Add(baseName);
            }
            Inheritance = inheritance.ToArray();
            reader.FindNextLine();
        }
Exemple #5
0
        private Version ReadVersion(DumpReader reader)
        {
            reader.FindValidateWord("version");
            reader.ValidateWord(":");

            string major = reader.FindReadLineWord();

            reader.ValidateWord(".");
            string minor = reader.ReadWord();

            reader.ValidateWord(".");
            string buildType     = reader.ReadWord();
            string versionString = $"{major}.{minor}.{buildType}";

            Version version = new Version();

            version.Parse(versionString);
            return(version);
        }
Exemple #6
0
        private void ReadValid(DumpReader reader)
        {
            IsValid = true;
            reader.StartPeeking();
            if (reader.ReadWord() == "//")
            {
                if (reader.FindReadLineWord() == "Can't")
                {
                    IsValid = false;
                }
            }
            reader.FinishPeeking();

            if (!IsValid)
            {
                reader.ValidateWord("//");
                reader.FindValidateLineWord("Can't");
                reader.FindValidateLineWord("produce");
                reader.FindValidateLineWord(ClassName);
                reader.FindValidateEOL();
                reader.FindNextLine();
            }
        }