GetString() public method

Get the text for a single line.
Get the text for a single line.
public GetString ( int i ) : string
i int /// index of the line to extract. Note this is 0-based, so line /// number 1 is actually index 0. ///
return string
        public HunkRangeInfo(ITextSnapshot snapshot, Edit edit, RawText originalText, RawText workingText)
        {
            if (snapshot == null)
                throw new ArgumentNullException("snapshot");
            if (edit == null)
                throw new ArgumentNullException("edit");
            if (originalText == null)
                throw new ArgumentNullException("originalText");
            if (workingText == null)
                throw new ArgumentNullException("workingText");

            _snapshot = snapshot;
            _edit = edit;
            _originalText = originalText.GetString(edit.GetBeginA(), edit.GetEndA(), true).Split('\n').Select(i => i.TrimEnd('\r')).ToList();
            _canRollback = true;
        }
Beispiel #2
0
		/// <exception cref="System.Exception"></exception>
		private ApplyResult Init(string name, bool preExists, bool postExists)
		{
			Git git = new Git(db);
			if (preExists)
			{
				a = new RawText(ReadFile(name + "_PreImage"));
				Write(new FilePath(db.Directory.GetParent(), name), a.GetString(0, a.Size(), false
					));
				git.Add().AddFilepattern(name).Call();
				git.Commit().SetMessage("PreImage").Call();
			}
			if (postExists)
			{
				b = new RawText(ReadFile(name + "_PostImage"));
			}
			return git.Apply().SetPatch(typeof(DiffFormatterReflowTest).GetResourceAsStream(name
				 + ".patch")).Call();
		}
Beispiel #3
0
		static string[] GetLineStrings (RawText text)
		{
			int lineCount = text.Size ();
			string[] lines = new string[lineCount];

			for (int i = 0; i < lineCount; i++) {
				lines [i] = text.GetString (i);
			}

			return lines;
		}