public void Connect(ClientOption ops) { lock (m_generalLock) { if (IsConnectionAlive()) { return; } } if (ops == null) { ops = ClientOption.defaultClientOps; } if (ops.callBackObj == null) { throw new NullReferenceException("callBackObj is null!"); } lock (m_generalLock) { m_clientOps = ops; } Start(); }
private void button1_Click(object sender, EventArgs e) { //// if (this.dataGridView1.SelectedRows.Count == 0) { return; } string id = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); ClientOption client = chooser.GetClientOptionById(id); if (client == null) { Console.WriteLine("ClienChoose null"); return; } PreLoader pre = new PreLoader(); pre.Initialize(client.Process); this.timer1.Enabled = false; this.Hide(); var MainForm = new MainForm(); MainForm.Closed += (s, args) => this.Close(); MainForm.Text = "MediviaBot - " + client.CharName; MainForm.Show(); }
public ConsumerContext(string hostAddress, ClientOption clientOption, Message message, Message <byte[]> transportMessage) { HostAddress = hostAddress; ClientOption = clientOption; Message = message; TransportMessage = transportMessage; }
public void op_ImplicitTest2() { ClientOption v = ClientOption.Clobber | ClientOption.Locked | ClientOption.RmDir; ClientOptionEnum expected = new ClientOptionEnum(ClientOption.Clobber | ClientOption.Locked | ClientOption.RmDir); ClientOptionEnum actual; actual = v; Assert.AreEqual(expected, actual); v = actual; Assert.AreEqual(ClientOption.Clobber | ClientOption.Locked | ClientOption.RmDir, v); }
/// <summary> /// 创建订阅者 /// </summary> /// <param name="clientOption"></param> /// <returns></returns> public IConsumerClient Create(ClientOption clientOption) { try { _channelPoolCollection.TryGetValue(clientOption.Name, out IChannelPool pool); ConsumerClient client = new ConsumerClient(clientOption, pool, _rabbitMQOptions.Options.First(a => a.Name == clientOption.Name)); client.Connect(); return(client); } catch (System.Exception e) { throw new BrokerConnectionException(e); } }
public NetClientP2p(ClientOption clientOption, ILoggerFactory loggerFactory = null) : base(clientOption, loggerFactory) { if (clientOption.IsServiceUdp == false) { throw new Exception("Must set true to ClientOption.IsServiceUdp."); } OnP2pReceived = OnP2pReceive; OnViewRequestReceived = OnViewRequestReceiveEx; _views = new NetViews(); _zeroDataWriter = new NetDataWriter(false, 1); _readerForSendInternal = new NetDataReader(); }
public void TestOperation() { ClientOption option = new ClientOption(2000); option.AddMasterAddr(new Address("127.0.0.1", 20000)); IKVClient client = new KVClient(option); try { for (byte i = 0; i < 100; i++) { client.Set(new byte[] { i }, new byte[] { i }); } for (byte i = 0; i < 100; i += 2) { client.Delete(new byte[] { i }); } for (byte i = 0; i < 100; i++) { byte[] value = client.Get(new byte[] { i }); if (i % 2 != 0) { CollectionAssert.AreEqual(value, new byte[] { i }); } else { Assert.IsNull(value); } } client.Incr(new byte[] { 100 }, 0, 10); Assert.AreEqual(client.GetCounter(new byte[] { 100 }), 10); DataServerStruct[] dataServers = client.Stat(); formatStat(dataServers); } catch (Exception e) { Console.WriteLine(e.StackTrace); } }
private void BuildClientOptionMap(Map <string, Option> options) { this.m_clientOptionMap = new Map <Option, string>(); IEnumerator enumerator = Enum.GetValues(typeof(ClientOption)).GetEnumerator(); try { while (enumerator.MoveNext()) { ClientOption current = (ClientOption)((int)enumerator.Current); if (current != ClientOption.INVALID) { Option option2; string key = current.ToString(); if (!options.TryGetValue(key, out option2)) { Debug.LogError(string.Format("Options.BuildClientOptionMap() - ClientOption {0} is not mirrored in the Option enum", current)); } else { System.Type type; if (!OptionDataTables.s_typeMap.TryGetValue(option2, out type)) { Debug.LogError(string.Format("Options.BuildClientOptionMap() - ClientOption {0} has no type. Please add its type to the type map.", current)); continue; } string str2 = EnumUtils.GetString <Option>(option2); this.m_clientOptionMap.Add(option2, str2); } } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } }
public NatClient(ClientOption clientOption) : base(new NatReceiveFilter()) { InitOption(clientOption); }
public AsyncTcpClient(AsyncTcpClient b) : base(b) { m_clientOps = b.m_clientOps; }
public SocketBuffer(IMassageHandle msghandle, ClientOption option) { this.msgHandle = msghandle; this.option = option; }
public ExceptionConsumerContext(string hostAddress, ClientOption clientOption, Message message, Message <byte[]> transportMessage, Exception exception) : base(hostAddress, clientOption, message, transportMessage) => Exception = exception;
public TcpClientProxy(ClientOption clientOption) : base(null)//不需要过滤器,原样转发 { InitOption(clientOption); }
/// <summary> /// 이 함수를 오버라이딩하여 옵션을 수정할 수 있음. /// </summary> /// <param name="clientOption"></param> protected virtual void SetClientOption(ClientOption clientOption) { SetClientOptionFunc?.Invoke(clientOption); }
private InteropClient(ClientOption options) { this._options = options; }
ISocketResult IMassageHandle.Handle(SocketPackage package, ClientOption option) { NormalResult result = ""; return(result); }
public ConsumerClient(ClientOption clientOption, IChannelPool channelPool, RabbitMQOption options) { _clientOption = clientOption; _channelPool = channelPool; _rabbitMQOptions = options; }
public ConfigAvailableClient ToConfigAvailableClient(ClientRegister msg) { var res = new ConfigAvailableClient { Icon = msg.Icon, Id = Id, Modifications = new List <ConfigAvailableModification>(), Options = new List <ClientOption>() }; if (msg.Options != null) { foreach (var o in msg.Options) { var tmp = new ClientOption { Default = o.Default, Description = o.Description, Id = o.Id, NumType = o.NumType, ValidValues = o.ValidValues, Value = o.Default }; if (Options.TryGetValue(o.Id, out var val)) { switch (val) { case bool b: tmp.Value = b; break; case decimal d: tmp.Value = d; break; case string s: tmp.Value = s; break; } } res.Options.Add(tmp); } } if (msg.Modifications == null) { return(res); } foreach (var mod in Modifications) { var registerMod = msg.Modifications.Find(m => m.Name == mod.Key); if (registerMod == null) { continue; } var tmpMod = new ConfigAvailableModification { CustomDescription = mod.Value.CustomDescription, CustomMaxLength = mod.Value.CustomMaxLength, CustomMinLength = mod.Value.CustomMinLength, Description = registerMod.Description, Enabled = mod.Value.Enabled, Icon = registerMod.Icon, MaxLength = Math.Min(registerMod.MaxLength ?? 120, 120), Name = registerMod.Name, Options = new List <ClientOption>(), Tooltip = mod.Value.Tooltip, }; if (registerMod.Options != null) { foreach (var option in registerMod.Options) { var tmpCO = new ClientOption { Default = option.Default, Description = option.Description, Id = option.Id, NumType = option.NumType, ValidValues = option.ValidValues, Value = option.Default }; if (mod.Value.Options.TryGetValue(option.Id, out var val)) { switch (val) { case bool b: tmpCO.Value = b; break; case decimal d: tmpCO.Value = d; break; case string s: tmpCO.Value = s; break; } } tmpMod.Options.Add(tmpCO); } } res.Modifications.Add(tmpMod); } return(res); }