public void SendText(String text)
 {
     foreach (var t in text)
     {
         var symbol = t.ToString();
         keydata.SendKeys(keycode[symbol].length, ref keycode[symbol].bools[0], ref keycode[symbol].ints[0]);
         Thread.Sleep(10);
     }
 }
Esempio n. 2
0
        public unsafe static void Send(Keys[] keyCodes, ServerBase serverBase)
        {
            Server    serverNode = serverBase.ServerNode;
            RdpClient client     = serverNode.Client;
            IMsRdpClientNonScriptable msRdpClientNonScriptable = (IMsRdpClientNonScriptable)client.GetOcx();
            int num = keyCodes.Length;

            try
            {
                SendKeysData sendKeysData = default(SendKeysData);
                bool *       ptr          = (bool *)sendKeysData.keyUp;
                int *        ptr2         = sendKeysData.keyData;
                int          num2         = 0;
                for (int i = 0; i < num && i < 10; i++)
                {
                    int num3 = (int)Util.MapVirtualKey((uint)keyCodes[i], 0u);
                    sendKeysData.keyData[num2] = num3;
                    sendKeysData.keyUp[num2++] = 0;
                    if (!IsModifier(keyCodes[i]))
                    {
                        for (int num4 = num2 - 1; num4 >= 0; num4--)
                        {
                            sendKeysData.keyData[num2] = sendKeysData.keyData[num4];
                            sendKeysData.keyUp[num2++] = 1;
                        }
                        msRdpClientNonScriptable.SendKeys(num2, ref *ptr, ref *ptr2);
                        num2 = 0;
                    }
                }
            }
            catch
            {
            }
        }