private static void GetTextLines(string textA, string textB, TextBinaryDiffArgs args, out IList <string> a, out IList <string> b, IDiffProgress progress) { a = null; b = null; CompareType compareType = args.CompareType; bool isAuto = compareType == CompareType.Auto; if (compareType == CompareType.Xml || isAuto) { a = TryGetXmlLines(DiffUtility.GetXmlTextLinesFromXml, "the left side text", textA, !isAuto, args, progress); // If A failed to parse with Auto, then there's no reason to try B. if (a != null) { b = TryGetXmlLines(DiffUtility.GetXmlTextLinesFromXml, "the right side text", textB, !isAuto, args, progress); } // If we get here and the compare type was XML, then both // inputs parsed correctly, and both lists should be non-null. // If we get here and the compare type was Auto, then one // or both lists may be null, so we'll fallthrough to the text // handling logic. } if (a == null || b == null) { a = DiffUtility.GetStringTextLines(textA, progress); b = DiffUtility.GetStringTextLines(textB, progress); } }
private DiffBinaryTextResults GetTextLines(DiffBinaryTextResults src , TextBinaryDiffArgs args , IDiffProgress progress) { IList <string> a = null, b = null; bool isAuto = args.CompareType == CompareType.Auto; if (args.CompareType == CompareType.Xml || isAuto) { a = TryGetXmlText(DiffUtility.GetXmlTextLinesFromXml, "the left side text", src.A.TextContent, !isAuto, args, progress); // If A failed to parse with Auto, then there's no reason to try B. if (a != null) { b = TryGetXmlText(DiffUtility.GetXmlTextLinesFromXml, "the right side text", src.B.TextContent, !isAuto, args, progress); } // If we get here and the compare type was XML, then both // inputs parsed correctly, and both lists should be non-null. // If we get here and the compare type was Auto, then one // or both lists may be null, so we'll fallthrough to the text // handling logic. } if (a == null || b == null) { a = DiffUtility.GetStringTextLines(src.A.TextContent, progress); b = DiffUtility.GetStringTextLines(src.B.TextContent, progress); } else { src.IsComparedAs = CompareType.Xml; } src.A.Lines = a; src.B.Lines = b; return(src); }
private DiffBinaryTextResults GetTextLines(string textA, string textB , TextBinaryDiffArgs args , IDiffProgress progress) { FileContentInfo af = null, bf = null; bool isAuto = args.CompareType == CompareType.Auto; if (args.CompareType == CompareType.Xml || isAuto) { af = TryGetXmlText(DiffUtility.GetXmlTextFromXml, "the left side text", textA, !isAuto, args, progress); // If A failed to parse with Auto, then there's no reason to try B. if (af != null) { bf = TryGetXmlText(DiffUtility.GetXmlTextFromXml, "the right side text", textB, !isAuto, args, progress); } // If we get here and the compare type was XML, then both // inputs parsed correctly, and both lists should be non-null. // If we get here and the compare type was Auto, then one // or both lists may be null, so we'll fallthrough to the text // handling logic. } if (af == null || bf == null) { af = new FileContentInfo(); bf = new FileContentInfo(); af.Lines = DiffUtility.GetStringTextLines(textA, progress); bf.Lines = DiffUtility.GetStringTextLines(textB, progress); } af.TextContent = textA; bf.TextContent = textB; DiffBinaryTextResults result = new DiffBinaryTextResults(CompareType.Text, af, bf); return(result); }