예제 #1
0
        internal static void OpenSolutionWithWorkspace(Workspace workspace, string serverItem, VersionSpec spec)
        {
            serverItem = VersionControlPath.GetFullPath(serverItem);
            WorkingFolder folderForServerItem1;

            try
            {
                folderForServerItem1 = workspace.TryGetWorkingFolderForServerItem(serverItem);
            }
            catch (Exception ex)
            {
                Output.Exception(ex);
                return;
            }
            if (folderForServerItem1 != null)
            {
                if (folderForServerItem1.IsCloaked)
                {
                    int num1 = (int)Error(UIHost.DefaultParentWindow, GuiResources.Format("SolutionIsCloaked", (object)VersionControlPath.GetFileName(serverItem)), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                else
                {
                    try
                    {
                        VssProvider.OpenFromSCC(serverItem, FileSpec.GetDirectoryName(folderForServerItem1.LocalItem), spec.DisplayString, VersionControlOpenFromSccOverwrite.openscc_open_local_version);
                    }
                    catch (Exception ex)
                    {
                        Output.Exception(ex);
                    }
                }
            }
            else
            {
                string folderName = VersionControlPath.GetFolderName(serverItem);
                using (var dialogSetLocalFolder = (Form)TeamControlFactory.CreateDialogSetLocalFolder(workspace, folderName))
                {
                    if (UIHost.ShowModalDialog((Form)dialogSetLocalFolder) != DialogResult.OK)
                    {
                        return;
                    }
                }
                try
                {
                    WorkingFolder folderForServerItem2 = workspace.GetWorkingFolderForServerItem(serverItem);
                    VssProvider.OpenFromSCC(serverItem, FileSpec.GetDirectoryName(folderForServerItem2.LocalItem), spec.DisplayString, VersionControlOpenFromSccOverwrite.openscc_open_local_version);
                }
                catch (Exception ex)
                {
                    Output.Exception(ex);
                }
            }
        }
        internal static string GetOriginalName(PendingChange pendingChange, bool useServerPath)
        {
            string x        = null;
            var    itemName = GetItemName(pendingChange, useServerPath);

            if (!string.IsNullOrEmpty(pendingChange.SourceLocalItem) && !string.IsNullOrEmpty(pendingChange.LocalItem))
            {
                x = FileSpec.GetFileName(pendingChange.SourceLocalItem);
                if (
                    !FileSpec.Equals(FileSpec.GetDirectoryName(pendingChange.SourceLocalItem),
                                     FileSpec.GetDirectoryName(pendingChange.LocalItem)))
                {
                    x = pendingChange.SourceLocalItem;
                }
                if (string.Equals(x, itemName, StringComparison.Ordinal))
                {
                    x = null;
                }
            }
            if (x == null && !string.IsNullOrEmpty(pendingChange.SourceServerItem) &&
                !string.IsNullOrEmpty(pendingChange.ServerItem))
            {
                x = VersionControlPath.GetFileName(pendingChange.SourceServerItem);
                if (
                    !VersionControlPath.Equals(VersionControlPath.GetFolderName(pendingChange.SourceServerItem),
                                               VersionControlPath.GetFolderName(pendingChange.ServerItem)))
                {
                    x = pendingChange.SourceServerItem;
                }
                if (string.Equals(x, itemName, StringComparison.Ordinal))
                {
                    x = null;
                }
            }
            return(x);
        }