Exemplo n.º 1
0
        void _radminInput_CatchServerInfo(object sender, ServerInfoEventArgs args)
        {
            ListViewItem existItem = null;

            foreach (ListViewItem item in listView.Items)
            {
                ServerInfo si = (ServerInfo)item.Tag;
                if (si.Name == args.ServerInfo.Name)
                {
                    existItem = item;
                    break;
                }
            }
            if (existItem != null)
            {
                UpdateListViewItem(args.ServerInfo, existItem);
            }
            else
            {
                ListViewItem item = CreateListViewItem(args.ServerInfo);
                listView.Items.Add(item);
            }

            Global.SystemConfig.ServerList[args.ServerInfo.Name] = args.ServerInfo;

            SaveConfig();
        }
Exemplo n.º 2
0
 protected void OnServerInfoUpdated(object sender, ServerInfoEventArgs e)
 {
     if (ServerInfoUpdated != null)
     {
         ServerInfoUpdated(sender, e);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Override this to add logic when clients request server's info.
 /// </summary>
 protected virtual void OnGetInfo(ServerInfoEventArgs args)
 {
     args.ServerInfo = new ServerInfo
     {
         PushPattern = DisplayName,
         Counter     = Count
     };
 }
Exemplo n.º 4
0
        private void OnServerInfoReceived(GetServerInfoResultData result)
        {
            string serverName = result.ServerName;

            ServerInfoEventArgs eventArgs = new ServerInfoEventArgs(serverName);

            ServerInfo(this, eventArgs);
        }
Exemplo n.º 5
0
 private void ServerInfoEvent(object sender, ServerInfoEventArgs e)
 {
     this.BeginInvoke((Action)(delegate
     {
         fileUploader.ServerInfo = e.ServerInfo;
         fileUploader.FileSelected = fileToUpload;
         fileUploader.UploadThread();
     }));
 }
Exemplo n.º 6
0
            public void OnServerInfoReceived(object sender, ServerInfoEventArgs eventArgs)
            {
                string serverName = eventArgs.ServerName;

                listener(serverName);

                IServerInterface serverInterface = sender as IServerInterface;

                serverInterface.ServerInfo -= OnServerInfoReceived;
            }
Exemplo n.º 7
0
 private void Instance_TokensChanged(object sender, ServerInfoEventArgs e)
 {
     if (ServerManager.Instance.ServerInfoExists && !obs.IsConnected)
     {
         Connect();
     }
     else if (!ServerManager.Instance.ServerInfoExists)
     {
         Disconnect();
     }
 }
Exemplo n.º 8
0
 private void Instance_TokensChanged(object sender, ServerInfoEventArgs e)
 {
     if (ServerManager.Instance.ServerInfoExists && !obs.IsConnected)
     {
         Logger.Instance.LogMessage(TracingLevel.INFO, $"OBSManager: ServerInfo Exists - Connecting");
         Connect();
     }
     else if (!ServerManager.Instance.ServerInfoExists)
     {
         Logger.Instance.LogMessage(TracingLevel.INFO, $"OBSManager: ServerInfo does not exist - Disconnecting");
         Disconnect();
     }
     else
     {
         Logger.Instance.LogMessage(TracingLevel.INFO, $"OBSManager: Tokens changed - connection remains open");
     }
 }
Exemplo n.º 9
0
 void ServerInfoReceivedHandler(object sender, ServerInfoEventArgs args)
 {
     RequiresPassword   = args.Info.RequiresLogin;
     AllowsRegistration = args.Info.AllowsRegistration;
 }
Exemplo n.º 10
0
 private void OnMonitorEngineRequestServer(object sender, ServerInfoEventArgs e)
 {
     e.IsServer = _objectMode == ObjectModes.Server;
     e.Server   = _server;
     e.Cancel   = _server == null;
 }
Exemplo n.º 11
0
 private void PushService_GetInfo(object sender, ServerInfoEventArgs args)
 {
     OnGetInfo(args);
 }
Exemplo n.º 12
0
 private void ServersManager_ServerInfo(object sender, ServerInfoEventArgs e)
 {
     Tracer.WriteInformation(string.Format(@"Info: {0}, {1}", e.ServerEndPoint.ToString(), e.ToString()));
 }
Exemplo n.º 13
0
 static void ServersManager_ServerInfo(object sender, ServerInfoEventArgs e)
 {
     Console.WriteLine(@"  -    Info: [ {0} ] {1}", e.ServerEndPoint.ToString(), e.ToString());
 }
 void ServerInfoReceivedHandler(object sender, ServerInfoEventArgs args)
 {
     RequiresPassword = args.Info.RequiresLogin;
 }
Exemplo n.º 15
0
        private unsafe void RefreshText()
        {
            int           width         = 80;
            int           height        = 199;
            StringBuilder stringBuilder = new StringBuilder(width * height);

            byte[]              tempRes             = new byte[width * height];
            ConsoleEventArgs    consoleEventArgs    = new ConsoleEventArgs();
            ServerInfoEventArgs serverInfoEventArgs = new ServerInfoEventArgs();
            char *sz;

            while (!_stoping)
            {
                int i = 0;
                sz = (char *)WinAPI.MapViewOfFile(_hHookBufInfo[0], WinAPI.FileMapAccess.FileMapRead | WinAPI.FileMapAccess.FileMapWrite, 0, 0, 0);

                // Command token
                *(int *)&sz[i] = WinAPI.ENGINE_RETRIEVE_CONSOLE_CONTENTS;
                i += 2;

                // Start at line 0
                *(int *)&sz[i] = 0;
                i += 2;

                // End at line 23 ( assumes 24 line console )
                *(int *)&sz[i] = height;
                i += 2;

                bool tt = WinAPI.UnmapViewOfFile(sz);

                if (!_stoping)
                {
                    WinAPI.SetEvent(_hHookBufInfo[1]);

                    Thread.Sleep(20);

                    if (WinAPI.WaitForSingleObject(_hHookBufInfo[2], 0) == WinAPI.WAIT_OBJECT_0)
                    {
                        IntPtr pBuffer = WinAPI.MapViewOfFile(_hHookBufInfo[0], WinAPI.FileMapAccess.FileMapRead | WinAPI.FileMapAccess.FileMapWrite, 0, 0, 0);

                        Marshal.Copy((IntPtr)((int)pBuffer + 4), tempRes, 0, width * height);

                        for (int z = 0; z < tempRes.Length && !_stoping; z += width)
                        {
                            string line = string.Format("{0}\n", _encoding.GetString(tempRes, z, width));
                            if (line.Length < width)
                            {
                                if (z + width < tempRes.Length && tempRes[z + width - 1] != 32)
                                {
                                    line = string.Format("{0}\n", _encoding.GetString(tempRes, z, width + 1));
                                }
                            }
                            stringBuilder.Append(line);
                        }
                        String result = stringBuilder.ToString().Replace("\0", " ");
                        stringBuilder.Clear();

                        if (!_stoping)
                        {
                            string firstLine = result.Length > 80 ? result.Substring(0, 80) : result;
                            try
                            {
                                ParseFirstLine(firstLine);
                            }
                            catch (Exception e)
                            {
                                _logger.DebugException("RefreshText error", e);
                            }

                            consoleEventArgs.Console = result;
                            OnConsoleUpdated(this, consoleEventArgs);
                            serverInfoEventArgs.ServerStatus = ServerStatus;
                            OnServerInfoUpdated(this, serverInfoEventArgs);

                            WinAPI.UnmapViewOfFile(pBuffer);
                            Thread.Sleep(480);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
        }