Example #1
0
        public void Run()
        {
            try {
                // Clear the buffers and reset the screen
                _ClientThread.NodeInfo.Connection.ReadString();
                _ClientThread.ClrScr();

                // Create the node directory and drop files
                CreateNodeDirectory();

                // Determine how to run the door
                if (((_ClientThread.NodeInfo.Door.Platform == OSUtils.Platform.Linux) && OSUtils.IsUnix) || ((_ClientThread.NodeInfo.Door.Platform == OSUtils.Platform.Windows) && OSUtils.IsWindows))
                {
                    RunDoorNative(TranslateCLS(_ClientThread.NodeInfo.Door.Command), TranslateCLS(_ClientThread.NodeInfo.Door.Parameters));
                }
                else if ((_ClientThread.NodeInfo.Door.Platform == OSUtils.Platform.DOS) && OSUtils.IsWindows)
                {
                    if (ProcessUtils.Is64BitOperatingSystem)
                    {
                        if (Helpers.IsDOSBoxInstalled())
                        {
                            RunDoorDOSBox(TranslateCLS(_ClientThread.NodeInfo.Door.Command), TranslateCLS(_ClientThread.NodeInfo.Door.Parameters));
                        }
                        else
                        {
                            RMLog.Error("DOS doors are not supported on 64bit Windows (unless you install DOSBox 0.73)");
                        }
                    }
                    else
                    {
                        (new RunDoorSBBSEXEC(_ClientThread)).Run(TranslateCLS(_ClientThread.NodeInfo.Door.Command), TranslateCLS(_ClientThread.NodeInfo.Door.Parameters), _ClientThread.NodeInfo.Door.ForceQuitDelay);
                    }
                }
                else if ((_ClientThread.NodeInfo.Door.Platform == OSUtils.Platform.DOS) && OSUtils.IsUnix)
                {
                    if (Helpers.IsDOSEMUInstalled())
                    {
                        RunDoorDOSEMU(TranslateCLS(_ClientThread.NodeInfo.Door.Command), TranslateCLS(_ClientThread.NodeInfo.Door.Parameters));
                    }
                    else
                    {
                        RMLog.Error("DOS doors are not supported on Linux (unless you install DOSEMU)");
                    }
                }
                else
                {
                    RMLog.Error("Unsure how to run door on current platform");
                }
            } catch (Exception ex) {
                RMLog.Exception(ex, "Error while running door '" + _ClientThread.NodeInfo.Door.Name + "'");
            } finally {
                // Clean up
                try {
                    _ClientThread.ClrScr();
                    _ClientThread.NodeInfo.Connection.SetBlocking(true); // In case native door disabled blocking sockets
                    DeleteNodeDirectory();
                } catch { /* Ignore */ }
            }
        }