GatewayDebugData.DebugContext.HandleData C# (CSharp) Method

HandleData() private method

private HandleData ( ) : void
return void
        void HandleData()
        {
            while (isRunning)
            {
                if (!isConnected)
                {
                    Thread.Sleep(500);
                    continue;
                }

                try
                {
                    switch ((DebugDataType)GetInt())
                    {
                        case DebugDataType.FULL_IOC:
                            {
                                iocs.GetAll();
                                if (RefreshAllIocs != null)
                                    RefreshAllIocs(this);
                                break;
                            }
                        case DebugDataType.IOC_NEW_CHANNEL:
                            {
                                string ioc = GetString();
                                string channel = iocs.GetByName(ioc).AddChannel();
                                if (NewIocChannel != null)
                                    NewIocChannel(this, ioc, channel);
                                break;
                            }
                        case DebugDataType.DROP_IOC:
                            {
                                string ioc = GetString();
                                iocs.DropByName(ioc);
                                if (DropIoc != null)
                                    DropIoc(this, ioc);
                                break;
                            }
                        case DebugDataType.DROP_CLIENT:
                            {
                                string client = GetString();
                                clients.DropByName(client);
                                if (DropClient != null)
                                    DropClient(this, client);
                                break;
                            }
                        case DebugDataType.CLIENT_NEW_CHANNEL:
                            {
                                string client = GetString();
                                string channel = clients.GetByName(client).AddChannel();
                                if (NewClientChannel != null)
                                    NewClientChannel(this, client, channel);
                                break;
                            }
                        case DebugDataType.FULL_CLIENT:
                            {
                                clients.GetAll();
                                if (RefreshAllClients != null)
                                    RefreshAllClients(this);
                                break;
                            }
                        case DebugDataType.LOG:
                            {
                                string source = GetString();
                                TraceEventType eventType = (TraceEventType)GetInt();
                                int chainId = GetInt();
                                string message = GetString();

                                if (DebugLog != null)
                                    DebugLog(source, eventType, chainId, message);
                                break;
                            }
                        case DebugDataType.GW_NAME:
                            {
                                GatewayName = GetString();
                                if (NewName != null)
                                    NewName(this, GatewayName);
                                break;
                            }
                        case DebugDataType.FULL_LOGS:
                            fullLogs = true;
                            if (DebugLevel != null)
                                DebugLevel(this, fullLogs);
                            break;
                        case DebugDataType.CRITICAL_LOGS:
                            fullLogs = false;
                            if (DebugLevel != null)
                                DebugLevel(this, fullLogs);
                            break;
                    }
                }
                catch (Exception)
                {
                    Disconnect();
                }
            }
        }