Пример #1
0
        protected override void afterread(string input)
        {
            try
            {
                List <TreeNode> child = new List <TreeNode>();
                for (Match m = THREAD.Match(input); m.Success; m = m.NextMatch())
                {
                    string   size  = m.Groups["size"].Value;
                    string   url   = m.Groups["url"].Value;
                    string   title = m.Groups["title"].Value;
                    string   date  = m.Groups["date"].Value;
                    TreeNode add   = new ThreadTreeNode("http://www.logsoku.com" + url, DateTime.Parse(date), size, title);
                    child.Add(add);
                }
                if (root)
                {
                    TreeNode node1 = new TreeNode("1");
                    node1.Nodes.AddRange(child.ToArray());
                    this.Nodes.Add(node1);

                    string size = SIZE.Match(input).Groups["size"].Value;
                    for (int i = 1; i < (int.Parse(size) / 50); i++)
                    {
                        this.Nodes.Add(new LogsokuTreeNode(id, false, "" + (i + 1)));
                    }
                }
                else
                {
                    this.Nodes.AddRange(child.ToArray());
                }
            }
            catch (Exception e) { System.Console.WriteLine(e); }
        }
Пример #2
0
        public static ThreadTreeNode copy(ThreadTreeNode src)
        {
            ThreadTreeNode result = new ThreadTreeNode(src.url, src.create, src.resNum, src.title);

            result.Text = src.Text;
            return(result);
        }
Пример #3
0
        protected override void afterread(string input)
        {
            List <TreeNode> children  = new List <TreeNode>();
            Regex           regexThis = (THREAD.IsMatch(input)) ? THREAD : THREAD2;

            for (Match m = regexThis.Match(input); m.Success; m = m.NextMatch())
            {
                try
                {
                    string   cUrl    = m.Groups["url"].Value;
                    string   num     = m.Groups["num"].Value;
                    string   title   = m.Groups["title"].Value;
                    string[] split   = cUrl.Split('/');
                    string   dateStr = split[4];
                    // レス数が少ない場合は作らない
                    if (long.Parse(num) < 50)
                    {
                        continue;
                    }
                    DateTime         cCreate = Lib.UNIXTIME.AddSeconds(long.Parse(dateStr));
                    AbstractTreeNode child   = new ThreadTreeNode(URLREP.Replace(url, "net" + cUrl), cCreate, "(" + num + ")", title);
                    children.Add(child);
                }
                catch { }
            }

            if (MENUREP.IsMatch(url))
            {
                for (Match m = MENU.Match(input); m.Success; m = m.NextMatch())
                {
                    try
                    {
                        string        cUrl  = m.Groups["url"].Value.Substring(2);
                        string[]      range = m.Groups["range"].Value.Split('-');
                        KakoTreeNode2 child = new KakoTreeNode2(MENUREP.Replace(url, cUrl));
                        child.isClear = false;
                        child.Text    = Lib.UNIXTIME.AddSeconds(long.Parse(range[1])).ToString() + "-" + Lib.UNIXTIME.AddSeconds(long.Parse(range[0])).ToString();
                        this.Nodes.Add(child);
                    }
                    catch { }
                }

                TreeNode kako0001  = new TreeNode();
                string[] hereRange = HERE.Match(input).Groups["text"].Value.Split('-');
                kako0001.Text = Lib.UNIXTIME.AddSeconds(long.Parse(hereRange[1])).ToString() + "-" + Lib.UNIXTIME.AddSeconds(long.Parse(hereRange[0])).ToString();
                kako0001.Nodes.AddRange(children.ToArray());
                this.Nodes.Insert(0, kako0001);
            }
            else
            {
                this.Nodes.AddRange(children.ToArray());
            }
        }
Пример #4
0
 protected override void afterread(string input)
 {
     foreach (string str in input.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
     {
         if (str.StartsWith("<a") && str.Contains("l50") && !str.Contains("浪人はこんなに便利"))
         {
             int              start   = str.IndexOf("\"") + 1;
             string           dateStr = str.Substring(start, str.IndexOf("/") - start);
             string[]         split   = url.Split('/');
             DateTime         create  = Lib.UNIXTIME.AddSeconds(long.Parse(dateStr));
             AbstractTreeNode child   = new ThreadTreeNode("http://" + split[2] + "/test/read.cgi/" + split[3] + "/" + dateStr + "/",
                                                           create, str.Substring(str.LastIndexOf("(")).Replace("</a>", ""), str.Substring(str.IndexOf(":") + 1).Trim());
             this.Nodes.Add(child);
         }
     }
 }
Пример #5
0
        protected override void afterread(string input)
        {
            List <TreeNode> children = new List <TreeNode>();

            foreach (string str in input.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
            {
                string resNum = str.Substring(str.LastIndexOf("("));
                // レス数が少ない場合は作らない
                if (long.Parse(resNum.Replace("(", "").Replace(")", "")) > 50)
                {
                    string           dateStr = str.Substring(0, str.IndexOf(".dat"));
                    string[]         split   = url.Split('/');
                    DateTime         create  = Lib.UNIXTIME.AddSeconds(long.Parse(dateStr));
                    AbstractTreeNode child   = new ThreadTreeNode("http://" + split[2] + "/test/read.cgi/" + split[3] + "/" + dateStr + "/",
                                                                  create, resNum, str.Substring(str.IndexOf(">") + 1).Trim());
                    children.Add(child);
                }
            }
            children.Sort(new TreeNodeSoreter());
            this.Nodes.AddRange(children.ToArray());
        }
Пример #6
0
 private void addSimilarNode(string s, TreeNodeCollection nodes)
 {
     foreach (TreeNode sibling in nodes)
     {
         if (sibling is ThreadTreeNode)
         {
             ThreadTreeNode target   = sibling as ThreadTreeNode;
             string         repTitle = DELETE.Replace(target.title, "");
             string         t        = repTitle.Substring(0, (repTitle.Length >= 5) ? 5 : repTitle.Length);
             if (2 > Lib.LevenshteinDistance(s, t))
             {
                 ThreadTreeNode add = ThreadTreeNode.copy((ThreadTreeNode)sibling);
                 add.Nodes.Clear();
                 this.Nodes.Add(add);
             }
         }
         else
         {
             addSimilarNode(s, sibling.Nodes);
         }
     }
 }