Пример #1
0
        private void InputsPipeConnected(IAsyncResult e)
        {
            try
            {
                if (InputsPipe != null)
                {
                    InputsPipe.EndWaitForConnection(e);

                    // send connection settings
                    RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendServerAddress, string.IsNullOrEmpty(RemoteSession.ServerAddress) ? "localhost" : RemoteSession.ServerAddress);

                    if (!string.IsNullOrEmpty(RemoteSession.VMGuid))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendVMGuid, string.Concat(RemoteSession.VMGuid, string.Format(";EnhancedMode={0}", RemoteSession.VMEnhancedMode ? "1" : "0")));
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.UserDomain))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserDomain, RemoteSession.UserDomain);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.UserName))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserName, RemoteSession.UserName);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.UserPassword))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserPassword, RemoteSession.UserPassword);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.StartProgram))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendStartProgram, RemoteSession.StartProgram);
                    }

                    // (re)sync the clipboard
                    if (!string.IsNullOrEmpty(RemoteSession.ClipboardText))
                    {
                        // send the clipboard text as unicode code points (same as done from the browser)
                        var clipboardUnicode = string.Empty;
                        foreach (var charValue in RemoteSession.ClipboardText)
                        {
                            clipboardUnicode += (string.IsNullOrEmpty(clipboardUnicode) ? string.Empty : "-") + char.ConvertToUtf32(charValue.ToString(), 0);
                        }
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendLocalClipboard, clipboardUnicode);
                    }

                    // connect the host client to the remote host; a fullscreen update will be sent upon connection
                    RemoteSession.Manager.SendCommand(RemoteSessionCommand.ConnectClient);
                }
            }
            catch (Exception exc)
            {
                Trace.TraceError("Failed to wait for connection on inputs pipe, remote session {0} ({1})", RemoteSession?.Id, exc);
            }
        }
Пример #2
0
        private void InputsPipeConnected(IAsyncResult e)
        {
            try
            {
                if (InputsPipe != null)
                {
                    InputsPipe.EndWaitForConnection(e);

                    // send connection settings
                    RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendServerAddress, string.IsNullOrEmpty(RemoteSession.ServerAddress) ? "localhost" : RemoteSession.ServerAddress);

                    if (!string.IsNullOrEmpty(RemoteSession.UserDomain))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserDomain, RemoteSession.UserDomain);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.UserName))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserName, RemoteSession.UserName);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.UserPassword))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserPassword, RemoteSession.UserPassword);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.StartProgram))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendStartProgram, RemoteSession.StartProgram);
                    }

                    // send browser settings, if defined (they will be otherwise send later by the browser)
                    if (RemoteSession.ImageEncoding.HasValue)
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SetImageEncoding, ((int)RemoteSession.ImageEncoding).ToString());
                    }

                    if (RemoteSession.ImageQuality.HasValue)
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SetImageQuality, RemoteSession.ImageQuality.ToString());
                    }

                    if (RemoteSession.ImageQuantity.HasValue)
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SetImageQuantity, RemoteSession.ImageQuantity.ToString());
                    }

                    // connect the host client to the remote host; a fullscreen update will be sent upon connection
                    RemoteSession.Manager.SendCommand(RemoteSessionCommand.ConnectClient);
                }
            }
            catch (Exception exc)
            {
                Trace.TraceError("Failed to wait for connection on inputs pipe, remote session {0} ({1})", RemoteSession.Id, exc);
            }
        }
Пример #3
0
 private void InputsPipeConnected(IAsyncResult e)
 {
     try
     {
         if (InputsPipe != null)
         {
             InputsPipe.EndWaitForConnection(e);
         }
     }
     catch (Exception exc)
     {
         Trace.TraceError("Failed to wait for connection on inputs pipe, remote session {0} ({1})", RemoteSession.Id, exc);
     }
 }
Пример #4
0
        private void InputsPipeConnected(IAsyncResult e)
        {
            try
            {
                if (InputsPipe != null)
                {
                    InputsPipe.EndWaitForConnection(e);

                    // send connection settings
                    RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendServerAddress, string.IsNullOrEmpty(RemoteSession.ServerAddress) ? "localhost" : RemoteSession.ServerAddress);

                    if (!string.IsNullOrEmpty(RemoteSession.VMGuid))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendVMGuid, string.Concat(RemoteSession.VMGuid, string.Format(";EnhancedMode={0}", RemoteSession.VMEnhancedMode ? "1" : "0")));
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.UserDomain))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserDomain, RemoteSession.UserDomain);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.UserName))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserName, RemoteSession.UserName);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.UserPassword))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendUserPassword, RemoteSession.UserPassword);
                    }

                    if (!string.IsNullOrEmpty(RemoteSession.StartProgram))
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SendStartProgram, RemoteSession.StartProgram);
                    }

                    // connect the host client to the remote host; a fullscreen update will be sent upon connection
                    RemoteSession.Manager.SendCommand(RemoteSessionCommand.ConnectClient);
                }
            }
            catch (Exception exc)
            {
                Trace.TraceError("Failed to wait for connection on inputs pipe, remote session {0} ({1})", RemoteSession.Id, exc);
            }
        }
Пример #5
0
        private void InputsPipeConnected(IAsyncResult e)
        {
            try
            {
                if (InputsPipe != null)
                {
                    InputsPipe.EndWaitForConnection(e);

                    // remote session is now connected
                    RemoteSession.State = RemoteSessionState.Connected;

                    // send client settings, if defined (they will be otherwise send later by the client)
                    if (RemoteSession.ImageEncoding.HasValue)
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SetImageEncoding, ((int)RemoteSession.ImageEncoding).ToString());
                    }

                    if (RemoteSession.ImageQuality.HasValue)
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SetImageQuality, RemoteSession.ImageQuality.ToString());
                    }

                    if (RemoteSession.ImageQuantity.HasValue)
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.SetImageQuantity, RemoteSession.ImageQuantity.ToString());
                    }

                    if (RemoteSession.Manager.FullscreenEventPending)
                    {
                        RemoteSession.Manager.SendCommand(RemoteSessionCommand.RequestFullscreenUpdate);
                    }
                }
            }
            catch (Exception exc)
            {
                Trace.TraceError("Failed to wait for connection on inputs pipe, remote session {0} ({1})", RemoteSession.Id, exc);
            }
        }