public async void ButtonScrape_Click(object sender, EventArgs e)
        {
            var allScrapers = new AllScrapers(this);
            await allScrapers.ScrapeAllWebsites(new FormsLog());

            TextBox1.AppendText("Done\n");
        }
Beispiel #2
0
        private void Search_Click(object sender, EventArgs e)
        {
            IWebElement click_ob;
            IWebElement Search;
            string      temp;


            browser.Navigate().GoToUrl("http://google.com");

            Search = browser.FindElement(By.Name("q"));
            Search.SendKeys("qa testing" + OpenQA.Selenium.Keys.Enter);

            // open "Картинки"
            click_ob = browser.FindElement(By.LinkText("Картинки"));
            click_ob.Click();

            // parsing and opening sites, which contain certain text
            for (int i = 1; i < 10; i++)
            {
                temp = browser.FindElement(By.CssSelector(".isv-r:nth-child(" + i + ") > .VFACy")).Text;

                click_ob = browser.FindElement(By.CssSelector(".isv-r:nth-child(" + i + ") > .VFACy"));
                if (temp.Contains("QA Testing"))
                {
                    click_ob.Click();
                    p_num++;
                    TextBox1.AppendText(temp + "\r\n");
                }
            }
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string       sourcepath  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string       myfile      = System.IO.Path.Combine(sourcepath, "test.txt");
            StreamReader inputstream = File.OpenText(myfile);

            numberOfLines = File.ReadLines(myfile).Count();         //telt de regels van het document //Dit moet niet! je kan ook zo programmeren:
                                                                    //while(listlines.readline() != null)
                                                                    //words = listlines.readline().split(',')...

            string[] ListLines = new string[numberOfLines];         //hierin komen alle regels



            for (int i = 0; i < numberOfLines; i++)    //gaat de regels opsplitsen
            {
                ListLines[i] = inputstream.ReadLine(); //hierin worden de regels weggeschreven, gebruik split methoden als ge verschillende waardes in een array wilt laden
            }
            inputstream.Close();                       //sluit de inputstream

            int z = 0;

            words = ListLines[z].Split(';');
            for (int j = 0; j < words.Length; j++)
            {
                TextBox1.AppendText(words[j]);
            }
            TextBox1.AppendText(Environment.NewLine);
            z++;
        }
Beispiel #4
0
 public void output(Object anyObject)
 {
     if (anyObject != null)
     {
         TextBox1.AppendText(anyObject.ToString());
     }
 }
Beispiel #5
0
        private async Task YoutubePlylist(int num)
        {
            TextBox1.Text = "";

            UserCredential credential;

            using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
            {
                credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    // This OAuth 2.0 access scope allows for full read/write access to the
                    // authenticated user's account.
                    new[] { YouTubeService.Scope.Youtube },
                    "user",
                    CancellationToken.None,
                    new FileDataStore(this.GetType().ToString())
                    );
            }
            var youtubeService = new YouTubeService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = this.GetType().ToString()
            });
            //////////////////////////////////////////////////////
            var lRequest = youtubeService.Playlists.List("snippet");

            lRequest.Mine = true;
            var result  = lRequest.Execute();
            var resItem = youtubeService.PlaylistItems.List("snippet");

            resItem.PlaylistId = result.Items[num - 1].Id;
            var resitem2 = resItem.Execute();

            for (int j = 0; j < resitem2.Items.Count; j++)
            {
                //Console.WriteLine(resitem2.Items[j].Snippet.Title);
                //TextBox1.AppendText(resitem2.Items[j].Snippet.Title + "\r\n");

                //나와서
                foreach (string oh in temp_list)
                {
                    Youtube youtube = ParsingYoutube(oh);  // parsing part

                    //MessageBox.Show(youtube.mTitle);
                    TextBox1.AppendText(youtube.mTitle + "\n");
                }
                Youtube mfile = new Youtube();
                mfile.mURL       = "https://www.youtube.com/watch?v" + resitem2.Items[j].Snippet.ResourceId.VideoId;
                mfile.mYoutubeID = resitem2.Items[j].Snippet.ResourceId.VideoId;
                if (mfile.mYoutubeID[0] == '-')
                {
                    mfile.mYoutubeID = "\\" + mfile.mYoutubeID;
                }
                //MessageBox.Show(mfile.mYoutubeID);
                Update(mfile);
                TextBox1.AppendText(mfile.mTitle + "\t" + mfile.mArtist + "\r\n");
                //mw.mNowPlayingList.mMediaList.Add((MediaFile)youtube);
            }
        }
