예제 #1
0
        private void txtSend_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)10)             // ctrl_enter
            {
                string message = txtSend.Text;
                txtSend.Text = "";
                message      = message.Replace("\r", "");
                string[] lines = message.Split('\n');

                new Thread((ThreadStart) delegate
                {
                    this.BeginInvoke((MethodInvoker) delegate
                    {
                        lblStatus.Text = "送信中";
                    });

                    foreach (string line in lines)
                    {
                        _ftwv.send(StringTools.ENCODING_SJIS.GetBytes(line));
                    }

                    this.BeginInvoke((MethodInvoker) delegate
                    {
                        lblStatus.Text = "送信完了";
                    });
                })
                .Start();

                e.Handled = true;
            }
        }
예제 #2
0
 public void sendToSender(params string[] lines)
 {
     _frtwv.send(Utils.toOL(lines));
 }
예제 #3
0
        public void eachTimerTick()
        {
            try
            {
                for (; ;)
                {
                    ObjectList ol = (ObjectList)_frtwv.recv(0);

                    if (ol == null)
                    {
                        break;
                    }

                    byte[]        recvData = (byte[])ol[0];
                    string        recvLine = StringTools.ENCODING_SJIS.GetString(recvData);
                    List <string> prms     = StringTools.tokenize(recvLine, " ");
                    int           c        = 0;
                    string        command  = prms[c++];

                    // 受信コマンド処理 >

                    if (command == "SENDER-IDLING")
                    {
                        _frtwv.send(Utils.toOL(
                                        "SEND-TO-CLIENT",
                                        Utils.getScreenImage(monitorIndex, quality),
                                        ""
                                        ));
                    }
                    else if (command == "MONITOR-INDEX")
                    {
                        monitorIndex  = int.Parse(prms[c++]);
                        monitorIndex  = IntTools.toRange(monitorIndex, 0, IntTools.IMAX);
                        monitorIndex %= Ground.i.monitorCenter.getCount();

                        MonitorCenter.Monitor monitor = Ground.i.monitorCenter.get(monitorIndex);

                        _frtwv.send(Utils.toOL(
                                        "MOUSE_LTRB " +
                                        monitor.l + " " +
                                        monitor.t + " " +
                                        monitor.r + " " +
                                        monitor.b
                                        ));
                    }
                    else if (command == "QUALITY")
                    {
                        quality = int.Parse(prms[c++]);
                        quality = IntTools.toRange(quality, 0, 101);
                    }
                    else if (command == "DISCONNECTED")
                    {
                        if (Ground.i.disconnectAndShiftKeysUp)
                        {
                            _frtwv.send(Utils.toOL("SHIFT-KEYS-UP"));
                        }
                    }
                    else if (command == "SET-CLIP-BOARD-TEXT")
                    {
                        byte[] bText = StringTools.decodeBase64(prms[c++]);
                        string text  = JString.toJString(bText, true, true, true, true);

                        Clipboard.SetText(text);
                    }
                    else if (command == "GET-CLIP-BOARD-TEXT")
                    {
                        string text = Clipboard.GetText();

                        if (string.IsNullOrEmpty(text))
                        {
                            text = "(クリップボードにテキストはありません[S])";
                        }

                        if (Consts.CLIPBOARD_TEXT_LEN_MAX < text.Length)
                        {
                            text = "(クリップボードのテキストは長すぎます[S])";
                        }

                        _frtwv.send(Utils.toOL(
                                        "SEND-TO-CLIENT",
                                        "",
                                        text
                                        ));
                    }
                    else
                    {
                        Utils.WriteLog("不明なコマンド:" + command);
                    }

                    // < 受信コマンド処理
                }
            }
            catch (Exception e)
            {
                Utils.WriteLog("Service each-timer error: " + e);
                GC.Collect();
            }
        }