Beispiel #1
0
    public Texture2D getTexture()
    {
        state = VNCPluginInterface.getEnumConnectionState();
        switch (state)
        {
        case VNCPluginInterface.ConnectionState.Connected:
            needNewtexture = false;
            break;

        case VNCPluginInterface.ConnectionState.BufferSizeChanged:
            needNewtexture = true;
            TextureSize    = new Size(
                VNCPluginInterface.getDesktopWidth(),
                VNCPluginInterface.getDesktopHeight());
            break;

        case VNCPluginInterface.ConnectionState.Error:
            if (ConnectionLost != null)
            {
                ConnectionLost(this, new ErrorEventArg("Error From plugin"));
            }
            break;

        default:
            Debug.LogWarning("Stange behaviour");
            break;
        }

        if (needNewtexture)
        {
            needNewtexture = false;
            texture        = pluginInterface.CreateTextureAndPassToPlugin(BufferSize);
        }


        return(texture);
    }
Beispiel #2
0
    private IEnumerator Connection()
    {
        VNCPluginInterface.Connect(connectionInfos.host, connectionInfos.port, connectionInfos.display, connectionInfos.viewOnly);

        while (true)
        {
            bool exit = false;
            try
            {
                state = VNCPluginInterface.getEnumConnectionState();
                switch (state)
                {
                case VNCPluginInterface.ConnectionState.Iddle:
                    break;

                case VNCPluginInterface.ConnectionState.Connecting:

                    break;

                case VNCPluginInterface.ConnectionState.PasswordNeeded:
                    onConnection(null, true);
                    break;

                case VNCPluginInterface.ConnectionState.Connected:
                    onConnection(null, false);
                    exit = true;
                    break;

                case VNCPluginInterface.ConnectionState.BufferSizeChanged:
                    onConnection(null, false);
                    needNewtexture = true;
                    TextureSize    = new Size(
                        VNCPluginInterface.getDesktopWidth(),
                        VNCPluginInterface.getDesktopHeight());
                    break;

                case VNCPluginInterface.ConnectionState.Error:
                    if (ConnectionLost != null)
                    {
                        ConnectionLost(this, new ErrorEventArg("Error From plugin"));
                    }

                    Debug.LogError("Connection Error");
                    exit = true;
                    break;
                }
            }
            catch (Exception e)
            {
                if (!(e is ThreadAbortException))
                {
                    onConnection(e, false);
                }
            }
            if (exit)
            {
                break;
            }

            yield return(new WaitForSeconds(0.25f));
        }
    }
Beispiel #3
0
 public void UpdateMouse(Point pos, bool button0, bool button1, bool button2)
 {
     VNCPluginInterface.MouseEvent(pos.X, pos.Y, button0, button1, button2);
 }
Beispiel #4
0
 public RealVncClient()
 {
     pluginInterface = new VNCPluginInterface();
 }