Beispiel #6
0
        //Invoke on UI Thread
        public void UpdateTextBox(int procName)
        {
            //Get AD groups membership for user

            PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "HCA");
            UserPrincipal    usr = UserPrincipal.FindByIdentity(ctx, GetProcessOwner1(procName));
            PrincipalSearchResult <Principal> groups = usr.GetAuthorizationGroups();
            IEnumerable <string> groupNames          = groups.Select(x => x.SamAccountName);
            GroupPrincipal       spGroup             = default(GroupPrincipal);
            GroupPrincipal       spGroup2            = default(GroupPrincipal);

            //dockHlp = new Form2(GetActiveWindowTitle(GetForegroundWindow()), null);
            dynamic pName = Process.GetProcessesByName("T");

            foreach (Process procs in pName)
            {
                dockHlp = new Form2(procs.MainWindowTitle, null);
                System.Windows.Application.Current.Dispatcher.Invoke(       //Invoke hooks on main thread.
                    () =>
                {
                    ActivateMouseHook();
                    dockHlp.Subscribe();
                });
            }

            this.Dispatcher.Invoke(() =>
            {
                TextBox1.AppendText("User ID: " + GetProcessOwner1(procName) + "\r\n");
            });

            foreach (string group in groupNames)
            {
                this.Dispatcher.Invoke(() =>
                {
                    TextBox1.AppendText("Group: " + group + "\r\n");
                });
            }

            //RichTextBox1.AppendText("Mouse hooked=" & dock.HookMouse() & vbCrLf)

            //try
            //{
            //    //spGroup = GroupPrincipal.FindByIdentity(ctx, "CWDV_AppAdmin_HVAValueBar");
            //    ////CWDV_AppAdmin_HVAValueBar
            //    //spGroup2 = GroupPrincipal.FindByIdentity(ctx, "Administrators");
            //    //TextBox1.AppendText("User is a member of HVA_Group: " + usr.IsMemberOf(spGroup) + "\r\n");
            //    //TextBox1.AppendText("User is a member of Administrators: " + usr.IsMemberOf(spGroup2) + "\r\n");
            //}
            //catch
            //{
            //    // RichTextBox1.AppendText("AD Group NOT FOUND" & vbCrLf)
            //}

            //TextBox1.AppendText("UpdateTextBox");


            //RichTextBox1.AppendText("Initial Top: " & r.top & " Initial Bottom: " & r.bottom & " Initial Left: " & r.left & " Initial Right: " & r.right & vbCrLf &
            //       "Initial Width x Height: " & r.right - r.left & " X " & r.bottom - r.top & vbCrLf)
        }
 private async Task WritingAnimator(string text)
 {
     foreach (char c in text)
     {
         TextBox1.AppendText(c.ToString());
         await Task.Delay(100);
     }
 }
Beispiel #8
0
 private void OnDataReceived(object sender, PortMessageEventArgs args)
 {
     try
     {
         TextBox1.AppendText("/r/n");
         TextBox1.AppendText(">" + args.Message + "/r/n" + ">");
     }
     catch { }
 }
Beispiel #9
0
        private void ButtonGenerate_Click(object sender, EventArgs e)
        {
            int TableCount;
            int RowCounter;
            int iTemp;

            TextBox1.Text = "";

            if (DataGridView.RowCount > 11)
            {
                MessageBox.Show("Use 'Save file' button for generate big project. Only 10 lines will be generation.", "Big project", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                RowCounter = 9;
            }
            else
            {
                RowCounter = DataGridView.RowCount - 2;
            }
            var loopTo = RowCounter;

            for (iTemp = 0; iTemp <= loopTo; iTemp++)
            {
                var loopTo1 = DataGridView.ColumnCount - 1;
                for (TableCount = 0; TableCount <= loopTo1; TableCount++)
                {
                    if (TableCount > 0)
                    {
                        TextBox1.AppendText(Conversions.ToString((char)9));
                    }
                    TextBox1.AppendText(DataGridView.Columns[TableCount].Name);

                    if (DataGridView[TableCount, iTemp].Value != null | !string.IsNullOrEmpty(MaskCol[TableCount]))
                    {
                        if (DataGridView.Columns[TableCount].Name != null)
                        {
                            TextBox1.AppendText("=");
                        }
                        if (!string.IsNullOrEmpty(MaskCol[TableCount]))
                        {
                            TextBox1.AppendText(Strings.Mid(MaskCol[TableCount], 1, 1));
                        }
                        if (DataGridView[TableCount, iTemp].Value != null)
                        {
                            TextBox1.AppendText(DataGridView[TableCount, iTemp].Value.ToString());
                        }
                        if (!string.IsNullOrEmpty(MaskCol[TableCount]))
                        {
                            TextBox1.AppendText(Strings.Mid(MaskCol[TableCount], 2, 1));
                        }
                    }
                }
                TextBox1.AppendText(Constants.vbNewLine);
            }

            TabControl1.SelectedIndex = 1;
        }
Beispiel #10
0
 private void WriteMessage(string creator, string message)
 {
     try
     {
         string Tmp = String.Format("[{0}][{1}]{2}", creator, DateTime.Now, message);
         _fileLog.WriteLine(Tmp);
         _fileLog.Flush();
         TextBox1.AppendText(Tmp + "\r\n");
     }
     catch { }
 }
Beispiel #11
0
        void com_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            //throw new NotImplementedException();
            SerialPort sp = (SerialPort)sender;
            int        n  = sp.BytesToRead;

            int count = com.BytesToRead;

            if (count <= 0)
            {
                return;
            }
            byte[] databuffer = new byte[count];
            com.Read(databuffer, 0, count);
            datastring = System.Text.Encoding.Default.GetString(databuffer);

            //线程安全,否则无法修改TexttBox1
            this.TextBox1.Dispatcher.Invoke(
                new Action(
                    delegate
            {
                //listBox1.Items.Add(datastring);
                if ((bool)button_hexshow.IsChecked)
                {
                    char[] values = datastring.ToCharArray();
                    foreach (char letter in values)
                    {
                        int value = Convert.ToInt32(letter);
                        TextBox1.AppendText(String.Format(" {0:X}", value));
                    }
                }
                else
                {
                    TextBox1.AppendText(datastring);
                }

                if (timestramp)
                {
                    TextBox1.AppendText("[");
                    TextBox1.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"));
                    TextBox1.AppendText("]");
                    TextBox1.AppendText("\r\n");
                }
                else
                {
                }

                //TextBox1.AppendText(datastring);
                //需要通过可视树找到listbox里面的那个ScrollViewer,然后通过ScrollToEnd滚动到最后
                Decorator decorator       = (Decorator)VisualTreeHelper.GetChild(TextBox1, 0);
                ScrollViewer scrollViewer = (ScrollViewer)decorator.Child;
                scrollViewer.ScrollToEnd();
            }));
        }
