示例#1
0
        public FileModel(List <string> lines, string useDelimiters)
        {
            this.lines = lines;
            var fms = new FileModelStripper(lines, useDelimiters);

            searchLines = fms.StrippedLines;
            LineNum     = 0;
        }
示例#2
0
        /// <summary>
        /// Create a file model with a set of specified delimiters which surround text ignored
        /// for searching out of "//", "/*" and "\"" - defaults to all 3.
        /// </summary>
        /// <param name="path">Path for the model to read/write</param>
        /// <param name="useDelimiters">Concatenated delimiter strings to use</param>
        /// <param name="loadFile">True to load the file at the path, false to create a new model</param>
        public FileModel(string path, string useDelimiters, bool loadFile)
        {
            lines     = new List <string>();
            this.path = path;
            if (loadFile)
            {
                using (var reader = new StreamReader(File.OpenRead(path)))
                {
                    while (!reader.EndOfStream)
                    {
                        lines.Add(reader.ReadLine());
                    }
                }
            }
            var fms = new FileModelStripper(lines, useDelimiters);

            searchLines = fms.StrippedLines;
            LineNum     = 0;
        }