示例#1
0
 public void Stop()
 {
     if (thread != null && thread.IsAlive)
     {
         thread.Abort();
         requested = null;
         temp      = null;
         wb        = null;
     }
 }
示例#2
0
        public static List <DiffPiece> SplitIntoPieces(ref string data)
        {
            List <DiffPiece> list = new List <DiffPiece>();

            int    current_starting = 0;
            bool   booltmp;
            string newdata = data;

            while (data.Contains("<tr>"))
            {
                data = data.Substring(data.IndexOf("<tr>") + 4);
                string tr = data.Substring(0, data.IndexOf("</tr>") + 4), newtr = tr;

                string test = data;

                int p = test.IndexOf("</tr>");
                if (p >= 0 && test.Contains("<td"))
                {
                    test = test.Substring(0, p);
                    bool newstart = test.Contains("class=\"diff-lineno\"");

                    test = test.Substring(test.LastIndexOf("<td") + 3);
                    test = test.Substring(test.IndexOf('>') + 1);

                    if (newstart)
                    {
                        string s = "";
                        for (int i = 0; i < test.Length; i++)
                        {
                            if (char.IsNumber(test[i]))
                            {
                                s += test[i];
                            }
                        }
                        if (s != "")
                        {
                            current_starting = int.Parse(s);
                        }
                        newtr = Tools.ReplaceLast(tr, test, test.Replace("</td>", @"<span id=""for_buttons""></span></td>"));
                    }
                    else
                    {
                        string temp = test.Substring(0, test.IndexOf("</td>")).Trim();
                        if (!temp.Equals(""))
                        {
                            DiffPiece dp = new DiffPiece();

                            dp.starting     = current_starting;
                            dp.ready        = false;
                            dp.text         = "";
                            dp.being_edited = false;
                            dp.text         = HttpUtility.HtmlDecode(Tools.StripHtmlTags(temp));
                            if (dp.text.Trim() != "")
                            {
                                list.Add(dp);
                                newtr = Tools.ReplaceLast(tr, ">" + test, " myindex=\"" + list.Count + "\">" + @"<a href=""about:edit"" class=""editbutton"" style=""visibility:hidden;"" buttonid=""" + list.Count + @""" id=""button_edit_" + list.Count + @"""><img class=""editimg""></a>" + test);
                            }
                        }
                    }
                }
                if (tr != newtr)
                {
                    newdata = Tools.ReplaceFirst(newdata, tr, newtr);
                }
            }
            data = newdata;
            return(list);
        }