示例#1
0
        internal static DataLine CreateNew(PO.Entry entry, DataLine.Kinds kind, int?index, bool isContinuation, IO.TextLine addRelativeTo, bool addRelativeToBefore, string text)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            if (addRelativeTo == null)
            {
                throw new ArgumentNullException("addRelativeTo");
            }
            int insertAt = entry.File.TextFile.Lines.IndexOf(addRelativeTo);

            if (insertAt < 0)
            {
                throw new ArgumentOutOfRangeException("addRelativeTo");
            }
            if (!addRelativeToBefore)
            {
                insertAt++;
            }
            IO.TextLine textLine = new IO.TextLine(BuildTextFileData(kind, index, isContinuation, text));
            entry.File.TextFile.Lines.Insert(insertAt, textLine);
            DataLine result;

            if (index.HasValue)
            {
                result = new IndexedDataLine(entry.File, textLine, isContinuation, kind, text, index.Value);
            }
            else
            {
                result = new DataLine(entry.File, textLine, isContinuation, kind, text);
            }
            entry.LineAdded(result);
            return(result);
        }
示例#2
0
 private SearchResult(PO.Entry entry)
 {
     this.Entry = entry;
     this.Places = new List<SearchPlace>();
     this.Indexes = new List<int?>();
     this.Starts = new List<int?>();
     this.Lengths = new List<int?>();
 }