Beispiel #1
0
        internal static void FormatLock(Area ws, RemoteLock x, bool showGUIDs, Dictionary <string, string> remoteMap, int?index)
        {
            string lockPath = x.LockingPath;

            if (string.IsNullOrEmpty(lockPath) || lockPath == "/")
            {
                lockPath = "<full vault>";
            }
            string branch = "<all branches>";

            if (x.LockedBranch.HasValue)
            {
                var branchLocal = ws.GetBranch(x.LockedBranch.Value);
                if (branchLocal == null)
                {
                    branch = x.LockedBranch.Value.ToString();
                }
                else
                {
                    branch = branchLocal.ShortID + " (" + branchLocal.Name + ")";
                }
            }
            string guid = string.Empty;

            if (showGUIDs)
            {
                guid = "\n\t#q#" + x.ID;
            }
            string remote = x.RemoteHost;
            string fname;

            if (!remoteMap.TryGetValue(remote, out fname))
            {
                var cachedRemote = ws.FindRemoteFromURL(remote);
                if (cachedRemote == null)
                {
                    fname = string.Empty;
                }
                else
                {
                    fname = " (" + cachedRemote.Name + ")";
                }
                remoteMap[remote] = fname;
            }
            remote += fname;
            string prefix = "=";

            if (index.HasValue)
            {
                prefix = string.Format("#s#\\#{0}##:", index.Value);
            }
            Printer.PrintMessage(" {0} #b#{1}##, branch #c#{2}## on #b#{3}##{4}", prefix, lockPath, branch, remote, guid);
        }
 public IList <AccessCard> Resolve(RemoteLockAddParams source, RemoteLock destination, IList <AccessCard> destMember, ResolutionContext context)
 {
     return(source.AllowedAccessCardIds
            .Select(id => cardRepository.GetById(id))
            .ToList());
 }