public void OnClientDisconnected(Client client)
        {
            try
            {
                ClientLock.AcquireWriterLock(15 * 1000);

                if (Client == client)
                {
                    Client = null;
                    if (CurrentView.GetType() == typeof(IClientView))
                    {
                        ((IClientView)CurrentView).SetActiveClient(null);
                        CurrentView = MainView;
                        C.WriteLine("Current interacting user has disconnected");
                        CurrentView.PrintBanner();
                    }

                    try
                    {
                        RevShellLock.AcquireWriterLock(15 * 1000);
                        IsRevShellActive = false;
                    }
                    catch (ApplicationException exception)
                    {
                        C.WriteLine("============================================================================");
                        C.WriteLine("DeadLock? ConsoleUiMediator::OnClientDisconnected(Client) AcquireWriterLock");
                        C.WriteLine("============================================================================");
                    }
                    finally
                    {
                        RevShellLock.ReleaseWriterLock();
                    }
                }
            }
            catch (ApplicationException exception)
            {
                C.WriteLine("============================================================================");
                C.WriteLine("DeadLock? ConsoleUiMediator::OnClientDisconnected(Client) AcquireWriterLock");
                C.WriteLine("============================================================================");
            }

            finally
            {
                ClientLock.ReleaseWriterLock();
            }
        }
        private bool ProcessInstructionInteracting(string instruction, string[] parts)
        {
            try
            {
                ClientLock.AcquireReaderLock(15 * 1000);

                try
                {
                    RevShellLock.AcquireReaderLock(15 * 1000);
                    if (IsRevShellActive)
                    {
                        Application.ExecInShell(Client, instruction);
                        return(true);
                    }
                }
                catch (ApplicationException)
                {
                    C.WriteLine("DeadLock ? ProcessInstructionInteracting");
                }
                finally
                {
                    RevShellLock.ReleaseReaderLock();
                }

                if (parts[0] == "ls")
                {
                    if (CurrentView == FileSystemView)
                    {
                        string basePath = FileSystemView.CurrentBasePath;
                        if (basePath == null)
                        {
                            Application.FetchFileSystemDrives(Client);
                        }
                        else
                        {
                            Application.FetchDirEntries(Client, basePath);
                        }
                    }
                    else
                    {
                        if (parts.Length == 1 || (parts.Length > 1 && parts[1].Trim().Equals("/")))
                        {
                            Application.FetchFileSystemDrives(Client);
                        }
                        else
                        {
                            string basePath = Path.GetFullPath(parts[1]);
                            Application.FetchDirEntries(Client, basePath);
                        }
                    }

                    return(true);
                }

                if (parts[0].Equals("sysinfo", StringComparison.OrdinalIgnoreCase))
                {
                    Application.FetchSystemInfo(Client);
                    return(true);
                }

                if (parts[0] == "fs")
                {
                    if (parts.Length == 1 ||
                        (parts.Length > 1 && parts[1].Equals("start", StringComparison.OrdinalIgnoreCase)))
                    {
                        CurrentView = FileSystemView;
                        FileSystemView.SetActiveClient(Application.GetClient(Client.Id));
                    }
                }
                else if (parts[0] == "ps")
                {
                    Application.FetchProcessList(Client);
                    return(true);
                }
                else if (instruction.Equals("desktop start", StringComparison.OrdinalIgnoreCase))
                {
                    bool shouldStart;

                    lock (IsDesktopActiveLock)
                    {
                        shouldStart = !IsDesktopActive;
                    }

                    if (shouldStart)
                    {
                        Application.StartDesktop(Client);
                    }

                    return(true);
                }
                else if (instruction.Equals("desktop stop", StringComparison.OrdinalIgnoreCase))
                {
                    lock (IsDesktopActiveLock)
                    {
                        if (IsDesktopActive)
                        {
                            IsDesktopActive = false;
                            Application.StopDesktop(Client);
                        }
                    }

                    return(true);
                }
                else if (parts[0] == "cd")
                {
                    if (parts.Length > 1)
                    {
                        if (CurrentView != FileSystemView)
                        {
                            CurrentView = FileSystemView;
                            FileSystemView.ChangeDirectory(parts[1]);
                            FileSystemView.Client = Client;
                        }
                    }
                }
                else if (parts[0] == "shell")
                {
                    try
                    {
                        RevShellLock.AcquireWriterLock(15 * 1000);
                        IsRevShellActive = true;
                    }
                    catch (ApplicationException)
                    {
                        C.WriteLine("DeadLock? RevShellLock.AcquireWriterLock");
                    }
                    finally
                    {
                        RevShellLock.ReleaseWriterLock();
                    }

                    Application.StartShell(Client);

                    return(true);
                }
            }
            catch (ApplicationException exception)
            {
                C.WriteLine("============================================================================");
                C.WriteLine("DeadLock? ConsoleUiMediator::ProcessInstructionInteracting AcquireReaderLock");
                C.WriteLine("============================================================================");
                return(false);
            }
            finally
            {
                ClientLock.ReleaseReaderLock();
            }

            return(false);
        }