private void TreeViewForm_DragDrop(object sender, DragEventArgs e) { var paths = e.Data.GetData(DataFormats.FileDrop) as string[]; if (paths == null || paths.Length == 0) { return; } if (string.IsNullOrEmpty(paths[0])) { return; } if (Path.GetExtension(paths[0]).ToLower() != ".torrent") { return; } if (_torrentQueue.Count >= 2) { _torrentQueue.Dequeue(); } _torrentQueue.Enqueue(new TorrentData(paths[0])); if (_torrentQueue.Count == 2) { treeView1.Nodes.Clear(); var tmp = _torrentQueue.ToArray(); //var ret = ConvertMethod.GetDiffNode(tmp[0], tmp[1]); var ret = ConvertMethod.GetDiffNode(tmp[0], tmp[1]); ret.inANotInB.InsertTo(treeView1.Nodes, KnownColor.PowderBlue); ret.inBNotInA.InsertTo(treeView1.Nodes, KnownColor.PaleVioletRed); } }
public void GetDiffTest() { const string ghost1 = @"..\..\[Torrent Sample]\Ghost in the Shell:STAND ALONE COMPLEX.v1.torrent"; const string ghost2 = @"..\..\[Torrent Sample]\Ghost in the Shell:STAND ALONE COMPLEX.v2.torrent"; var ret = ConvertMethod.GetDiffNode(new TorrentData(ghost1), new TorrentData(ghost2)); Console.WriteLine(@"in a not in b:"); Console.WriteLine(ret.inANotInB.Json); Console.WriteLine(@"in b not in a:"); Console.WriteLine(ret.inBNotInA.Json); }