private void ConnectToServer(string ip, int port) { TraceOps.Out("Connect to: " + ip + " : " + port); Services.GetService(ip, port, typeof(ConnectionTable)); Services.GetService(ip, port, typeof(MessageQueue)); _connectionTable = ConnectionTable.GetRemote(ip, port); _messageQueue = MessageQueue.GetRemote(ip, port); _name = HashOps.GetFqdn(); try { foreach (IClientPlugin plugin in _plugins) { plugin.SetForm(this); plugin.SetName(ref _name); plugin.SetQueue(ref _messageQueue); plugin.SetTable(ref _connectionTable); } _networkClient = new NetworkClient(ref _messageQueue, ref _connectionTable, _name); _taskManager = new TaskManager(ref _messageQueue, ref _name); _taskManager.Task += TaskManagerOnTask; if (_plugins != null) { _taskManager.SetListener(_plugins); } } catch (Exception ex) { TraceOps.Out(ex.Message); } }
private void MainServerForm_Load(object sender, EventArgs e) { TraceOps.LoadLog(); try { _name = "Server"; Services.PrepareSetService(_port); Services.SetService(typeof(ConnectionTable)); Services.SetService(typeof(MessageQueue)); _connectionTable = ConnectionTable.GetRemote("localhost", _port); _messageQueue = MessageQueue.GetRemote("localhost", _port); _taskManager = new TaskManager(ref _messageQueue, ref _name); _taskManager.Task += TaskManagerOnTask; var ci = new ConnectionTable.ClientInformation(_name); ci.SetGroup("server"); ci.SetIp(NetworkOps.GetIpString(HashOps.GetFqdn())); ci.SetPort(_port); _connectionTable.Set(_name, ci); LoadClientsTable(); LoadPlugIns(); } catch (Exception ex) { TraceOps.Out(ex.Message); } }
private void Register() { var ci = _connectionTable.Get(_name); //TODO Demo ci.SetApplicationNames(""); ci.SetIp(NetworkOps.GetIpString(HashOps.GetFqdn())); ci.SetPort(9091); _connectionTable.Set(_name, ci); }
public ClientsTableForm(ref IServerPlugin[] plugins, int port) { _plugins = plugins; _port = port; _ip = HashOps.GetFqdn(); InitializeComponent(); handle.MouseDown += handle_MouseDown; handle.MouseMove += handle_MouseMove; handle.MouseUp += handle_MouseUp; LoadPlugIns(); }
/////////////////////////////////////////////////////////////////////// public int GetHashCode( Configuration obj ) { int result = 0; if ((obj != null) && (obj.ProtocolId != null) && (encoding != null)) { result ^= unchecked ((int)HashOps.HashFnv1UInt( encoding.GetBytes(obj.ProtocolId), true)); } if ((obj != null) && (obj.PublicKeyToken != null) && (publicKeyTokenComparer != null)) { result ^= publicKeyTokenComparer.GetHashCode( obj.PublicKeyToken); } if ((obj != null) && (obj.Name != null) && (encoding != null)) { result ^= unchecked ((int)HashOps.HashFnv1UInt( encoding.GetBytes(obj.Name), true)); } if ((obj != null) && (obj.Culture != null) && (cultureInfoComparer != null)) { result ^= cultureInfoComparer.GetHashCode( obj.Culture); } return(result); }
private void notifyIcon_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { var btext = "No network connection"; try { btext = NetworkOps.GetIpString(HashOps.GetFqdn()); } catch (Exception) { btext = "No network connection"; } notifyIcon.ShowBalloonTip(1000, "Pace Configuration", btext, ToolTipIcon.None); } if (e.Button == MouseButtons.Right) { MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic); mi.Invoke(notifyIcon, null); } }
/////////////////////////////////////////////////////////////////////// public int GetHashCode( byte[] obj ) { return(unchecked ((int)HashOps.HashFnv1UInt(obj, true))); }