public void AddClient(Retrofit client) { if (!RetrofitCache.Keys.Contains(client)) { RetrofitCache.Add(client, new List <int>()); } }
public void AddProxy(Retrofit client, int ProxyInterfaceHashCode) { if (!RetrofitCache.Keys.Contains(client)) { throw new UnKnownClientException("未知的Retrofit Client对象"); } List <int> hashCodeList = RetrofitCache[client]; hashCodeList.Add(ProxyInterfaceHashCode); }
public Retrofit GetClient(int ProxyInterfaceHashCode) { Retrofit client = null; foreach (var item in RetrofitCache.Keys) { if (RetrofitCache[item].Contains(ProxyInterfaceHashCode)) { client = item; break; } } if (client == null) { throw new ClientNotFoundException("未找到相关Client信息"); } return(client); }
static RetrofitHelper() { _Retrofit = new Retrofit.Builder() .setUrl("https://localhost:44322") .build(); }