Beispiel #1
0
        public void AddRev_last(tl a, tl b, int type, Element el, bool restart = true)
        {
            ClearList();
            if (a == null)
            {
                a = b; b = null;
            }
            RevDiffData dd = new RevDiffData();

            dd.a    = a.revision; dd.b = b.revision; dd.type = type; dd.page = el.page; dd.el = el;
            dd.rand = a.rand + (b != null?b.rand:0);
            list.Add(dd);

            if (restart)
            {
                RunThread();
            }
        }
Beispiel #2
0
        private void _thread_function()
        {
            // MessageBox.Show("start_thread");
st:
            rt             = false;
            thread_restart = false;
            try
            {
                thread_running = true;
                stop_thread    = false;
                long tmpl;

                int  current_max = Options.GetOptionInt("buff3");
                bool skipifnull  = Options.GetOptionInt("skip_null") == 1 ? true : false;
                // MessageBox.Show(current_max + "");

                //  DiffData dd;
                CheckAllEvents();
                RevDiffData tmp = new RevDiffData();

                for (int a = 0; a < list.Count; a++)
                {
                    double rand = list[a].rand;
                    CheckAllEvents();
                    if (a == current_max)
                    {
                        thread_running = false; return;
                    }
                    if (stop_thread)
                    {
                        thread_running = false; return;
                    }
                    if (thread_restart)
                    {
                        goto st;
                    }
                    if (list[a].data.Equals(""))
                    {
                        //
                        for (int b = 0; b < (a < 2 ? 2 : 1); b++)
                        {
                            tmp = list[a];

                            CheckAllEvents();

                            if (thread_restart)
                            {
                                goto st;
                            }

                            if (stop_thread)
                            {
                                thread_running = false; return;
                            }

                            switch (tmp.type)
                            {
                            case 0:
                                tmp.data = DiffBase.__GetDiff(aw, tmp.a, tmp.b, tmp.el, true).data;
                                break;

                            case 1:
                                tmp.data = DiffBase.__GetDiff(aw, tmp.a, null, tmp.el, true).data;
                                break;

                            case 2:
                                tmp.data = DiffBase.__GetView(aw, tmp.a, tmp.el, true);
                                break;
                            }


                            tmp.data = tmp.data.Trim();
                            if (tmp.Equals(""))
                            {
                                Logging.AddLog("creating revdiff for \"" + tmp.el.title + "\" failed #" + (b + 1)); continue;
                            }

                            Logging.AddLog("diff for \"" + tmp.el.title + "\" successfully loaded #" + (b + 1) + "  [" + tmp.data.Length + "]");

                            int newid = -1;
                            int fnw   = 0;

                            for (newid = 0; newid < list.Count; newid++)
                            {
                                if (list[newid].rand == rand)
                                {
                                    fnw = 1;
                                    list[newid].data = tmp.data;
                                    //list[newid].el.loaded = true;
                                    // list[newid].el.MakeRevisions();

                                    if (list[newid].send_wo_req)
                                    {
                                        list[newid].send_event = true; CheckForEvent(list[newid]);
                                    }

                                    if (tmp.data.Contains("<!--diff_is_empty-->") && skipifnull == true && list[newid].send_wo_req == false)
                                    {
                                        //  list[newid].skip = true;
                                    }
                                    break;
                                }
                            }

                            if (fnw == 0)
                            {
                                thread_running = false; Logging.AddLog(list[a] + " ......... 0"); return;
                            }
                            else
                            {
                            }

                            CheckAllEvents();

                            if (thread_restart)
                            {
                                goto st;
                            }
                            break;
                        }
                    }
                }
                CheckAllEvents();
            }
            catch (Exception)
            {
                /* MessageBox.Show(e.Message+"\r\n\r\n"+e.StackTrace);*/
                CheckAllEvents(); thread_running = false; if (thread_restart)
                {
                    goto st;
                }
                return;
            }
            thread_running = false; return;
        }