Ejemplo n.º 1
0
        public ErrorItem(LockMessage parent, LockError error)
        {
            Error = error;

            ImageIndex = parent.GetImageIndex(error);
            Text = error.Path.Replace(parent.RootPath, "");

            if (error.Message.Length > 0)
                Text += " (" + error.Message + ")";
        }
Ejemplo n.º 2
0
        public ErrorItem(LockMessage parent, LockError error)
        {
            Error = error;

            ImageIndex = parent.GetImageIndex(error);
            Text       = error.Path.Replace(parent.RootPath, "");

            if (error.Message.Length > 0)
            {
                Text += " (" + error.Message + ")";
            }
        }
Ejemplo n.º 3
0
        public static void Alert(StorageView view, List <LockError> errors)
        {
            if (errors.Count == 0)
            {
                return;
            }

            List <LockError> temps   = new List <LockError>();
            List <LockError> blocked = new List <LockError>();

            List <LockError> unexpected = new List <LockError>();
            List <LockError> existing   = new List <LockError>();
            List <LockError> missing    = new List <LockError>();


            foreach (LockError error in errors)
            {
                switch (error.Type)
                {
                case LockErrorType.Temp:
                    temps.Add(error);
                    break;

                case LockErrorType.Blocked:
                    blocked.Add(error);
                    break;

                case LockErrorType.Unexpected:
                    unexpected.Add(error);
                    break;

                case LockErrorType.Existing:
                    existing.Add(error);
                    break;

                case LockErrorType.Missing:
                    missing.Add(error);
                    break;
                }
            }


            LockMessage message = null;

            while (temps.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Temp, temps);
                message.ShowDialog(view);
                temps = message.NewErrors;
            }

            while (blocked.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Blocked, blocked);
                message.ShowDialog(view);
                blocked = message.NewErrors;
            }

            while (unexpected.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Unexpected, unexpected);
                message.ShowDialog(view);
                unexpected = message.NewErrors;
            }

            while (existing.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Existing, existing);
                message.ShowDialog(view);
                existing = message.NewErrors;
            }

            while (missing.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Missing, missing);
                message.ShowDialog(view);
                missing = message.NewErrors;
            }
        }
Ejemplo n.º 4
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            // get selected file / id
            StorageFile selected        = null;
            ulong       selectedID      = 0;
            bool        selectedHistory = false;
            string      selectedText    = "";

            if (CurrentRadio.Checked)
            {
                selected     = (StorageFile)Info.CurrentFile.Details;
                selectedID   = Info.ParentView.UserID;
                selectedText = "Current";
            }

            if (ChangesRadio.Checked)
            {
                ComboFileItem item = (ComboFileItem)ChangesCombo.SelectedItem;

                selected     = item.File;
                selectedID   = item.ID;
                selectedText = "Changes";
            }

            if (IntegratedRadio.Checked)
            {
                ComboFileItem item = (ComboFileItem)IntegratedCombo.SelectedItem;

                selected     = item.File;
                selectedID   = item.ID;
                selectedText = "Integrated Changes";
            }

            if (HistoryRadio.Checked)
            {
                ComboFileItem item = (ComboFileItem)HistoryCombo.SelectedItem;

                selected        = item.File;
                selectedID      = Info.ParentView.UserID;
                selectedHistory = HistoryCombo.SelectedIndex != 0;
                selectedText    = "History from " + item.File.Date.ToLocalTime().ToString();
            }

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

            selectedText = who + selectedText;

            if (selected == null)
            {
                MessageBox.Show("No file Selected to Compare to");
                return;
            }

            // unlock files
            List <LockError> errors = new List <LockError>();

            Cursor = Cursors.WaitCursor;
            string fileA = Info.Storages.UnlockFile(TargetID, Info.ParentView.ProjectID, Info.CurrentFolder.GetPath(), Target, TargetHistory, errors);

            string fileB = Info.Storages.UnlockFile(selectedID, Info.ParentView.ProjectID, Info.CurrentFolder.GetPath(), selected, selectedHistory, errors);

            Cursor = Cursors.Default;

            if (errors.Count > 0)
            {
                LockMessage.Alert(Info.ParentView, errors);
                return;
            }

            if (UsingCombo.Text == "WinMerge")
            {
                // /e close with esc
                // /ub dont add to MRU
                // /wl left side read only
                // /wr right side read only (only NOT if local dht/not history etc..)
                // /dl left side desc, target info
                // /dr right side desc, current file info

                if (!File.Exists("C:\\Program files\\WinMerge\\WinMerge.exe"))
                {
                    MessageBox.Show("Can't find WinMerge");
                    return;
                }

                string arguments = "/e /ub ";
                arguments += "/dl \"" + WhatLabel.Text + "\" ";
                arguments += "/dr \"" + selectedText + "\" ";

                if (TargetID != Core.UserID || TargetHistory)
                {
                    arguments += "/wl ";
                }
                if (selectedID != Core.UserID || selectedHistory)
                {
                    arguments += "/wr ";
                }

                arguments += "\"" + fileA + "\" ";
                arguments += "\"" + fileB + "\" ";

                Process.Start("C:\\Program files\\WinMerge\\WinMerge.exe", arguments);
            }

            if (UsingCombo.Text == "Open Seperately")
            {
                // open
                if (fileA != null && File.Exists(fileA))
                {
                    System.Diagnostics.Process.Start(fileA);
                }

                if (fileB != null && File.Exists(fileB))
                {
                    System.Diagnostics.Process.Start(fileB);
                }


                Info.CurrentFile.UpdateInterface();
                Info.RefreshItem();
            }

            if (UsingCombo.Text == "Another Tool...")
            {
            }


            // if success
            Close();
        }
Ejemplo n.º 5
0
        public static void Alert(StorageView view, List<LockError> errors)
        {
            if (errors.Count == 0)
                return;

            List<LockError> temps = new List<LockError>();
            List<LockError> blocked = new List<LockError>();

            List<LockError> unexpected = new List<LockError>();
            List<LockError> existing = new List<LockError>();
            List<LockError> missing = new List<LockError>();

            foreach (LockError error in errors)
                switch (error.Type)
                {
                    case LockErrorType.Temp:
                        temps.Add(error);
                        break;

                    case LockErrorType.Blocked:
                        blocked.Add(error);
                        break;

                    case LockErrorType.Unexpected:
                        unexpected.Add(error);
                        break;

                    case LockErrorType.Existing:
                        existing.Add(error);
                        break;

                    case LockErrorType.Missing:
                        missing.Add(error);
                        break;
                }

            LockMessage message = null;

            while (temps.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Temp, temps);
                message.ShowDialog(view);
                temps = message.NewErrors;
            }

            while (blocked.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Blocked, blocked);
                message.ShowDialog(view);
                blocked = message.NewErrors;
            }

            while (unexpected.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Unexpected, unexpected);
                message.ShowDialog(view);
                unexpected = message.NewErrors;
            }

            while (existing.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Existing, existing);
                message.ShowDialog(view);
                existing = message.NewErrors;
            }

            while (missing.Count > 0)
            {
                message = new LockMessage(view, LockErrorType.Missing, missing);
                message.ShowDialog(view);
                missing = message.NewErrors;
            }
        }