Beispiel #12
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            using (PowerShell PowerShellInstance = PowerShell.Create())
            {
                var PSScript = "Get-Service";

                // use "AddScript" to add the contents of a script file to the end of the execution pipeline.
                // use "AddCommand" to add individual commands/cmdlets to the end of the execution pipeline.
                PowerShellInstance.AddScript(PSScript);

                Collection <PSObject> PSO = PowerShellInstance.Invoke();

                if (PowerShellInstance.Streams.Error.Count > 0)
                {
                    // var error = PowerShellInstance.Streams.Error as Collection<ErrorRecord>;
                    var error = PowerShellInstance.Streams.Error.ReadAll() as Collection <ErrorRecord>;
                    if (error != null)
                    {
                        foreach (ErrorRecord er in error)
                        {
                            TextBox1.AppendText("[PowerShell]: Error in cmdlet: " + er.Exception.Message + "\n");
                        }
                    }
                    return;
                }

                if (PSO.Count() == 0)

                {
                    TextBox1.AppendText("Null PS object was returned during the script" + "\n");
                }


                // loop through each output object item
                foreach (dynamic outputItem in PSO.ToList())
                {
                    // if null object was dumped to the pipeline during the script then a null
                    // object may be present here. check for null to prevent potential NRE.

                    if (outputItem == null)

                    {
                        TextBox1.AppendText("Null null object was dumped to the pipeline during the PS script" + "\n");
                    }

                    if (outputItem != null)

                    {
                        //TODO: do something with the output item
                        TextBox1.AppendText(outputItem.DisplayName + "\n");
                    }
                }
            }
        }
        private async Task button_work()
        {
            button.IsEnabled  = false;
            button1.IsEnabled = false;
            await GetIdsTask();

            TextBox1.AppendText("---> Сканирование запущено " + DateTime.Now.ToString() + ".\n");
            WorkTask();
            button.IsEnabled  = true;
            button1.IsEnabled = true;
        }
Beispiel #14
0
        private void DeactivateMouseHook()
        {
            bool ret = UnhookWindowsHookEx(hHook);

            hHook = 0;
            System.Windows.Application.Current.Dispatcher.Invoke(       //Invoke hooks on main thread.
                () =>
            {
                TextBox1.AppendText("Mouse Called Unhook: " + ret + "\r\n");
            });
        }
Beispiel #15
0
 void TranscodeLog(string strText)
 {
     if (InvokeRequired)
     {
         this.Invoke(new Action <string>(TranscodeLog), new object[] { strText });
         return;
     }
     if (checkBox2.Checked == true)
     {
         TextBox1.AppendText(strText + Environment.NewLine);
     }
 }
Beispiel #16
0
 private async void button2_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         await button_update();
     }
     catch (Exception ex)
     {
         TextBox1.AppendText("Ошибка:" + ex.Message + ".\n");
         TextBox1.AppendText("<--- Сканирование остановлено " + DateTime.Now.ToString() + ".\n");
         button.IsEnabled  = true;
         button1.IsEnabled = true;
         button2.IsEnabled = true;
     }
 }
Beispiel #17
0
        //侦听客户连接请求
        public void runAs()
        {
            while (true)
            {
                this.Dispatcher.Invoke(new Action(() => { TextBox1.AppendText("Waiting for Connection\r\n"); }));
                connection = listener.AcceptSocket();
                //在新线程中启动新的socket连接,每个socket等待,并保持连接

                IPEndPoint iprm = (IPEndPoint)connection.RemoteEndPoint;
                this.Dispatcher.Invoke(new Action(() => { TextBox1.AppendText("远程主机:" + iprm.Address.ToString() + ":" + iprm.Port.ToString() + "连接上本机\r\n"); }));
                Thread thread   = new Thread(new ThreadStart(dealClient));
                Thread myThread = new Thread(dealClient);
                thread.Start();
            }
        }
Beispiel #18
0
        //Launch HVA on Meditech Launch Event
        private void Watcher_EventArrived(object sender, EventArrivedEventArgs e)
        {
            //Do stuff with the startup event
            //TextBox1.AppendText("Watcher_EventArrived");
            trayIcon.Icon = HVA_TrayApp.Properties.Resources.HVA_On;
            trayIcon.Text = "Meditech is running.";
            const int WM_USER = 0x400;

            //MainWindow.VisibilityProperty.
            //Form2.GetWindowRect(Form2.GetForegroundWindow(), r)
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            //NotifyIcon1.Icon = My.Resources.HVA_On;
            //NotifyIcon1.Text = "Meditech is Running";
            this.Dispatcher.Invoke(() =>
            {
                TextBox1.Clear();
            });
            dynamic procName = Process.GetProcessesByName("T");

            foreach (Process procs in procName)
            {
                UpdateTextBox(procs.Id);
            }

            ProcessStartInfo startInfo = new ProcessStartInfo("\\\\CWDVV1DVAC01\\C$\\Users\\HVU7259\\Desktop\\hva-valuebar.exe");

            //startInfo.FileName = "\\\\CWDVV1DVAC01\\C$\\Users\\HVU7259\\Desktop\\hva-valuebar.exe";
            //startInfo.RedirectStandardInput = true;
            //startInfo.RedirectStandardOutput = false;
            startInfo.UseShellExecute = false;
            startInfo.WindowStyle     = ProcessWindowStyle.Hidden;

            proc = Process.Start(startInfo); //Path to HVA GUI

            Thread.Sleep(300);               //Wait for

            hvaHwnd = Form2.WinGetHandle("HVA Valuebar");
            // RichTextBox1.AppendText("HVA Handle: " & Form2.GetActiveWindowTitle(Form2.GetForegroundWindow()) & vbCrLf)

            SendMessage(hvaHwnd, WM_USER + 1000, (IntPtr)0, IntPtr.Zero);
            ProcessThreadCollection currentThreads = Process.GetCurrentProcess().Threads;

            this.Dispatcher.Invoke(() =>
            {
                TextBox1.AppendText("HVA Bar Handle: " + hvaHwnd.ToString() + "\r\n");
            });
            //, CType(Location.Left + (Location.Top - 80 << 16), IntPtr), CType((Location.Right - Location.Left) + (10 << 16), IntPtr)
        }
