コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Path"></param>
        private void SelectedNodeChanged(string Path)
        {
            SourceManifestDeltaTree.SelectPath(Path);
            DestinationManifestDeltaTree.SelectPath(Path);

            UpdateStats();
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        private void UpdateDiff()
        {
            if (DiffGenerated)
            {
                return;
            }

            BuildManifest SourceManifest      = Program.BuildRegistry.GetManifestById(SourceManifestId);
            BuildManifest DestinationManifest = Program.BuildRegistry.GetManifestById(DestinationManifestId);

            if (SourceManifest == null || DestinationManifest == null)
            {
                if (!RequestedManifests)
                {
                    Program.NetClient.RequestManifest(SourceManifestId);
                    Program.NetClient.RequestManifest(DestinationManifestId);

                    RequestedManifests = true;
                }

                return;
            }

            int  MatchingFiles      = 0;
            long MatchingFilesSize  = 0;
            int  MatchingBlocks     = 0;
            long MatchingBlocksSize = 0;

            HashSet <string> FileHashes  = new HashSet <string>();
            HashSet <uint>   BlockHashes = new HashSet <uint>();

            foreach (BuildManifestFileInfo File in SourceManifest.GetFiles())
            {
                FileHashes.Add(File.Checksum);
            }

            for (int i = 0; i < SourceManifest.BlockCount; i++)
            {
                BlockHashes.Add(SourceManifest.GetBlockChecksum(i));
            }

            foreach (BuildManifestFileInfo File in DestinationManifest.GetFiles())
            {
                if (FileHashes.Contains(File.Checksum))
                {
                    MatchingFiles++;
                    MatchingFilesSize += File.Size;
                }
            }

            for (int i = 0; i < DestinationManifest.BlockCount; i++)
            {
                if (BlockHashes.Contains(DestinationManifest.GetBlockChecksum(i)))
                {
                    BuildManifestBlockInfo Info = new BuildManifestBlockInfo();
                    if (DestinationManifest.GetBlockInfo(i, ref Info))
                    {
                        MatchingBlocks++;
                        MatchingBlocksSize += Info.TotalSize;
                    }
                }
            }

            // Show manifest info.
            manifestSizeLabel.Text = string.Format("{0} (Delta {1})",
                                                   StringUtils.FormatAsSize(DestinationManifest.GetTotalSize()),
                                                   StringUtils.FormatAsSize(DestinationManifest.GetTotalSize() - SourceManifest.GetTotalSize()));

            manifestBlocksLabel.Text = string.Format("{0} (Delta {1})",
                                                     DestinationManifest.BlockCount,
                                                     DestinationManifest.BlockCount - SourceManifest.BlockCount);

            manifestGuidLabel.Text   = SourceManifest.Guid + " / " + DestinationManifest.Guid;
            matchingFilesLabel.Text  = MatchingFiles + " (" + StringUtils.FormatAsSize(MatchingFilesSize) + ")";
            matchingBlocksLabel.Text = MatchingBlocks + " (" + StringUtils.FormatAsSize(MatchingBlocksSize) + ")";

            // Generate diffs.
            List <BuildManifestFileDiff> SourceDiff = SourceManifest.Diff(null);

            SourceManifestDeltaTree.ApplyDiff(SourceManifest, SourceDiff);

            List <BuildManifestFileDiff> DestinationDiff = SourceManifest.Diff(DestinationManifest);

            DestinationManifestDeltaTree.ApplyDiff(DestinationManifest, DestinationDiff);

            DiffGenerated = true;
            UpdateStats();
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Path"></param>
 private void NodeCollapsed(string Path)
 {
     SourceManifestDeltaTree.CollapseNode(Path);
     DestinationManifestDeltaTree.CollapseNode(Path);
 }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Path"></param>
 private void NodeExpanded(string Path)
 {
     SourceManifestDeltaTree.ExpandNode(Path);
     DestinationManifestDeltaTree.ExpandNode(Path);
 }