public CodeDiffer() { // instantiate the object var fileSystemWatcher = new FileSystemWatcher(); // Associate event handlers with the events fileSystemWatcher.Created += FileSystemWatcher_Created; fileSystemWatcher.Changed += FileSystemWatcher_Changed; fileSystemWatcher.Deleted += FileSystemWatcher_Deleted; fileSystemWatcher.Renamed += FileSystemWatcher_Renamed; // tell the watcher where to look fileSystemWatcher.Path = PATH_TO_WATCH; // You must add this line - this allows events to fire. fileSystemWatcher.EnableRaisingEvents = true; StoreNewVersion(); session = new CodePlayer.Session("csharp", GetNewVersionPath()); diffBuilder = new SideBySideDiffBuilder(differ); GenerateSessionJson(); }
public SauceryController() { InitiateSSLTrust(); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; diffBuilder = new SideBySideDiffBuilder(new Differ()); }
public DocumentCompareInfo(string oldText, string newText, string originalHtml) { this._oldText = oldText; this._newText = newText; this._originalHtml = originalHtml; this.diffBuilder = new InlineDiffBuilder(new Differ()); this.sideDiffBuilder = new SideBySideDiffBuilder(new Differ()); }
public ArticlesController(UserManager <User> userManager, ApplicationDbContext dbContext, IDateTimeService dateTimeService, ISearchService searchService, IVoteService voteService, ISideBySideDiffBuilder diffBuilder, ILoggerFactory loggerFactory) { _userManager = userManager; _dbContext = dbContext; _dateTimeService = dateTimeService; _searchService = searchService; _voteService = voteService; _diffBuilder = diffBuilder; _logger = loggerFactory.CreateLogger <ArticlesController>(); }
public FormDiff(string OldFile, string NewFile, bool AllowUpdates) { InitializeComponent(); m_FileSideOld = OldFile; m_FileSideNew = NewFile; m_AllowUpdates = AllowUpdates; m_DiffBuilder = new SideBySideDiffBuilder(new DiffPlex.Differ()); richTextBoxSide1.Font = new Font(FontFamily.GenericMonospace, richTextBoxSide1.Font.Size); richTextBoxSide1.WordWrap = false; richTextBoxSide1.ScrollBars = RichTextBoxScrollBars.Vertical; richTextBoxSide1.VScroll += Side1_VScroll; richTextBoxSide2.Font = richTextBoxSide1.Font; richTextBoxSide2.WordWrap = richTextBoxSide1.WordWrap; richTextBoxSide2.ScrollBars = richTextBoxSide1.ScrollBars; richTextBoxSide2.VScroll += Side2_VScroll; }
private static void PrintToHtml(Product product1, ISideBySideDiffBuilder diffBuilder, Product product2) { foreach (var key in product1.SpecDic.Keys) { //var diffResult = differ.CreateCharacterDiffs(product1.SpecDic[key].Value, product2.SpecDic[key].Value,true); var result = diffBuilder.BuildDiffModel(product1.SpecDic[key].Value, product2.SpecDic[key].Value); foreach (var line in result.OldText.Lines) { if (line.Type == ChangeType.Unchanged) { Console.Write(line.Text); } else { foreach (var piece in line.SubPieces) { if (piece.Type == ChangeType.Unchanged) { Console.Write(piece.Text); } else { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.Write(piece.Text); Console.ForegroundColor = color; } } } } Console.Write(" - "); foreach (var line in result.NewText.Lines) { if (line.Type == ChangeType.Unchanged) { Console.Write(line.Text); } else { foreach (var piece in line.SubPieces) { if (piece.Type == ChangeType.Unchanged) { Console.Write(piece.Text); } else { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.Write(piece.Text); Console.ForegroundColor = color; } } } } Console.WriteLine(); //foreach (var block in result.) //{ // diffResult.DiffBlocks[0]. //} } }
private static void PrintToConsole(Product product1, ISideBySideDiffBuilder diffBuilder, Product product2) { foreach (var key in product1.SpecDic.Keys) { //var diffResult = differ.CreateCharacterDiffs(product1.SpecDic[key].Value, product2.SpecDic[key].Value,true); var result = diffBuilder.BuildDiffModel(product1.SpecDic[key].Value, product2.SpecDic[key].Value); foreach (var line in result.OldText.Lines) { if (line.Type == ChangeType.Unchanged) { Console.Write(line.Text); } else { foreach (var piece in line.SubPieces) { if (piece.Type == ChangeType.Unchanged) { Console.Write(piece.Text); } else { foreach (var character in piece.SubPieces) { if (character.Type == ChangeType.Unchanged) { Console.Write(character.Text); } else { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.Write(character.Text); Console.ForegroundColor = color; } } } } } } Console.Write(" - "); foreach (var line in result.NewText.Lines) { if (line.Type == ChangeType.Unchanged) { Console.Write(line.Text); } else { foreach (var piece in line.SubPieces) { if (piece.Type == ChangeType.Unchanged) { Console.Write(piece.Text); } else { foreach (var character in piece.SubPieces) { if (character.Type == ChangeType.Unchanged) { Console.Write(character.Text); } else { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.Write(character.Text); Console.ForegroundColor = color; } } } } } } // line diff comment if (result.OldText.Lines[0].Type != ChangeType.Unchanged) { string old= result.OldText.Lines[0].Text; int oldNum; Match match = numberReg.Match(old); if (int.TryParse(match.Groups[0].Value, out oldNum)) { int newNum; if (int.TryParse(numberReg.Match(result.NewText.Lines[0].Text).Groups[0].Value, out newNum)) { int diff = newNum - oldNum; string lastStr = old.Substring(match.Groups[0].Index + match.Groups[0].Length); Console.Write(" - {0} {1}{2}",diff>0?"<":">",Math.Abs(diff),lastStr); } } } Console.WriteLine(); //foreach (var block in result.) //{ // diffResult.DiffBlocks[0]. //} } }
public DiffController() { diffBuilder = new SideBySideDiffBuilder(new Differ()); }
public DiffController(ISideBySideDiffBuilder bidiffBuilder) { diffBuilder = bidiffBuilder; }
public Detector(MailConfiguration mailConfiguration) { _emailReporter = new EmailReporter(mailConfiguration); _differ = new Differ(); _sideBySideDiffBuilder = new SideBySideDiffBuilder(_differ); }