Beispiel #19
0
 private void Button_update_Click(object sender, RoutedEventArgs e)
 {
     TextBox1.Text = "YouTube Data API: Playlist Updates\r\n";
     try
     {
         YoutubePlylist().Wait();
     }
     catch (AggregateException ex)
     {
         foreach (var ee in ex.InnerExceptions)
         {
             TextBox1.Text = "Error: " + ee.Message;
         }
     }
     TextBox1.AppendText("선택할 재생목록을 입력해주세요\r\n");
 }
Beispiel #20
0
        private async Task YoutubePlylist()
        {
            TextBox1.AppendText("Run Start\r\n");
            UserCredential credential;

            using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
            {
                credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    // This OAuth 2.0 access scope allows for full read/write access to the
                    // authenticated user's account.
                    new[] { YouTubeService.Scope.Youtube },
                    "user",
                    CancellationToken.None,
                    new FileDataStore(this.GetType().ToString())
                    );
            }
            var youtubeService = new YouTubeService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = this.GetType().ToString()
            });
            var lRequest = youtubeService.Playlists.List("snippet");

            lRequest.Mine = true;
            var result = lRequest.Execute();

            for (int i = 0; i < result.Items.Count; i++)
            {
                TextBox1.AppendText("======================\r\n재생목록" + (i + 1) + " " + result.Items[i].Snippet.Title + "\r\n");
                //TextBox1.AppendText("제목 : " + result.Items[i].Snippet.Title + "\r\n");
                var resItem = youtubeService.PlaylistItems.List("snippet");
                resItem.PlaylistId = result.Items[i].Id;
                var resitem2 = resItem.Execute();
                //Console.WriteLine(resitem2.Items.Count);
                //Console.WriteLine(result.Items[i].Snippet.Title);
                for (int j = 0; j < resitem2.Items.Count; j++)
                {
                    TextBox1.AppendText(resitem2.Items[j].Snippet.Title + "\r\n");
                }
                TextBox1.AppendText("======================\r\n");
            }
        }
Beispiel #21
0
        private async Task Run_lyric()
        {
            String callUrl = "http://lyrics.alsong.co.kr/alsongwebservice/service1.asmx";

            string title  = TextBoxPlayname.Text;
            string artist = TextBoxPlayartist.Text;

            //String postData = "<?xml version=" + '\u0022' + "1.0" + '\u0022' + " encoding=" + '\u0022' + "UTF-8" + '\u0022' + "?>" + "<SOAP-ENV:Envelope  xmlns:SOAP-ENV=" + '\u0022' + "http://www.w3.org/2003/05/soap-envelope" + '\u0022' + " xmlns:SOAP-ENC=" + '\u0022' + "http://www.w3.org/2003/05/soap-encoding" + '\u0022' + " xmlns:xsi=" + '\u0022' + "http://www.w3.org/2001/XMLSchema-instance" + '\u0022' + " xmlns:xsd=" + '\u0022' + "http://www.w3.org/2001/XMLSchema" + '\u0022' + " xmlns:ns2=" + '\u0022' + "ALSongWebServer/Service1Soap" + '\u0022' + " xmlns:ns1=" + '\u0022' + "ALSongWebServer" + '\u0022' + " xmlns:ns3=" + '\u0022' + "ALSongWebServer/Service1Soap12" + '\u0022' + ">" + "<SOAP-ENV:Body>" + "<ns1:GetLyric5>" + "<ns1:stQuery>" + "<ns1:strChecksum>" + musicmd5 + "</ns1:strChecksum>" + "<ns1:strVersion>3.36</ns1:strVersion>" + "<ns1:strMACAddress>00ff667f9a08</ns1:strMACAddress>" + "<ns1:strIPAddress>xxx.xxx.xxx.xxx</ns1:strIPAddress>" + "</ns1:stQuery>" + "</ns1:GetLyric5>" + "</SOAP-ENV:Body>" + "</SOAP-ENV:Envelope>";
            String xml_string = "<?xml version=" + '\u0022' + "1.0" + '\u0022' + " encoding=" + '\u0022' + "UTF-8" + '\u0022' + "?><SOAP-ENV:Envelope xmlns:SOAP-ENV=" + '\u0022' + "http://www.w3.org/2003/05/soap-envelope" + '\u0022' + " xmlns:SOAP-ENC=" + '\u0022' + "http://www.w3.org/2003/05/soap-encoding" + '\u0022' + " xmlns:xsi=" + '\u0022' + "http://www.w3.org/2001/XMLSchema-instance" + '\u0022' + " xmlns:xsd=" + '\u0022' + "http://www.w3.org/2001/XMLSchema" + '\u0022' + " xmlns:ns2=" + '\u0022' + "ALSongWebServer/Service1Soap" + '\u0022' + " xmlns:ns1=" + '\u0022' + "ALSongWebServer" + '\u0022' + " xmlns:ns3=" + '\u0022' + "ALSongWebServer/Service1Soap12" + '\u0022' + "><SOAP-ENV:Body><ns1:GetResembleLyric2><ns1:stQuery><ns1:strTitle>" + title + "</ns1:strTitle><ns1:strArtistName>" + artist + "</ns1:strArtistName><ns1:nCurPage>0</ns1:nCurPage></ns1:stQuery></ns1:GetResembleLyric2></SOAP-ENV:Body></SOAP-ENV:Envelope>";

            //Console.WriteLine("{0}", xml_string);
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(callUrl);

            // 인코딩 UTF-8
            byte[] sendData = UTF8Encoding.UTF8.GetBytes(xml_string);
            httpWebRequest.ContentType   = "application/soap+xml; charset=UTF-8";
            httpWebRequest.UserAgent     = "gSOAP/2.7";
            httpWebRequest.Method        = "POST";
            httpWebRequest.ContentLength = sendData.Length;
            Stream requestStream = httpWebRequest.GetRequestStream();

            requestStream.Write(sendData, 0, sendData.Length);
            requestStream.Close();
            HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            StreamReader    streamReader    = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.GetEncoding("UTF-8"));
            string          respone         = streamReader.ReadToEnd();
            XmlDocument     xdoc            = new XmlDocument();

            xdoc.LoadXml(respone);
            //이거 아직 예외 처리 안함
            XmlNodeList xnList        = xdoc.SelectNodes("Body/GetResembleLyric2Response/GetResembleLyric2Result/ST_GET_RESEMBLELYRIC2_RETURN");
            string      alsong_name   = xdoc.ChildNodes[1].FirstChild.FirstChild.FirstChild.FirstChild["strTitle"].InnerText;
            string      alsong_artist = xdoc.ChildNodes[1].FirstChild.FirstChild.FirstChild.FirstChild["strArtistName"].InnerText;
            string      lyric         = xdoc.ChildNodes[1].FirstChild.FirstChild.FirstChild.FirstChild["strLyric"].InnerText;

            string[] tokens = lyric.Split(new[] { "<br>" }, StringSplitOptions.None);
            TextBox1.Text = "";
            foreach (var word in tokens)
            {
                TextBox1.AppendText(word + "\r\n");
            }
        }
