/// <summary> /// Remove via key. /// </summary> /// <param name="_computerName"></param> public void Remove(string _computerName, string _UserName) { for (int i = 0; i < m_proxyList.Count; i++) { ProxyStruct aProxy = m_proxyList[i]; if ((aProxy.m_computerName == _computerName) && (aProxy.UserName == _UserName)) { m_proxyList.RemoveAt(i); return; } } }
/// <summary> /// Add a new one. /// If already here does not add duplicate. /// </summary> /// <param name="newProxy"></param> public void Add(ProxyStruct newProxy) { for (int i = 0; i < m_proxyList.Count; i++) { ProxyStruct aProxy = m_proxyList[i]; if ((aProxy.m_computerName == newProxy.m_computerName) && (aProxy.UserName == newProxy.UserName)) { return; } } m_proxyList.Add(newProxy); }
/// <summary> /// Get proxy with key. /// </summary> /// <param name="_computerName"></param> /// <param name="_userName"></param> /// <returns></returns> public ITesterObjectCallback Get(string _computerName, string _userName) { for (int i = 0; i < m_proxyList.Count; i++) { ProxyStruct aProxy = m_proxyList[i]; if ((aProxy.m_computerName == _computerName) && (aProxy.UserName == _userName)) { return(aProxy.m_proxy); } } return(null); }
public UInt32 Connect(string userID, string password, string computerName) { UInt32 retVal = (UInt32)ReturnValues.bladeAccessBit; try { ITesterObjectCallback proxy = OperationContext.Current.GetCallbackChannel <ITesterObjectCallback>(); ProxyStruct aProxyStruct = new ProxyStruct(computerName, userID, proxy); // TODO : 这里或许可以将这个list去掉,需要验证 _CallbackProxyList.Add(aProxyStruct); } catch (Exception e) { throw e; } return(retVal); }
public UInt32 Connect(string userID, string password, string computerName) { UInt32 retVal = (UInt32)ReturnValues.bladeAccessBit; try { WriteLine(string.Format("TesterObject::Connect Request from [userID:{0}] [ComputerName:{1}]", userID, computerName)); ITesterObjectCallback proxy = OperationContext.Current.GetCallbackChannel <ITesterObjectCallback>(); ProxyStruct aProxyStruct = new ProxyStruct(computerName, userID, proxy); _CallbackProxyList.Add(aProxyStruct); } catch (Exception e) { WriteLine("TesterObject::Connect Exception: " + makeUpExceptionString(e).ToString()); throw e; } WriteLine(string.Format("TesterObject::Connect Granted to [userID:{0}] [ComputerName:{1}] [retVal:{2}]", userID, computerName, retVal)); return(retVal); }