Exemplo n.º 1
0
            private void SetupNode()
            {
                if (Left == null)
                {
                    Text = String.Format(Properties.Resources.DiffPacketsControl_NodeAdded, FormatNode(Right));

                    Mode = DiffRange.DiffType.Added;
                }
                else if (Right == null)
                {
                    Text = String.Format(Properties.Resources.DiffPacketsControl_NodeDeleted, FormatNode(Left));
                    Mode = DiffRange.DiffType.Deleted;
                }
                else
                {
                    Text = String.Format(Properties.Resources.DiffPacketsControl_NodeModified, FormatNode(Left), FormatNode(Right));
                    Mode = DiffRange.DiffType.Modified;

                    if (!IsBasic)
                    {
                        // This is just so we can handle expanding nodes on demand
                        Nodes.Add(new TreeNode("dummy"));
                    }
                }

                BackColor = DiffRange.GetColor(Mode);
            }
Exemplo n.º 2
0
        private void CompleteDifferences()
        {
            // This is probably redundant but might as well be sure
            if ((_bytediffs.Length == 0) && (_linediffs.Length == 0))
            {
                MessageBox.Show(this, Properties.Resources.BinaryFrameDiffControl_NoDifferenceFound,
                                Properties.Resources.BinaryFrameDiffControl_NoDifferenceFoundCaption,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                toolStripLabelInfo.Text = String.Format(Properties.Resources.BinaryFrameDiffControl_LabelFormat, 0, 0);
            }
            else
            {
                foreach (DiffRange range in _bytediffs)
                {
                    if (range.LeftLength > 0)
                    {
                        hexEditorControlLeft.AddAnnotation(range.LeftStartPos, range.LeftStartPos + range.LeftLength - 1, Color.Black, DiffRange.GetColor(range.LeftType));
                    }

                    if (range.RightLength > 0)
                    {
                        hexEditorControlRight.AddAnnotation(range.RightStartPos, range.RightStartPos + range.RightLength - 1, Color.Black, DiffRange.GetColor(range.RightType));
                    }
                }

                foreach (DiffRange range in _linediffs)
                {
                    if (range.LeftLength > 0)
                    {
                        for (int i = 0; i < range.LeftLength; ++i)
                        {
                            ColorLine(richTextBoxLeft, (int)range.LeftStartPos + i, DiffRange.GetColor(range.LeftType));
                        }
                    }

                    if (range.RightLength > 0)
                    {
                        for (int i = 0; i < range.RightLength; ++i)
                        {
                            ColorLine(richTextBoxRight, (int)range.RightStartPos + i, DiffRange.GetColor(range.RightType));
                        }
                    }
                }

                SetDifference(0);
            }
        }