Пример #1
0
 public void TaskCheck(YomiageTask ntask, bool preCall)
 {
     if (!preCall)
     {
         cForm.cList.tasking(ntask);
     }
 }
Пример #2
0
 private bool isIDHit(YomiageTask ntask)
 {
     if (!b_ID | d_ID == ntask.AuthorID)
     {
         return(true);
     }
     return(false);
 }
Пример #3
0
 private bool isSorceHit(YomiageTask ntask)
 {
     if (!b_Sorse | d_Sorse == ntask.Src)
     {
         return(true);
     }
     return(false);
 }
Пример #4
0
 public string tasking(YomiageTask ntask)
 {
     foreach (Condition e in clist)
     {
         if (e.isHit(ntask))
         {
             return(e.toChange);
         }
     }
     return(ntask.Outputer.getPluginName());
 }
Пример #5
0
 public void tasking(YomiageTask ntask)
 {
     foreach (Condition e in clist)
     {
         if (e.isHit(ntask))
         {
             ntask.Enable = false;
             return;
         }
     }
 }
Пример #6
0
 private bool isAddSender(YomiageTask ntask)
 {
     if (b_AddSender_R & Regex.IsMatch(ntask.authorAddinfo, d_AddSender))
     {
         return(true);
     }
     if (b_AddSender_E & !b_AddSender_R & d_AddSender == ntask.Message)
     {
         return(true);
     }
     if (!b_AddSender_E & !b_AddSender_R)
     {
         return(true);
     }
     return(false);
 }
Пример #7
0
 private bool isMessageHit(YomiageTask ntask)
 {
     if (b_Mes_R & Regex.IsMatch(ntask.Message, d_Mes))
     {
         return(true);
     }
     if (b_Mes_E & !b_Mes_R & d_Mes == ntask.Message)
     {
         return(true);
     }
     if (!b_Mes_E & !b_Mes_R)
     {
         return(true);
     }
     return(false);
 }
Пример #8
0
 private bool isNameHit(YomiageTask ntask)
 {
     if (b_Name_R & Regex.IsMatch(ntask.AuthorName, d_Name))
     {
         return(true);
     }
     if (b_Name_E & !b_Name_R & d_Name == ntask.AuthorName)
     {
         return(true);
     }
     if (!b_Name_E & !b_Name_R)
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
 private string toLuaTable(YomiageTask ntask)
 {
     return("{" +
            "srcAddinfo = \"" + ntask.srcAddinfo.Replace("\"", "") + "\" ," +
            "authorAddinfo = \"" + ntask.authorAddinfo.Replace("\"", "") + "\" ," +
            "AuthorID = \"" + ntask.AuthorID.Replace("\"", "") + "\" ," +
            "AuthorName = \"" + ntask.AuthorName.Replace("\"", "") + "\" ," +
            "Enable = \"" + ntask.Enable.ToString() + "\" ," +
            "isDead = \"" + ntask.isDead.ToString() + "\" ," +
            "LogTime = \"" + ntask.LogTime.ToString() + "\" ," +
            "Message = \"" + ntask.Message.Replace("\"", "") + "\" ," +
            "Outputer = \"" + ntask.Outputer.getPluginName() + "\" ," +
            "QueueNum = \"" + ntask.QueueNum.ToString() + "\" ," +
            "Speed = \"" + ntask.Speed.ToString() + "\" ," +
            "Src = \"" + ntask.Src + "\" }");
 }
Пример #10
0
        public void TaskCheck(YomiageTask ntask, bool preCall)
        {
            if (configdata.fileTarget == "")
            {
                return;
            }

            try
            {
                lua.DoString(Encoding.UTF8.GetBytes("task=" + toLuaTable(ntask)));

                lua.DoString(Encoding.UTF8.GetBytes("list={}"));
                int i = 1;
                foreach (YomiageTask ele in tasker.GetTaskList())
                {
                    lua.DoString(Encoding.UTF8.GetBytes("list[" + i++ + "]=" + toLuaTable(ele)));
                }
                lua.DoString("preCall=" + (preCall?"true":"false"));
            }
            catch (NLua.Exceptions.LuaException e)
            {
                callDebudUp("precode\n" + e.Message, Color.Red);
                //ddig.textBox_debug.Text = e.Message;
                //ddig.textBox_debug.ForeColor = System.Drawing.Color.Red;
                return;
            }

            try
            {
                lua.DoFile(configdata.fileTarget);
            }
            catch (NLua.Exceptions.LuaException e)
            {
                callDebudUp(e.Message, Color.Red);
                //ddig.textBox_debug.Text = e.Message;
                //ddig.textBox_debug.ForeColor = System.Drawing.Color.Red;
                ntask.isDead = true;
                return;
            }

            updateTask(ntask);

            callDebudUp("done", Color.Black);

            //ddig.textBox_debug.Text = "done";
            //ddig.textBox_debug.ForeColor = System.Drawing.Color.Black;
        }
Пример #11
0
        private void updateTask(YomiageTask target)
        {
            target.authorAddinfo = lua.GetString("task.authorAddinfo");
            target.Enable        = lua.GetString("task.Enable") == "True";
            target.isDead        = lua.GetString("task.isDead") == "True";
            target.Message       = lua.GetString("task.Message");
            target.srcAddinfo    = lua.GetString("task.srcAddinfo");
            target.Speed         = int.Parse(lua.GetString("task.Speed"));

            foreach (CCOutputInterface e in tasker.GetOutputList())
            {
                if (e.getPluginName() == lua.GetString("task.Outputer"))
                {
                    target.Outputer = e;
                    break;
                }
            }
        }
Пример #12
0
        public void TaskCheck(YomiageTask ntask, bool preCall)
        {
            if (preCall)
            {
                return;
            }

            string nOut = cForm.cList.tasking(ntask);

            foreach (CCOutputInterface e in tasker.GetOutputList())
            {
                if (e.getPluginName() == nOut)
                {
                    ntask.Outputer = e;
                    return;
                }
            }
        }
Пример #13
0
 public bool isHit(YomiageTask ntask)
 {
     return(isSorceHit(ntask) && isIDHit(ntask) && isNameHit(ntask) && isMessageHit(ntask) && isAddAdder(ntask) && isAddSender(ntask));
 }