Beispiel #1
0
        private string ReadType(DumpReader reader)
        {
            reader.FindValidateLineWord("(");
            string type = reader.ReadWord();

            reader.FindValidateLineWord(")");
            reader.FindValidateEOL();
            return(type);
        }
Beispiel #2
0
        protected string ReadParameter(DumpReader reader, string name)
        {
            reader.FindValidateLineWord(name);
            reader.ValidateWord("{");
            string value = reader.ReadWord();

            reader.ValidateWord("}");
            return(value);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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();
            }
        }