예제 #1
0
        // Displays change and path information from the ExtendedItem.
        static void DisplayExtendedItem(ExtendedItem item, Workspace workspace)
        {
            Console.Write("  ");

            // Indicate whether someone else has a pending change on this file or folder.  The
            // ExtendedItem doesn't contain the list of users with pending changes on this file.
            // For that information, we'd need to call QueryPendingSets() in addition to
            // GetExtendedItems() and join the two together via the item ID.
            if (item.HasOtherPendingChange)
            {
                Console.Write("^ ");
            }

            // Show the lock information if someone has locked the file or folder.
            if (item.LockStatus != LockLevel.None)
            {
                Console.Write("[{0},{1}] ",
                              PendingChange.GetLocalizedStringForLockLevel(item.LockStatus),
                              item.LockOwner);
            }

            // If there is a change pending on the item in the current workspace, display it.
            if (item.ChangeType != ChangeType.None)
            {
                Console.Write("({0}) ", PendingChange.GetLocalizedStringForChangeType(item.ChangeType));
            }

            // Display the local path.
            if (!item.IsInWorkspace)
            {
                // Get the mapping so that we can determine its local path or that it is cloaked.
                WorkingFolder wf = workspace.TryGetWorkingFolderForServerItem(item.TargetServerItem);

                // Let's skip cloaked items, since the user doesn't want them.
                if (!wf.IsCloaked)
                {
                    Console.WriteLine(wf.LocalItem);
                }
            }
            else
            {
                Console.WriteLine(item.LocalItem);
            }
        }