Exemplo n.º 1
0
 public static bool TryGetDefaultConnectionInfo(
     ConnectionInfoStore store,
     StoredConnectionInfo[] excludedConnections,
     out StoredConnectionInfo connectionInfo)
 {
     return(RemoteTargetUtils.TryGetDefaultConnectionInfo(store, RetrieveMode.All, excludedConnections, out connectionInfo));
 }
Exemplo n.º 2
0
 public static bool TryGetConnectionInfoOrDefault(
     ConnectionInfoStore store,
     string remoteTargetStringOrId,
     out StoredConnectionInfo connectionInfo)
 {
     return(RemoteTargetUtils.TryGetConnectionInfoOrDefault(store, remoteTargetStringOrId, RetrieveMode.All, out connectionInfo));
 }
Exemplo n.º 3
0
        public static bool TryGetConnectionInfoOrDefault(
            ConnectionInfoStore store,
            string remoteTargetStringOrId,
            RetrieveMode mode,
            out StoredConnectionInfo connectionInfo)
        {
            connectionInfo = (StoredConnectionInfo)null;
            if (string.IsNullOrWhiteSpace(remoteTargetStringOrId))
            {
                return(RemoteTargetUtils.TryGetDefaultConnectionInfo(store, mode, new StoredConnectionInfo[0], out connectionInfo));
            }
            RemoteTarget result1 = (RemoteTarget)null;
            int          result2 = -1;

            if (RemoteTargetUtils.TryParseRemoteTarget(remoteTargetStringOrId, out result1))
            {
                if (!store.TryGetById(result1.Id, mode, out connectionInfo))
                {
                    return(false);
                }
            }
            else
            {
                if (!int.TryParse(remoteTargetStringOrId, out result2))
                {
                    return(store.TryGetByName(remoteTargetStringOrId, out connectionInfo));
                }
                if (!store.TryGetById(result2, out connectionInfo))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 4
0
 public static bool TryGetConnectionInfoOrDefault(
     string remoteTargetStringOrId,
     RetrieveMode mode,
     out StoredConnectionInfo connectionInfo)
 {
     return(RemoteTargetUtils.TryGetConnectionInfoOrDefault(new ConnectionInfoStore(), remoteTargetStringOrId, mode, out connectionInfo));
 }
Exemplo n.º 5
0
        public static string ConnectionToDisplayNameShort(StoredConnectionInfo storedConnectionInfo)
        {
            string         platform          = RemoteTargetUtils.ProcessorArchToPlatform(storedConnectionInfo.Properties.Get("Platform"));
            ConnectionInfo connectionInfo    = (ConnectionInfo)storedConnectionInfo;
            string         hostNameOrAddress = connectionInfo.HostNameOrAddress;

            if (!string.IsNullOrEmpty(platform))
            {
                return(string.Format("{0} ({1})", (object)hostNameOrAddress, (object)platform));
            }
            return(hostNameOrAddress);
        }
Exemplo n.º 6
0
 public static bool TryGetDefaultConnectionInfo(
     ConnectionInfoStore store,
     RetrieveMode mode,
     StoredConnectionInfo[] excludedConnections,
     out StoredConnectionInfo connectionInfo)
 {
     connectionInfo = (StoredConnectionInfo)null;
     if (store.Connections.Count == 0)
     {
         return(false);
     }
     StoredConnectionInfo[] connectionsByAddedDate = RemoteTargetUtils.GetAvailableConnectionsByAddedDate(store);
     connectionInfo = store.Connections.Where <StoredConnectionInfo>((Func <StoredConnectionInfo, bool>)(c => !((IEnumerable <StoredConnectionInfo>)excludedConnections).Any <StoredConnectionInfo>((Func <StoredConnectionInfo, bool>)(e => e.Id == c.Id)))).Where <StoredConnectionInfo>((Func <StoredConnectionInfo, bool>)(c => c.LastSuccessful != DateTime.MinValue)).DefaultIfEmpty <StoredConnectionInfo>(((IEnumerable <StoredConnectionInfo>)connectionsByAddedDate).FirstOrDefault <StoredConnectionInfo>()).FirstOrDefault <StoredConnectionInfo>();
     return(connectionInfo != null);
 }
Exemplo n.º 7
0
        public static string ResolveRemoteTargetId(string remoteTargetStringOrId)
        {
            RemoteTarget result1 = (RemoteTarget)null;
            int          result2 = -1;

            if (RemoteTargetUtils.TryParseRemoteTarget(remoteTargetStringOrId, out result1))
            {
                return(result1.Id.ToString());
            }
            if (int.TryParse(remoteTargetStringOrId, out result2))
            {
                return(result2.ToString());
            }
            StoredConnectionInfo connectionInfo = (StoredConnectionInfo)null;

            if (RemoteTargetUtils.TryGetConnectionInfoOrDefault(remoteTargetStringOrId, out connectionInfo))
            {
                return(connectionInfo.Id.ToString());
            }
            return(remoteTargetStringOrId);
        }
Exemplo n.º 8
0
 public static StoredConnectionInfo[] GetAvailableConnectionsByAddedDate()
 {
     return(RemoteTargetUtils.GetAvailableConnectionsByAddedDate(new ConnectionInfoStore()));
 }
Exemplo n.º 9
0
 public static bool TryGetDefaultConnectionInfo(out StoredConnectionInfo connectionInfo)
 {
     return(RemoteTargetUtils.TryGetDefaultConnectionInfo(new ConnectionInfoStore(), RetrieveMode.All, new StoredConnectionInfo[0], out connectionInfo));
 }