Пример #1
0
 /// <summary>
 /// 修改缓存位置按钮被点击
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonChangePath_Click(object sender, EventArgs e)
 {
     if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
     {
         cachePath.Text = folderBrowserDialog.SelectedPath;
         ClassStatic.SetConfigSoftware("cachePath", cachePath.Text);
     }
 }
Пример #2
0
 /// <summary>
 /// 解析连接开启
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Parsing_CheckedChanged(object sender, EventArgs e)
 {
     if (ClassStatic.GetConfigSoftware("parse") != Parsing.Checked.ToString())
     {
         ClassStatic.SetConfigSoftware("parse", Parsing.Checked.ToString());
         Action <bool, byte[]>  action     = new Action <bool, byte[]>(SettingChange_Callback);
         ClassStatic.ClientData clientData = new ClassStatic.ClientData("parse", Parsing.Checked.ToString());
         ClassStatic.tcpClient.Send(220, ClassStatic.SetClientDataByte(clientData), action);
     }
 }
Пример #3
0
        /// <summary>
        /// 快捷键设置抬起
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TextShortcutKey_KeyUp(object sender, KeyEventArgs e)
        {
            TextBox that = sender as TextBox;
            string  type;

            if (that.Tag != null)
            {
                if (that == textCopy)
                {
                    type = "copy";
                }
                else if (that == textPaste)
                {
                    type = "paste";
                }
                else if (that == textScreenshot)
                {
                    type = "screenshot";
                }
                else if (that == textColor)
                {
                    type = "color";
                }
                else
                {
                    type = "";
                }

                if (that.Text != "" && that.Text != that.Tag.ToString())
                {
                    if (type != "")
                    {
                        Action <bool, byte[]>  action     = new Action <bool, byte[]>(SettingChange_Callback);
                        ClassStatic.ClientData clientData = new ClassStatic.ClientData(type, that.Text);
                        ClassStatic.tcpClient.Send(220, ClassStatic.SetClientDataByte(clientData), action);
                        ClassStatic.SetConfigSoftware(type, that.Text);
                    }
                }
                else
                {
                    that.Text = that.Tag.ToString();
                }
                that.Tag = null;
                if (shortcutkey)
                {
                    shortcutkey = false;
                    FormMain.formMain.ShortcutkeyHandRegister();
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 上线信息响应回调处理
        /// </summary>
        /// <param name="state"></param>
        /// <param name="data"></param>
        private void SendMyOnline_Callback(bool state, byte[] data)
        {
            this.Invoke(new Action(() => {
                if (state)
                {
                    ClassStatic.UserLoginSuccess resultData = ClassStatic.GetLoginSuccessData(data);
                    if (resultData != null && resultData.ret == "true")
                    {
                        ClassStatic.isLogined = true;
                        ClassStatic.bind      = resultData.bind;

                        if (ClassStatic.GetConfigSoftware("turnOn") == "")
                        {
                            ClassStatic.SetConfigSoftware("turnOn", "False");
                        }
                        if (ClassStatic.GetConfigSoftware("parse") == "")
                        {
                            ClassStatic.SetConfigSoftware("parse", resultData.parse);
                        }
                        if (ClassStatic.GetConfigSoftware("copy") == "")
                        {
                            ClassStatic.SetConfigSoftware("copy", resultData.copy);
                        }
                        if (ClassStatic.GetConfigSoftware("paste") == "")
                        {
                            ClassStatic.SetConfigSoftware("paste", resultData.paste);
                        }
                        if (ClassStatic.GetConfigSoftware("screenshot") == "")
                        {
                            ClassStatic.SetConfigSoftware("screenshot", resultData.screenshot);
                        }
                        if (ClassStatic.GetConfigSoftware("color") == "")
                        {
                            ClassStatic.SetConfigSoftware("color", resultData.color);
                        }

                        FormLogin.formLogin.Close();
                        return;
                    }
                }
                ClassStatic.account = "";
                LabelTipShow("登录失败,请稍后再试", true);
            }));
        }
Пример #5
0
        private void buttonFinish_Click(object sender, EventArgs e)
        {
            // 定义一个临时图层
            Image    temp     = (Image)canvasImage.Clone();
            Graphics graphics = Graphics.FromImage(temp);

            foreach (DrawShape drawShape in drawShapeList)
            {
                DrawShapeOnGraphics(graphics, drawShape);
            }
            graphics.Dispose();
            int   w     = cropBoxRectangle.Width;
            int   h     = cropBoxRectangle.Height;
            Image temp2 = new Bitmap(w, h);

            graphics = Graphics.FromImage(temp2);
            graphics.DrawImage(temp, new Rectangle(0, 0, w, h), cropBoxRectangle, GraphicsUnit.Pixel);
            graphics.Dispose();
            string path = ClassStatic.GetConfigSoftware("cachePath");

            if (Directory.Exists(path) == false)
            {
                path = System.Environment.CurrentDirectory + "\\cache";
                Directory.CreateDirectory(path);
                ClassStatic.SetConfigSoftware("cachePath", path);
            }

            path = path + "\\" + DateTime.Now.ToString("yyyy-MM-dd.HHmmss") + ".png";
            temp2.Save(path);
            StringCollection file = new StringCollection();

            file.Add(path);
            Clipboard.SetFileDropList(file);
            temp.Dispose();
            temp2.Dispose();
            this.Close();
        }
Пример #6
0
        public void InitializeControl()
        {
            if (ClassStatic.GetConfigSoftware("cachePath") == "")
            {
                ClassStatic.SetConfigSoftware("cachePath", System.Environment.CurrentDirectory + "\\cache");
            }
            string path = ClassStatic.GetConfigSoftware("cachePath");

            if (Directory.Exists(path) == false)
            {
                path = System.Environment.CurrentDirectory + "\\cache";
                Directory.CreateDirectory(path);
                ClassStatic.SetConfigSoftware("cachePath", path);
            }

            cachePath.Text = path;

            if (ClassStatic.bind != "")
            {
                textBindNumber.Text = ClassStatic.bind;
                buttonBindQQ.Text   = "解除绑定";
            }
            else
            {
                textBindNumber.Text = "等待绑定";
                buttonBindQQ.Text   = "绑定QQ";
            }

            turnOn.Checked  = (ClassStatic.GetConfigSoftware("turnOn") == "True");
            Parsing.Checked = (ClassStatic.GetConfigSoftware("parse") == "True");

            textCopy.Text       = ClassStatic.GetConfigSoftware("copy");
            textPaste.Text      = ClassStatic.GetConfigSoftware("paste");
            textScreenshot.Text = ClassStatic.GetConfigSoftware("screenshot");
            textColor.Text      = ClassStatic.GetConfigSoftware("color");
        }
Пример #7
0
 private void turnOn_CheckedChanged(object sender, EventArgs e)
 {
     ClassStatic.SetConfigSoftware("turnOn", turnOn.Checked.ToString());
 }
Пример #8
0
        /// <summary>
        /// 远程发送剪贴板中含有文字
        /// </summary>
        /// <param name="state"></param>
        /// <param name="data"></param>
        public void OnOtherDriveClipboardDataTextHandler(int state, byte[] data)
        {
            if (state == 221)
            {
                this.Invoke(new Action(() => {
                    ClassStatic.isRemoteClipboardData = 2;
                    Clipboard.SetText(ClassStatic.GetString(data));
                }));
            }
            if (state == 222)
            {
                this.Invoke(new Action(() => {
                    Bitmap bmp  = new Bitmap(Clipboard.GetImage());
                    string path = ClassStatic.GetConfigSoftware("cachePath");
                    if (Directory.Exists(path) == false)
                    {
                        path = System.Environment.CurrentDirectory + "\\cache";
                        Directory.CreateDirectory(path);
                        ClassStatic.SetConfigSoftware("cachePath", path);
                    }
                    path += "\\img";
                    if (Directory.Exists(path) == false)
                    {
                        Directory.CreateDirectory(path);
                    }

                    path += "\\" + DateTime.Now.ToString("yyyy-MM-dd.HHmmss") + ".png";
                    bmp.Save(path, Clipboard.GetImage().RawFormat);
                    StringCollection file = new StringCollection();
                    file.Add(path);
                    ClassStatic.isRemoteClipboardData = 2;
                    Clipboard.SetFileDropList(file);
                    bmp.Dispose();
                }));
            }
            if (state == 223)
            {
                string fileName = "";

                try
                {
                    int lenth = Convert.ToInt32(ClassStatic.GetString(data.Skip(1).Take(data[0]).ToArray()));
                    data     = data.Skip(data[0] + 1).ToArray();
                    fileName = ClassStatic.GetString(data.Take(lenth).ToArray());
                    data     = data.Skip(lenth).ToArray();
                }
                catch
                {
                }

                if (fileName != "")
                {
                    this.Invoke(new Action(() => {
                        string path = ClassStatic.GetConfigSoftware("cachePath");
                        if (Directory.Exists(path) == false)
                        {
                            path = System.Environment.CurrentDirectory + "\\cache";
                            Directory.CreateDirectory(path);
                            ClassStatic.SetConfigSoftware("cachePath", path);
                        }
                        path += "\\" + fileName;

                        System.Diagnostics.Debug.WriteLine(path);
                        FileStream fs = new FileStream(path, FileMode.Create);

                        System.Diagnostics.Debug.WriteLine(data.Length);
                        fs.Write(data, 0, data.Length);
                        fs.Close();

                        StringCollection file = new StringCollection();
                        file.Add(path);
                        ClassStatic.isRemoteClipboardData = 2;
                        Clipboard.SetFileDropList(file);
                        System.Diagnostics.Debug.WriteLine(Clipboard.GetFileDropList().Count);
                    }));
                }
            }
            if (state == 238)
            {
                this.Invoke(new Action(() =>
                {
                    FormMain.formMain.deviceList.InitializeDeviceList();
                }));
            }
        }