Esempio n. 1
0
 sealed protected override void OnLineData(LineReadingEventArgs e)
 {
 }
Esempio n. 2
0
        protected override void OnFileLineReading(LineReadingEventArgs e)
        {
            base.OnFileLineReading(e);
            if (e.Data != null)
            {
                string strLine = e.Data.Trim();

                bool bDiff = (e.Data.Length != strLine.Length);
                if (bDiff)
                {
                    Debug.Print(string.Format("{0,3}: \"{1}\"[{2}] ||| \"{3}\"[{4}] ***DIFF***", e.Line, e.Data, e.Data.Length, strLine, strLine.Length));
                }
                else
                {
                    Debug.Print(string.Format("{0,3}: \"{1}\"[{2}] ||| \"{3}\"[{4}]", e.Line, e.Data, e.Data.Length, strLine, strLine.Length));
                }

                if (strLine == string.Empty || strLine.Length <= 0)
                {
                    return;
                }

                CurrentLine++;

                if (strLine.Length > 0)
                {
                    if (strLine.Substring(0, 1).CompareTo("#") == 0)
                    {
                        return;
                    }

                    if (this.CurrentLine == 1)
                    {
                        Regex regex = new Regex(@"Microsoft Visual Studio Solution File, Format Version \d+.(\d{2}){1}$");
                        if (!regex.IsMatch(strLine))
                        {
                            e.Cancel = true;
                            return;
                        }

                        this.Solution           = new Solution(this.Name, this.Path);
                        this.Solution.Directory = this.DirectoryPath;
                        Parser parser = CreateParser(this.Solution);
                        Parsers.Push(parser);
                    }
                    else
                    {
                        ParseResult parseResult = null;
                        while (strLine.Length > 0)
                        {
                            Parser parser = Parsers.Peek();
                            parseResult = parser.Parse(strLine);
                            if (!parseResult.Success)
                            {
                                e.Cancel = true;
                                return;
                            }

                            if (parseResult.Model != null)
                            {
                                Parsers.Push(CreateParser(parseResult.Model));
                                parser = Parsers.Peek();
                            }

                            if ((parser.Model != null) && (parser.Model.Completed))
                            {
                                parser = Parsers.Pop();
                            }

                            strLine = strLine.Substring((int)(parseResult.Index + parseResult.Length));
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 protected virtual void OnLineReading(LineReadingEventArgs e)
 {
     ;
 }
Esempio n. 4
0
 protected void OnFileLoadStart(object sender, LineReadingEventArgs e)
 {
     CurrentLine = 0;
     Parsers.Clear();
 }