Beispiel #22
0
        private async Task button_update()
        {
            button.IsEnabled         = false;
            button1.IsEnabled        = false;
            button2.IsEnabled        = false;
            tabControl.SelectedIndex = 1;
            conn = new MySqlConnection("server=185.159.129.209;user=root;database=catpost_content_vk;password=test1234;Character Set=utf8mb4;");
            conn.Open();
            MySqlCommand cmd_ = new MySqlCommand("set net_write_timeout=99999; set net_read_timeout=99999", conn); // Setting tiimeout on mysqlServer

            cmd_.ExecuteNonQuery();
            await GetIdsTask(true);

            TextBox1.AppendText("---> Обновление запущено " + DateTime.Now.ToString() + ".\n");
            await WorkTask(true);

            button.IsEnabled  = true;
            button1.IsEnabled = true;
            button2.IsEnabled = true;
        }
Beispiel #23
0
 private void TextBox1_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Enter)
         {
             int    linenumber = GetLineNumber();
             string strMsg;
             strMsg = TextBox1.Lines[linenumber - 1];
             // Just ignore first character ">" which we placed there before
             strMsg = strMsg.Substring(1);
             UpdateLog(this, new UpdateTestArgs(UpdateTestAction.UpdateLog,
                                                "Operator " + PortName, strMsg));
             // Send to Port here
             QFManager.Port.Transmit(PortName, strMsg);
             TextBox1.AppendText(">");
         }
     }
     catch { }
 }
Beispiel #24
0
        private void ActivateMouseHook()
        {
            if (hHook == 0)
            {
                MouseHookProcedure = new HookProc(MouseHookProc);
                hHook = SetWindowsHookEx(WH_MOUSE_LL,
                                         MouseHookProcedure,
                                         Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]),
                                         0);
            }

            System.Windows.Application.Current.Dispatcher.Invoke(       //Invoke hooks on main thread.
                () =>
            {
                TextBox1.AppendText("Mouse Hooked: " + hHook + "\r\n");
            });
            //System.Windows.Forms.MessageBox.Show("Mouse Hooked: " + hHook);

            //m_timer = new System.Threading.Timer(mouseTimerTick, null, 30000, 30000);
        }
Beispiel #25
0
        public void splitter(string s)
        {
            TextBox1.AppendText(s);
            Regex  Gcode = new Regex("([GXYZIJPMS][+-]?[0-9]*\\.?[0-9]*)");
            string g     = Gcode.Match(s).ToString();


            MatchCollection collect = Gcode.Matches(s);
            string          Offset;   //g54-g59,
            string          Interpol; //g41,g42,g40
            string          Replace;  //g0,g1,g2,g3
            string          Cycle;    //g81,g82,g83,g84,g85,g80
            string          X_p, Y_p, Z_p;
            string          X_n, Y_n, Z_n;
            int             spSpeed, feed;
            int             modul, coolant, prStop, spindle; //m8-m9|m3-m5

            foreach (Match m in collect)
            {
                TextBox2.AppendText(m.Value);
                if (m.Value.StartsWith("X"))
                {
                    X_n            = m.Value.ToString().Replace("X", "");
                    x_cord.Content = X_n;
                    X_p            = X_n;
                }
                if (m.Value.StartsWith("Y"))
                {
                    Y_n            = m.Value.ToString().Replace("Y", "");
                    y_cord.Content = Y_n;
                    Y_p            = Y_n;
                }
                if (m.Value.StartsWith("Z"))
                {
                    Z_n            = m.Value.ToString().Replace("Z", "");
                    z_cord.Content = Z_n;
                    Z_p            = Z_n;
                }
            }
            TextBox2.AppendText("\n");
        }
