예제 #1
0
파일: BreakCondition.cs 프로젝트: ynfin/sig
 public BreakCondition(double high, double low, int window, triggerType trigger)
 {
     this.high    = high;
     this.low     = low;
     this.window  = window;
     this.trigger = trigger;
 }
예제 #2
0
 public void untrigger(triggerType triggerType)
 {
     foreach (TriggerBehaviour door in triggerBehaviours)
     {
         if (door.triggerType == triggerType)
         {
             door.trigger = false;
         }
     }
 }
예제 #3
0
 public void trigger(triggerType triggerType)
 {
     foreach (TriggerBehaviour triggerBehaviour in triggerBehaviours)
     {
         if (triggerBehaviour.triggerType == triggerType)
         {
             triggerBehaviour.trigger = true;
         }
     }
 }
예제 #4
0
        /// <summary>
        /// Конструктор класса
        /// </summary>
        public ScriptTrigger()
        {
            //Устанавливаем дефолтные значения
            actions = new List <ScriptAction>();
            type    = triggerType.Без_триггера;


            triggerName  = "NewTrigger";
            functionName = "NewTrigger";
            /* Вот тут будет код формирования оригинального названия */
        }
예제 #5
0
        private void Initialize(DataRow dr, bool LoadImage)
        {
            _cID       = dr["cardID"].ToString();
            _name      = dr["name"].ToString();
            _uclass    = UnitType.Parse(dr["uclass"].ToString());
            _trigger   = TriggerType.Parse(dr["trigger"].ToString());
            _grade     = Convert.ToInt32(dr["grade"]);
            _origPower = Convert.ToInt32(dr["power"]);
            _critical  = Convert.ToInt32(dr["critical"]);
            try { _origShield = Convert.ToInt32(dr["shield"]); }
            catch { _origShield = 0; }

            //Set Power and Shield
            _power  = _origPower;
            _shield = _origShield;

            //Text Values
            _clan      = dr["clan"].ToString();
            _race      = dr["race"].ToString().Split('/');
            _abilities = dr["effect"].ToString();
            _flavour   = dr["flavour"].ToString();
            _nation    = dr["nation"].ToString();
            _illust    = dr["illustrator"].ToString();

            //Location Default
            if (_uclass == unitType.G)
            {
                _location = "G Zone-0";
            }
            else
            {
                _location = "Deck-0";
            }

            //Get Image
            if (LoadImage)
            {
                try { cardImage = new Bitmap(@"Images/" + _cID.Replace('/', '-') + ".jpg"); }
                catch (FileNotFoundException)
                {
                    //Create New Card
                    cardImage = new Bitmap(ImageConverter.ToBitmap(Properties.Settings.Default.GSleeve));
                }
                catch (Exception ex) { Console.WriteLine(ex.Message); }

                redImage = new Bitmap(cardImage);

                using (Graphics g = Graphics.FromImage(redImage))
                {
                    Rectangle rect = new Rectangle(Point.Empty, redImage.Size);
                    g.FillRectangle(new SolidBrush(Color.FromArgb(100, 255, 0, 0)), rect);
                }
            }
        }
        private static triggerType GetTriggerType(ITrigger trigger, JobKey jobKey)
        {
            triggerType     triggerType = new triggerType();
            cronTriggerType cronTrigger = new cronTriggerType();

            cronTrigger.priority           = trigger.Priority.ToString();
            cronTrigger.name               = trigger.Key.Name;
            cronTrigger.calendarname       = trigger.CalendarName.TrimEmptyToNull();
            cronTrigger.description        = trigger.Description;
            cronTrigger.misfireinstruction = GetCronMisfireInstruction(trigger.MisfireInstruction);

            if (trigger.EndTimeUtc != null)
            {
                cronTrigger.endtime          = trigger.EndTimeUtc.Value.DateTime;
                cronTrigger.endtimeSpecified = true;
            }
            else
            {
                cronTrigger.endtimeSpecified = false;
            }
            cronTrigger.group = trigger.Key.Group;

            if (trigger.JobKey != null)
            {
                cronTrigger.jobname  = trigger.JobKey.Name;
                cronTrigger.jobgroup = trigger.JobKey.Group;
            }
            else
            {
                cronTrigger.jobname  = jobKey.Name;
                cronTrigger.jobgroup = jobKey.Group;
            }

            if (trigger is ICronTrigger cTrigger)
            {
                cronTrigger.cronexpression = cTrigger.CronExpressionString.TrimEmptyToNull();
                cronTrigger.timezone       = cTrigger.TimeZone.Id;
            }

            if (trigger.JobDataMap != null && trigger.JobDataMap.Count > 0)
            {
                cronTrigger.jobdatamap       = new jobdatamapType();
                cronTrigger.jobdatamap.entry = GetEntryTypes(trigger.JobDataMap);
            }

            triggerType.Item = cronTrigger;

            return(triggerType);
        }
