// 设置剪切板内容
        public Packet writeClipboard(Packet packet)
        {
            int    len  = packet.nextInt();
            String text = Encoding.UTF8.GetString(packet.nextBytes(len));

            ClipboardAsync.SetText(text);
            return(Packet.create(Command.SET_CLIPBOARD_RESPONSE, 4).addBytes(Encoding.UTF8.GetBytes("OJBK")));
        }
Esempio n. 2
0
            public static string GetText(TextDataFormat format)
            {
                var instance  = new ClipboardAsync();
                var staThread = new Thread(instance.ThGetText);

                staThread.SetApartmentState(ApartmentState.STA);
                staThread.Start(format);
                staThread.Join();
                return(instance._getText);
            }
Esempio n. 3
0
    public bool ContainsFileDropList()
    {
        ClipboardAsync instance  = new ClipboardAsync();
        Thread         staThread = new Thread(instance._thContainsFileDropList);

        staThread.SetApartmentState(ApartmentState.STA);
        staThread.Start();
        staThread.Join();
        return(instance._ContainsFileDropList);
    }
Esempio n. 4
0
    public string GetText()
    {
        ClipboardAsync instance  = new ClipboardAsync();
        Thread         staThread = new Thread(instance._thGetText);

        staThread.SetApartmentState(ApartmentState.STA);
        staThread.Start();
        staThread.Join();
        return(instance._GetText);
    }
Esempio n. 5
0
    public Specialized.StringCollection GetFileDropList()
    {
        ClipboardAsync instance  = new ClipboardAsync();
        Thread         staThread = new Thread(instance._thGetFileDropList);

        staThread.SetApartmentState(ApartmentState.STA);
        staThread.Start();
        staThread.Join();
        return(instance._GetFileDropList);
    }
        // 获取剪切板内容
        public Packet readClipboard(Packet packet)
        {
            string text = ClipboardAsync.GetText();

            if (text != null && text.Length > 0)
            {
                byte[] bytes = Encoding.UTF8.GetBytes(text);
                return(Packet.create(Command.GET_CLIPBOARD_RESPONSE, 4 + bytes.Length).addInt(bytes.Length).addBytes(bytes));
            }
            return(null);
        }
Esempio n. 7
0
        //}}}
        private void sendClipboard_tick()// {{{
        {
            string txt = ClipboardAsync.GetText();

            if (txt == null)
            {
                return;
            }
            if (txt.Length == 0)
            {
                return;
            }
            if (txt == LastClipboardText)
            {
                return;
            }
            LastClipboardText = txt;

            send_cmd("CLIPBOARD " + txt);
        }
Esempio n. 8
0
 private void handleClipboard() //{{{
 {
     LastClipboardText = ClipboardAsync.GetText();
     cb_thread         = new Thread(new ThreadStart(sendClipboard_loop));
     cb_thread.Start();
 }
        private static string GetClipboardText()
        {
            var clipboard = new ClipboardAsync();

            return(clipboard.GetText());
        }
Esempio n. 10
0
        private static void DoRefresh()
        {
            List <int> intList = new List <int>();
            List <int> rList   = new List <int>();
            string     path    = string.Format(@"D:\AutoRefresh\{0}.mcr", webSiteName);
            string     logPath = string.Format(@"D:\AutoRefresh\Log\{0}_{1}.LOG", webSiteName, DateTime.Now.ToString("yyyy-MM-dd"));

            if (!File.Exists(logPath))
            {
                File.Create(logPath);
            }

            string        content  = ReadLog(logPath);
            List <string> striparr = content.Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList();

            striparr = striparr.Where(s => !string.IsNullOrEmpty(s)).ToList();

            DataTable     dt          = GetDataTableByExcel(@"D:\AutoRefresh\refresh.xlsx", webSiteName);
            List <string> killProcess = new List <string>()
            {
                "firefox", "macrorecorder", "flashplayerplugin_23_0_0_207"
            };

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    intList.Add(i);
                }
                rList = randomList(intList);

                WriteLog(logPath, GenerateLogHead(webSiteName));

                int existAuthCodeTimes = 0;

                foreach (int r in rList)
                {
                    try
                    {
                        Process[] processesBegin = Process.GetProcesses();
                        foreach (var item in processesBegin)
                        {
                            if (killProcess.Contains(item.ProcessName.ToLower()))
                            {
                                item.Kill();
                            }
                        }


                        if (!string.IsNullOrEmpty(dt.Rows[r]["Username"].ToString().Trim()) && !string.IsNullOrEmpty(dt.Rows[r]["Password"].ToString().Trim()))
                        {
                            if (!striparr.Contains(dt.Rows[r]["Username"].ToString().Trim()))
                            {
                                GenerateFile(path, dt.Rows[r]["Username"].ToString().Trim(), dt.Rows[r]["Password"].ToString().Trim(), intervalMin, existAuthCodeTimes);
                            }
                        }

                        string clipStr = ClipboardAsync.GetText();

                        if (!clipStr.Contains("验证码"))
                        {
                            WriteLog(logPath, dt.Rows[r]["Username"].ToString().Trim() + "\r\n");
                        }
                        else
                        {
                            if (existAuthCodeTimes < 5)
                            {
                                existAuthCodeTimes = existAuthCodeTimes + 1;
                            }
                            else
                            {
                                existAuthCodeTimes = 0;
                            }
                        }

                        Process[] processesEnd = Process.GetProcesses();
                        foreach (var item in processesEnd)
                        {
                            if (killProcess.Contains(item.ProcessName.ToLower()))
                            {
                                item.Kill();
                            }
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
                WriteLog(logPath, GenerateLogEnd(webSiteName, dt.Rows.Count));
            }
        }