protected virtual CommandViewItem GetChangedCommand(ICommand source, ICommand target) { var result = new CommandViewItem { CommandKey = this.GetCommandKey(source), CommandName = source.CommandPrefix, LeftCommand = source, RightCommand = target, Database = this.GetCommandDatabase(source) }; string sourceStr = CommandSerializer.Serialize(source); string targetStr = CommandSerializer.Serialize(target); result.Group = String.CompareOrdinal(sourceStr, targetStr) == 0 ? Groups.Unmodified : Groups.Changed; return(result); }
private void commandsView_MouseDoubleClick(object sender, MouseEventArgs e) { CommandViewItem command = null; string path = this.commandsView.SelectedItems[0].SubItems[1].Text; foreach (var cmd in this.data) { if (string.CompareOrdinal(cmd.CommandKey, path) == 0) { command = cmd; break; } } if (command == null) { MessageBox.Show("Command not found... Something is going wrong."); } else { string assemblyPath = Assembly.GetExecutingAssembly().Location; string dumpPath = new FileInfo(assemblyPath).DirectoryName + "\\merge"; if (!Directory.Exists(dumpPath)) { Directory.CreateDirectory(dumpPath); } string sourcePath = dumpPath + "\\source_" + command.CommandKey.GetHashCode() + ".txt"; string targetPath = dumpPath + "\\target_" + command.CommandKey.GetHashCode() + ".txt"; CommandSerializer.Serialize(sourcePath, command.LeftCommand); CommandSerializer.Serialize(targetPath, command.RightCommand); Process.Start("winmergeU.exe", "\"" + sourcePath + "\"" + " " + "\"" + targetPath + "\""); } }