Beispiel #26
0
 private void ÄnderungDurchClick()
 {
     TextBox1.Clear();
     TextBox1.AppendText("Start Kategorien anzeigen.");
     try {
         ItemCollection items = treeKategorie.Items;
         foreach (Kategorie kat1 in items)
         {
             if (!kat1.IsChecked == null)
             {
                 if (kat1.IsChecked == true)
                 {
                     TextBox1.AppendText(Environment.NewLine + kat1.KatName);
                 }
             }
             foreach (Kategorie kat2 in kat1.KatChildren)
             {
                 if (kat2.IsChecked == true)
                 {
                     TextBox1.AppendText(Environment.NewLine + "  " + kat2.KatName);
                 }
                 foreach (Kategorie kat3 in kat2.KatChildren)
                 {
                     if (kat3.IsChecked == true)
                     {
                         TextBox1.AppendText(Environment.NewLine + "   " + kat3.KatName);
                     }
                     foreach (Kategorie kat4 in kat3.KatChildren)
                     {
                         if (kat4.IsChecked == true)
                         {
                             TextBox1.AppendText(Environment.NewLine + "    " + kat4.KatName);
                         }
                     }
                 }
             }
         }
     } catch (Exception ex) {
         MessageBox.Show("Fehler: " + ex);
     }
 }
Beispiel #27
0
        private void WindowBase_Loaded(object sender, RoutedEventArgs e)
        {
            //System.Windows.Resources.StreamResourceInfo sri = Application.GetResourceStream(new Uri("/Images/bg01.jpg", UriKind.RelativeOrAbsolute));
            //Console.WriteLine(sri.ContentType);

            //System.Windows.Media.Imaging.BitmapImage image = new BitmapImage();
            //image.BeginInit();
            //image.StreamSource = sri.Stream;
            //image.EndInit();
            //Image1.Source = image;

            //System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly(this.GetType());
            //string resourceName = assembly.GetName().Name + ".g";
            //System.Resources.ResourceManager rsManager = new System.Resources.ResourceManager(resourceName, assembly);
            //using (System.Resources.ResourceSet set = rsManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true))
            //{
            //    System.IO.UnmanagedMemoryStream umn = (System.IO.UnmanagedMemoryStream)set.GetObject("Images/bg01.jpg", true);
            //    System.Windows.Media.Imaging.BitmapImage image = new BitmapImage();
            //    image.BeginInit();
            //    image.StreamSource = umn;
            //    image.EndInit();
            //    Image1.Source = image;
            //}

            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly(this.GetType());
            string resourceName = assembly.GetName().Name + ".g";

            System.Resources.ResourceManager rsManager = new System.Resources.ResourceManager(resourceName, assembly);
            using (System.Resources.ResourceSet set = rsManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true))
            {
                foreach (System.Collections.DictionaryEntry res in set)
                {
                    TextBox1.AppendText(res.Key.ToString());
                    TextBox1.AppendText("\t");
                    TextBox1.AppendText(res.Value.GetType().ToString());
                    TextBox1.AppendText("\r");
                }
            }
        }
Beispiel #28
0
        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            Generator generator = new Generator();


            string readnum = TextBox1.Text;           //Записываем количество паролей из формы в переменную

            if (String.IsNullOrEmpty(TextBox1.Text))  //Проверяем пустая строка или нет?
            {
                TextBox1.Clear();
                TextBox1.AppendText("");
                readnum = "-1";
            }

            int pnum = 0;

            try
            {
                pnum = Convert.ToInt32(readnum);      //Конвертируем количество паролей в int
            }
            catch (OverflowException)
            {
                MessageBox.Show("Слишком большое число, ты переполняешь мою память\n(〃∇〃 )");
                TextBox1.Clear();
            }


            string readlen = TextBox2.Text;           //Записываем длину паролей из формы в переменную

            if (String.IsNullOrEmpty(TextBox2.Text))  //Проверяем пустая строка или нет?
            {
                TextBox2.Clear();
                TextBox2.AppendText("");
                readlen = "-1";
            }

            int plength = 0;

            try
            {
                plength = Convert.ToInt32(readlen);   //Конвертируем длину паролей в int
            }
            catch (OverflowException)
            {
                MessageBox.Show("Слишком большое число, ты переполняешь мою память\n(〃∇〃 )");
                TextBox2.Clear();
            }

            //
            // Генерация паролей
            //
            richBoxText1.Clear(); //Очищаем box


            if (Convert.ToBoolean(checkbox1.IsChecked))                           //Проверка checkbox'a
            {
                for (int y = 0; y < pnum; y++)                                    //Цикл работающий по количеству паролей
                {
                    richBoxText1.AppendText(y + 1 + ") ");                        //Добавляем нумерацию
                    string[] pswdsexit      = generator.GenPasswd(pnum, plength); //Вызываем генератор
                    string   pswdsConverted = Convert.ToString(pswdsexit[y]);     //Конвертируем 1 пароль из массива в строчное
                    richBoxText1.AppendText(pswdsConverted);                      //Выводим 1 пароль
                    richBoxText1.Text += Environment.NewLine;                     //Переходим на новую строку
                }
            }
            else
            {
                for (int y = 0; y < pnum; y++)                                    //Цикл работающий по количеству паролей
                {
                    string[] pswdsexit      = generator.GenPasswd(pnum, plength); //Вызываем генератор
                    string   pswdsConverted = Convert.ToString(pswdsexit[y]);     //Конвертируем 1 пароль из массива в строчное
                    richBoxText1.AppendText(pswdsConverted);                      //Выводим 1 пароль
                    richBoxText1.Text += Environment.NewLine;                     //Переходим на новую строку
                }
            }
        }
