예제 #1
0
        private async void MainTabControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            string name = nameTextBox.Text;

            if (name.IndexOf("#") != -1)
            {
                string[] splitName = name.Split('#');
                string   trip      = VIPBrowserLibrary.Chron.CreateTrip.Create(splitName[1]);
                name = splitName[0] + " ◆" + trip;
            }
            else if (String.IsNullOrEmpty(name))
            {
                VIPBrowserLibrary.Common.BBSType bt = VIPBrowserLibrary.Common.TypeJudgment.BBSTypeJudg(this.Url);
                string flo = VIPBrowserLibrary.Common.URLParse.DatToFolder(this.Url, bt);
                if (bt != VIPBrowserLibrary.Common.BBSType.machibbs)
                {
                    Dictionary <string, string> data = await VIPBrowserLibrary.Common.GetBoardData.GetBoardDictionary(flo, false);

                    name = data["BBS_NONAME_NAME"];
                }
                else
                {
                    name = "名無しさん";
                }
            }
            string mail     = mailTextBox.Text;
            string sentence = sentenceTextBox.Text;

            sentence = VIPBrowserLibrary.Utility.StringUtility.HTMLEncode(sentence);
            string date  = DateTime.Now.ToString("yyyy/MM/dd(ddd) HH:mm:ss.ff");
            Res    r     = new Res(NowResCount + 1, name, mail, sentence, String.Empty, date, String.Empty, true);
            string datas = ResConvert.SimpleConvertCore(r);

            this.webBrowser1.DocumentText = "<html><head></head><body><font face=\"MS Pゴシック\">\n<dl>\n" + datas + "</body></html>";
        }
예제 #2
0
        void Document_MouseMove(object sender, HtmlElementEventArgs e)
        {
            try
            {
                mshtml.IHTMLDocument2 ihtd = this.DomDocument as IHTMLDocument2;
                IHTMLTxtRange         ihtr = ihtd.selection.createRange() as mshtml.IHTMLTxtRange;
                if (ihtr.text != null)
                {
                    this.searchText = ihtr.text;
                }
                HtmlElement he = this.Document.GetElementFromPoint(e.MousePosition);
                if (he == null)
                {
                    return;
                }
                string htmlCode = he.OuterHtml;
                if (htmlCode.IndexOf("A") == 1)
                {
                    Res[] rc = (Res[])this.Tag;

                    //ResCollection rrr = new ResCollection();
                    Res[]         resData = new Res[this.ThreadData.GetRescount + 1];
                    StringBuilder sb      = new StringBuilder();

                    if (htmlCode.IndexOf("method:Extract", StringComparison.CurrentCultureIgnoreCase) != -1)
                    {
                        string method = String.Empty;
                        if (htmlCode.IndexOf("発信元") == -1)
                        {
                            method = new System.Text.RegularExpressions.Regex(@"method:Extract[(](?<type>..),(?<id>.{1,15})[)]", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(htmlCode).Groups["id"].Value;
                        }
                        else
                        {
                            method = new System.Text.RegularExpressions.Regex(@"method:Extract[(](?<type>..),(?<id>.{1,25})[)]", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(htmlCode).Groups["id"].Value;
                        }
                        //foreach (Res item in rc)
                        //{
                        //    if (method.Replace("ID:", "") == item.ID)
                        //    {
                        //        rrr.Add(item);
                        //    }
                        //}
                        int c = 0;
                        for (int i = 0; i < rc.Length; i++)
                        {
                            if (method == rc[i].ID)
                            {
                                resData[c] = rc[i];
                                c++;
                            }
                        }
                        foreach (Res item in resData)
                        {
                            if (String.IsNullOrEmpty(item.Sentence))
                            {
                                break;
                            }
                            sb.Append(ResConvert.SimpleConvertCore(item));
                        }
                        //MessageBox.Show(sb.ToString().Replace("<br>","\n"));
                        //hp.Show(sb.ToString());

                        hp.Show(sb.ToString());
                        //if (popupChild == -1)
                        //{
                        //    nowPopup = true;
                        //    popupPlaces.Add(new System.Drawing.Point(MousePosition.X, MousePosition.Y));
                        //}
                        //else if (popupChild == 0)
                        //{
                        //    popupPlaces.Add(MousePosition);
                        //    popupChild++;
                        //}
                        //else
                        //{
                        //    popupPlaces.Add(MousePosition);
                        //    popupChild++;
                        //}
                    }
                    else
                    {
                        if (htmlCode.IndexOf("#") == 9 || htmlCode.IndexOf("#") == 20)
                        {
                            string data      = new System.Text.RegularExpressions.Regex(@"<A href=(""about:blank#""|""#"")>&gt;&gt;(?<res>\d*)</A>").Match(htmlCode).Groups["res"].Value;
                            int    resNumber = int.Parse(data);
                            resNumber--;
                            //ResConvert.SimpleConvertCore(rc[resNumber]);
                            //sb.Append(rc[resNumber].Index).Append(": ").Append(rc[resNumber].Name).Append("[" + rc[resNumber].Mail + "]").Append(rc[resNumber].Date + "<br>").Append(rc[resNumber].Sentence + "<br>");
                            //hp.Show(sb.ToString());

                            hp.Show(ResConvert.SimpleConvertCore(rc[resNumber]));
                        }
                    }
                }
                this.HidePopup();
            }
            catch { return; }
        }