예제 #7
0
        public static void AddJob(string XMLFile, IJobDetail JobDetail, ITrigger Trigger)
        {
            string fileName = FileUtil.ResolveFile(XMLFile);

            using (StreamReader sr = new StreamReader(fileName))
            {
                string                   xmlContent = sr.ReadToEnd();
                XmlSerializer            xs         = new XmlSerializer(typeof(QuartzXmlConfiguration20));
                QuartzXmlConfiguration20 data       = (QuartzXmlConfiguration20)xs.Deserialize(new StringReader(xmlContent));
                if (data.schedule.Length > 0)
                {
                    //将IJobDetail添加到XML中的JobDetailType中
                    jobdetailType[] newJobDetails;
                    if (data.schedule[0].job == null)
                    {
                        newJobDetails = new jobdetailType[1];
                    }
                    else
                    {
                        newJobDetails = new jobdetailType[data.schedule[0].job.Length + 1];
                        data.schedule[0].job.CopyTo(newJobDetails, 0);
                    }

                    jobdetailType type = new jobdetailType();
                    type.name        = JobDetail.Key.Name;
                    type.group       = JobDetail.Key.Group;
                    type.description = JobDetail.Description;
                    type.jobtype     = JobDetail.JobType.AssemblyQualifiedName;
                    type.durable     = JobDetail.Durable;;
                    type.recover     = JobDetail.RequestsRecovery;
                    newJobDetails[newJobDetails.Length - 1] = type;
                    data.schedule[0].job = newJobDetails;
                    if (JobDetail.JobDataMap.Count > 0)
                    {
                        type.jobdatamap       = new jobdatamapType();
                        type.jobdatamap.entry = new entryType[JobDetail.JobDataMap.Count];
                        IList <string> keys = JobDetail.JobDataMap.GetKeys();

                        int i = 0;
                        foreach (string item in keys)
                        {
                            type.jobdatamap.entry[i]       = new entryType();
                            type.jobdatamap.entry[i].key   = item;
                            type.jobdatamap.entry[i].value = JobDetail.JobDataMap[item].ToString();
                            i++;
                        }
                    }
                    triggerType[] newTriggerTypes;
                    if (data.schedule[0].trigger != null)
                    {
                        newTriggerTypes = new triggerType[data.schedule[0].trigger.Length + 1];
                        data.schedule[0].trigger.CopyTo(newTriggerTypes, 0);
                    }
                    else
                    {
                        newTriggerTypes = new triggerType[1];
                    }

                    triggerType tType = new triggerType();
                    if (Trigger is ISimpleTrigger)
                    {
                        tType.Item = new simpleTriggerType();
                        ((simpleTriggerType)tType.Item).repeatcount        = (Trigger as ISimpleTrigger).RepeatCount.ToString();
                        ((simpleTriggerType)tType.Item).repeatinterval     = (Trigger as ISimpleTrigger).RepeatInterval.TotalMilliseconds.ToString();
                        ((simpleTriggerType)tType.Item).jobname            = JobDetail.Key.Name;
                        ((simpleTriggerType)tType.Item).jobgroup           = JobDetail.Key.Group;
                        ((simpleTriggerType)tType.Item).name               = Trigger.Key.Name;
                        ((simpleTriggerType)tType.Item).group              = Trigger.Key.Group;
                        ((simpleTriggerType)tType.Item).description        = Trigger.Description;
                        ((simpleTriggerType)tType.Item).misfireinstruction = "RescheduleNowWithExistingRepeatCount";
                    }
                    else
                    {
                        tType.Item = new cronTriggerType();
                        ((cronTriggerType)tType.Item).cronexpression = (Trigger as ICronTrigger).CronExpressionString.ToString();

                        ((simpleTriggerType)tType.Item).jobname            = JobDetail.Key.Name;
                        ((simpleTriggerType)tType.Item).jobgroup           = JobDetail.Key.Group;
                        ((simpleTriggerType)tType.Item).name               = Trigger.Key.Name;
                        ((simpleTriggerType)tType.Item).group              = Trigger.Key.Group;
                        ((simpleTriggerType)tType.Item).description        = Trigger.Description;
                        ((simpleTriggerType)tType.Item).misfireinstruction = "RescheduleNowWithExistingRepeatCount";
                    }

                    newTriggerTypes[newTriggerTypes.Length - 1] = tType;
                    data.schedule[0].trigger = newTriggerTypes;
                }
                sr.Close();
                StringBuilder xmlBuild = new StringBuilder();
                xs.Serialize(new StringWriter(xmlBuild), data);
                StreamWriter sw = new StreamWriter(fileName);

                sw.Write(xmlBuild.ToString());
                sw.Flush();
                sw.Close();
            }
        }