Beispiel #29
0
        private async Task WorkTask(bool Update = false)
        {
            foreach (Ids id in ids)
            {
                scanned    = 0;
                post_count = 0;
                attachments.Clear();
                if (id.type == "group")
                {
                    TextBox1.AppendText("Сканируем группу http://vk.com/club" + id.Id + ".\n");
                }
                else
                {
                    TextBox1.AppendText("Сканируем пользователя http://vk.com/id" + id.Id + ".\n");
                }
                TextBox1.AppendText("Всего записей " + id.Count + ".\n");

                string       sql = "SELECT vk_id FROM groups_and_users WHERE type=@type AND vk_id=@id";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.Prepare();
                cmd.Parameters.AddWithValue("@type", id.type);
                cmd.Parameters.AddWithValue("@id", id.Id);
                MySqlDataReader reader = cmd.ExecuteReader();
                bool            post_exist_in_database = false;
                while (reader.Read())
                {
                    post_exist_in_database = true;
                }
                reader.Close();
                if (!post_exist_in_database)
                {
                    string       insert = "INSERT INTO groups_and_users (vk_id, type, name) VALUES(@id, @type, @name);";
                    MySqlCommand cmd1   = new MySqlCommand(insert, conn);
                    cmd1.Prepare();
                    cmd1.Parameters.AddWithValue("@id", id.Id);
                    cmd1.Parameters.AddWithValue("@type", id.type);
                    cmd1.Parameters.AddWithValue("@name", id.Name);
                    cmd1.ExecuteNonQuery();
                }

                int taskCount = id.Count / tasks_count + 1;
                if (Update)
                {
                    taskCount = 1;
                }

                string       sql_save_count1     = "SELECT scanned FROM groups_and_users WHERE vk_id = @vk_id";
                MySqlCommand sql_save_count_cmd1 = new MySqlCommand(sql_save_count1, conn);
                sql_save_count_cmd1.Prepare();
                sql_save_count_cmd1.Parameters.AddWithValue("@vk_id", id.Id);
                var reader1       = sql_save_count_cmd1.ExecuteReader();
                int scanned_count = 0;
                while (reader1.Read())
                {
                    string str = reader1["scanned"].ToString();
                    if (str == "")
                    {
                        scanned_count = 0;
                    }
                    else
                    {
                        scanned_count = int.Parse(str);
                    }
                }
                reader1.Close();

                if (scanned_count == id.Count)
                {
                    TextBox1.AppendText("Группа уже просканирована...\n");
                    continue;
                }

                if (scanned_count > 0)
                {
                    TextBox1.AppendText("Продолжаем сканирование...\n");
                }
                else
                {
                    TextBox1.AppendText("Сканируем...\n");
                }

                int a = 0;
                for (int i = 0; i < taskCount; i++)
                {
                    int count = 0;
                    if (i == 0 && !Update)
                    {
                        i       = scanned_count / tasks_count;
                        scanned = scanned_count;
                    }
                    int    global_offset1 = (a + i) * tasks_count;
                    int    scanid         = id.Id;
                    string type           = id.type;
                    int    added_posts    = 0;
                    if (Update)
                    {
                        if (id.Count > 100)
                        {
                            count = 100;
                        }
                        else
                        {
                            count = id.Count;
                        }
                    }
                    else
                    {
                        if (i + 1 == taskCount)
                        {
                            count = id.Count % tasks_count;
                        }
                        else
                        {
                            count = tasks_count;
                        }
                    }
                    if (id.type == "user")
                    {
                        added_posts = await Task.Run(() =>
                        {
                            return(Scan(id.Id, id.type, global_offset1, count));
                        });
                    }
                    else
                    {
                        added_posts = await Task.Run(() =>
                        {
                            return(Scan(-1 * id.Id, id.type, global_offset1, count));
                        });
                    }
                    scanned    += count;
                    post_count += added_posts;
                    TextBox1.AppendText("Просканировано " + scanned + " добавлено в базу " + post_count + " всего постов " + id.Count + ".\n");
                    if (!Update)
                    {
                        string       sql_save_count     = "UPDATE groups_and_users SET scanned=@scanned WHERE vk_id = @vk_id";
                        MySqlCommand sql_save_count_cmd = new MySqlCommand(sql_save_count, conn);
                        sql_save_count_cmd.Prepare();
                        sql_save_count_cmd.Parameters.AddWithValue("@scanned", scanned);
                        sql_save_count_cmd.Parameters.AddWithValue("@vk_id", id.Id);
                        sql_save_count_cmd.ExecuteNonQuery();
                    }
                    else
                    {
                        if (scanned_count >= id.Count - 100)
                        {
                            string       sql_save_count     = "UPDATE groups_and_users SET scanned=@scanned WHERE vk_id = @vk_id";
                            MySqlCommand sql_save_count_cmd = new MySqlCommand(sql_save_count, conn);
                            sql_save_count_cmd.Prepare();
                            sql_save_count_cmd.Parameters.AddWithValue("@scanned", id.Count);
                            sql_save_count_cmd.Parameters.AddWithValue("@vk_id", id.Id);
                            sql_save_count_cmd.ExecuteNonQuery();
                        }
                    }
                }
            }
            if (!Update)
            {
                TextBox1.AppendText("<--- Сканирование завершено " + DateTime.Now.ToString() + ".\n");
            }
            else
            {
                TextBox1.AppendText("<--- Обновление завершено " + DateTime.Now.ToString() + ".\n");
            }
        }
