Exemplo n.º 1
0
        public DiffForm(InfoPanel info, ulong whoID, string what, StorageFile file, bool history)
        {
            InitializeComponent();

            Core          = info.ParentView.Core;
            Info          = info;
            Target        = file;
            TargetID      = whoID;
            TargetHistory = history;

            Text = Target.Name + " Differences";

            // set what txt
            // my/ben's Changes
            // my/ben's Integrated Changes
            // my/ben's History from <date>

            string who = (whoID == Core.UserID) ? "My" : (Core.GetName(whoID) + "'s");

            WhatLabel.Text = who + " " + what;


            // local
            if (!info.CurrentFile.Temp)
            {
                if (Utilities.MemCompare(Target.InternalHash, ((StorageFile)Info.CurrentFile.Details).InternalHash))
                {
                    LocalNote.Text = "Identical";
                }
            }
            else
            {
                CurrentRadio.Enabled = false;
            }

            // changes
            foreach (ChangeRow change in Info.SortChanges(Info.CurrentChanges))
            {
                ChangesCombo.Items.Add(new ComboFileItem(this, change.ID, (StorageFile)change.Item));
            }

            if (ChangesCombo.Items.Count > 0)
            {
                ChangesCombo.SelectedIndex = 0;
            }
            else
            {
                ChangesRadio.Enabled = false;
            }

            // integrated
            foreach (ChangeRow integrated in Info.SortChanges(Info.CurrentIntegrated))
            {
                IntegratedCombo.Items.Add(new ComboFileItem(this, integrated.ID, (StorageFile)integrated.Item));
            }

            if (IntegratedCombo.Items.Count > 0)
            {
                IntegratedCombo.SelectedIndex = 0;
            }
            else
            {
                IntegratedRadio.Enabled = false;
            }

            // history
            info.CurrentFile.Archived.LockReading(delegate()
            {
                foreach (StorageFile item in info.CurrentFile.Archived)
                {
                    HistoryCombo.Items.Add(new ComboFileItem(this, 0, item));
                }
            });

            if (HistoryCombo.Items.Count > 0)
            {
                HistoryCombo.SelectedIndex = 0;
            }
            else
            {
                HistoryRadio.Enabled = false;
            }

            // using
            UsingCombo.Items.Add("WinMerge");
            UsingCombo.Items.Add("Open Seperately");
            UsingCombo.Items.Add("Another Tool...");
            UsingCombo.SelectedIndex = 0;
        }
Exemplo n.º 2
0
        public DiffForm(InfoPanel info, ulong whoID, string what, StorageFile file, bool history)
        {
            InitializeComponent();

            Core = info.ParentView.Core;
            Info = info;
            Target = file;
            TargetID = whoID;
            TargetHistory = history;

            Text = Target.Name + " Differences";

            // set what txt
                // my/ben's Changes
                // my/ben's Integrated Changes
                // my/ben's History from <date>

            string who = (whoID == Core.UserID) ? "My" : (Core.GetName(whoID) + "'s");

            WhatLabel.Text = who + " " + what;

            // local
            if (!info.CurrentFile.Temp)
            {
                if (Utilities.MemCompare(Target.InternalHash, ((StorageFile)Info.CurrentFile.Details).InternalHash))
                    LocalNote.Text = "Identical";
            }
            else
                CurrentRadio.Enabled = false;

            // changes
            foreach (ChangeRow change in Info.SortChanges(Info.CurrentChanges))
                ChangesCombo.Items.Add(new ComboFileItem(this, change.ID, (StorageFile) change.Item));

            if (ChangesCombo.Items.Count > 0)
                ChangesCombo.SelectedIndex = 0;
            else
                ChangesRadio.Enabled = false;

            // integrated
            foreach (ChangeRow integrated in Info.SortChanges(Info.CurrentIntegrated))
                IntegratedCombo.Items.Add(new ComboFileItem(this, integrated.ID, (StorageFile)integrated.Item));

            if (IntegratedCombo.Items.Count > 0)
                IntegratedCombo.SelectedIndex = 0;
            else
                IntegratedRadio.Enabled = false;

            // history
            info.CurrentFile.Archived.LockReading(delegate()
            {
                foreach (StorageFile item in info.CurrentFile.Archived)
                    HistoryCombo.Items.Add(new ComboFileItem(this, 0, item));
            });

            if (HistoryCombo.Items.Count > 0)
                HistoryCombo.SelectedIndex = 0;
            else
                HistoryRadio.Enabled = false;

            // using
            UsingCombo.Items.Add("WinMerge");
            UsingCombo.Items.Add("Open Seperately");
            UsingCombo.Items.Add("Another Tool...");
            UsingCombo.SelectedIndex = 0;
        }