示例#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;
 }