Beispiel #30
0
        private async Task GetIdsTask(bool update = false)
        {
            ids.Clear();
            TextBox1.AppendText("---------------------------------------------\n");
            TextBox1.AppendText("Текущий пользователь " + window.User + "!\n");

            if (!update)
            {
                int lineCount = TextBox.LineCount;
                for (int line = 0; line < lineCount; line++)
                {
                    string str = TextBox.GetLineText(line).Trim().Replace(Environment.NewLine, "");
                    Thread.Sleep(1000);
                    if (str != "")
                    {
                        Ids id  = new Ids();
                        int gId = await GetGroupIdTask(str);

                        if (gId != -1)
                        {
                            id.Id   = gId;
                            id.type = "group";
                            id.Name = str;
                            if (!idExist(gId))
                            {
                                int post_counts = await GetCountTask(gId, "group");

                                if (post_counts != -1)
                                {
                                    id.Count = post_counts;
                                    ids.Add(id);
                                    TextBox1.AppendText("Группа " + id.Name + " (id = " + id.Id + ") имеет " + id.Count + " постов. Группа добавлена в очередь.\n");
                                }
                                else
                                {
                                    TextBox1.AppendText("Группа " + id.Name + " (id = " + id.Id + ") - ошибка взятия количества постов. Группа не добавлена.\n");
                                }
                            }
                            else
                            {
                                TextBox1.AppendText("Группа " + id.Name + " (id = " + id.Id + ") - уже в очереди сканирования.\n");
                            }
                        }
                        else
                        {
                            int UserId = await GetUserIdTask(str);

                            if (UserId != -1)
                            {
                                id.Id   = UserId;
                                id.type = "user";
                                id.Name = str;
                                if (!idExist(UserId))
                                {
                                    int post_counts = await GetCountTask(UserId, "user");

                                    if (post_counts != -1)
                                    {
                                        id.Count = post_counts;
                                        ids.Add(id);
                                        TextBox1.AppendText("Пользователь  " + id.Name + " (id = " + id.Id + ") имеет " + id.Count + " постов. Пользователь добавлен в очередь.\n");
                                    }
                                    else
                                    {
                                        TextBox1.AppendText("Пользователь " + str + " (id = " + UserId + ") - ошибка взятия количества постов.\n");
                                    }
                                }
                                else
                                {
                                    TextBox1.AppendText("Пользователь " + id.Name + " (id = " + id.Id + ") - уже в очереди сканирования.\n");
                                }
                            }
                            else
                            {
                                TextBox1.AppendText("Пользователь или группа " + str + " не существует.\n");
                            }
                        }
                    }
                }
            }
            else
            {
                string       sql_groups     = "SELECT name FROM groups_and_users";
                MySqlCommand sql_groups_cmd = new MySqlCommand(sql_groups, conn);
                sql_groups_cmd.Prepare();
                var    reader = sql_groups_cmd.ExecuteReader();
                string str    = "";
                while (reader.Read())
                {
                    str = reader["name"].ToString();
                    Thread.Sleep(1000);
                    if (str != "")
                    {
                        Ids id  = new Ids();
                        int gId = await GetGroupIdTask(str);

                        if (gId != -1)
                        {
                            id.Id   = gId;
                            id.type = "group";
                            id.Name = str;
                            if (!idExist(gId))
                            {
                                int post_counts = await GetCountTask(gId, "group");

                                if (post_counts != -1)
                                {
                                    id.Count = post_counts;
                                    ids.Add(id);
                                    TextBox1.AppendText("Группа " + id.Name + " (id = " + id.Id + ") имеет " + id.Count + " постов. Группа добавлена в очередь.\n");
                                }
                                else
                                {
                                    TextBox1.AppendText("Группа " + id.Name + " (id = " + id.Id + ") - ошибка взятия количества постов. Группа не добавлена.\n");
                                }
                            }
                            else
                            {
                                TextBox1.AppendText("Группа " + id.Name + " (id = " + id.Id + ") - уже в очереди сканирования.\n");
                            }
                        }
                        else
                        {
                            int UserId = await GetUserIdTask(str);

                            if (UserId != -1)
                            {
                                id.Id   = UserId;
                                id.type = "user";
                                id.Name = str;
                                if (!idExist(UserId))
                                {
                                    int post_counts = await GetCountTask(UserId, "user");

                                    if (post_counts != -1)
                                    {
                                        id.Count = post_counts;
                                        ids.Add(id);
                                        TextBox1.AppendText("Пользователь  " + id.Name + " (id = " + id.Id + ") имеет " + id.Count + " постов. Пользователь добавлен в очередь.\n");
                                    }
                                    else
                                    {
                                        TextBox1.AppendText("Пользователь " + str + " (id = " + UserId + ") - ошибка взятия количества постов.\n");
                                    }
                                }
                                else
                                {
                                    TextBox1.AppendText("Пользователь " + id.Name + " (id = " + id.Id + ") - уже в очереди сканирования.\n");
                                }
                            }
                            else
                            {
                                TextBox1.AppendText("Пользователь или группа " + str + " не существует.\n");
                            }
                        }
                    }
                }
                reader.Close();
            }
            TextBox1.AppendText("Очередь групп и пользователей создана! Всего в сканировании " + ids.Count + ".\n");
        }