public InternalAdditionalLogics(InternalAccessors accessors, IApplyManager storage, LogicData data, IServerAPI api) { ImpactController = new ImpactController(data.IsEmulate); ContextLogic = ContextLogic.CreateClient(accessors.BattleAccessor, accessors.UnitsAccessor); DropLogic = DropLogic.CreateClient(accessors.ScorersAccessor, accessors.InventoryAccessor, accessors.UnitsAccessor, accessors.ExplorerAccessor, accessors.FormulaController, ImpactController); ScorersLogic = ScorersLogic.CreateClient(accessors.BattleAccessor, accessors.ScorersAccessor, accessors.ExplorerAccessor); ShopLogic = ShopLogic.CreateClient(accessors.SettingsAccessor, accessors.ShopAccessor, accessors.FormulaController); ApplyChangeLogic = ApplyChangeLogic.CreateClient(storage, ContextLogic); FormulaLogic = FormulaLogic.CreateClient(ContextLogic, accessors.ScorersAccessor, accessors.UnitsAccessor, accessors.BattleAccessor, accessors.ExplorerAccessor, data, accessors.PlayerAccessor, accessors.SettingsAccessor, accessors.ConditionController, accessors.FormulaController, ScorersLogic); BuffLogic = BuffLogic.CreateClient(accessors.BattleAccessor, ContextLogic, ApplyChangeLogic); ExplorerLogic = ExplorerLogic.CreateClient(accessors.ScorersAccessor, accessors.ExplorerAccessor, accessors.UnitsAccessor, accessors.FormulaController, ScorersLogic, ContextLogic, DropLogic, ImpactController); TriggerLogic = TriggerLogic.CreateClient(accessors.BattleAccessor, FormulaLogic); ConditionLogic = ConditionLogic.CreateClient(accessors.InventoryAccessor, accessors.ScorersAccessor, accessors.PlayerAccessor, accessors.UnitsAccessor, accessors.BattleAccessor, accessors.ExplorerAccessor, accessors.SettingsAccessor, accessors.AchievementAccessor, FormulaLogic, ContextLogic, ScorersLogic, data, accessors.ConditionController); BattleLogic = BattleLogic.CreateClient(ApplyChangeLogic, ContextLogic, ConditionLogic, accessors.FormulaController, accessors.BattleAccessor, accessors.ScorersAccessor, accessors.UnitsAccessor, accessors.ExplorerAccessor, accessors.SettingsAccessor); ImpactLogic = ImpactLogic.CreateClient(accessors.ScorersAccessor, accessors.PlayerAccessor, accessors.InventoryAccessor, accessors.ExplorerAccessor, accessors.UnitsAccessor, accessors.BattleAccessor, accessors.SettingsAccessor, accessors.AchievementAccessor, BattleLogic, FormulaLogic, accessors.ConditionController, ApplyChangeLogic, BuffLogic, ScorersLogic, ContextLogic, ImpactController, data); }
public MainPage() { _jobLogic = new JobLogic(); _triggerLogic = new TriggerLogic(); InitializeComponent(); Jobs = _jobLogic.appoggio; Triggers = _triggerLogic.appoggio; _triggerLogic.LoadGrid(dataGridView1, Jobs); GridTypeNow = "T"; try { CheckStatus(); } catch (Exception e) { MessageBox.Show(e.Message); } }
public MainPage() { _jobLogic = new JobLogic(); _triggerLogic = new TriggerLogic(); _logLogic = new LogLogic(); InitializeComponent(); Jobs = _jobLogic.appoggio; Triggers = _triggerLogic.appoggio; EnableView(ViewTypeEnum.TRIGGER); _triggerLogic.LoadGrid(dataGridView1, Jobs); try { CheckStatus(); } catch (Exception e) { MessageBox.Show(e.Message); } }
public static BattleModule CreateClient(BattleAccessor _battle, ExplorerAccessor _explorer, UnitsAccessor _units, ContextLogic _contextLogic, ImpactController _impactLogic, TriggerLogic _triggerLogic, BattleLogic _battleLogic, BuffLogic _buffLogic) { return(new BattleModule { _battle = _battle, _explorer = _explorer, _units = _units, _contextLogic = _contextLogic, _impactLogic = _impactLogic, _triggerLogic = _triggerLogic, _battleLogic = _battleLogic, _buffLogic = _buffLogic, } ); }
public TriggerDetail(Trigger t, List <Job> jobs, TriggerLogic tl) { InitializeComponent(); _jobs = jobs; _tl = tl; dtpStartTime.Format = DateTimePickerFormat.Custom; dtpStartTime.CustomFormat = "dd/MM/yyyy HH:mm"; _tl.LoadComboScheduleType(cmbScheduleType); cmbScheduleType.ValueMember = "ScheduleType"; cmbScheduleType.DisplayMember = "Name"; cmbJobs.DataSource = jobs; cmbJobs.DisplayMember = "Name"; cmbJobs.ValueMember = "Name"; if (t != null) { txtName.Text = t.name; cmbJobs.SelectedValue = t.jobname; switch (t.ScheduleType) { case Enum.ScheduleTypeEnum.RegularIntervals: cmbScheduleType.SelectedIndex = 0; break; case Enum.ScheduleTypeEnum.Daily: cmbScheduleType.SelectedIndex = 1; break; case Enum.ScheduleTypeEnum.Weekly: cmbScheduleType.SelectedIndex = 2; break; case Enum.ScheduleTypeEnum.Monthly: cmbScheduleType.SelectedIndex = 3; break; case Enum.ScheduleTypeEnum.Yearly: cmbScheduleType.SelectedIndex = 4; break; default: break; } dtpStartTime.Value = t.StartTime; txtIntervalTime.Text = t.IntervalTime.ToString(); chkSunday.Checked = t.Sunday; chkMonday.Checked = t.Monday; chkTuesday.Checked = t.Tuesday; chkWednesday.Checked = t.Wednesday; chkThursday.Checked = t.Thursday; chkFriday.Checked = t.Friday; chkSaturday.Checked = t.Saturday; btnSave.Text = "Modifica"; } else { txtName.Text = ""; dtpStartTime.Value = DateTime.Now.AddHours(1); btnSave.Text = "Inserisci"; btnDelete.Visible = false; CancelButton = btnDelete; } }
public async Task Start() { Log.Initialize(); _jobLogic = new JobLogic(); _triggerLogic = new TriggerLogic(); Jobs = _jobLogic.appoggio; Triggers = _triggerLogic.appoggio; // write code here that runs when the Windows Service starts up. var props = new NameValueCollection { { "quartz.serializer.type", "binary" } }; var factory = new StdSchedulerFactory(props); scheduler = await factory.GetScheduler(); try { //clear all await scheduler.Clear(); // and start it off if (!scheduler.IsStarted) { await scheduler.Start(); } foreach (var itemTrigger in Triggers) { var itemJob = Jobs.FirstOrDefault(x => x.name == itemTrigger.jobname); if (itemJob == null) { Log.Error($"Configurazione non trovata per il job [{itemTrigger.jobname}]"); continue; } var pathAssembly = Path.Combine(ConfigurationSettings.AppSettings["PathCustomJobs"], itemJob.path); var info = new FileInfo(pathAssembly); if (!info.Exists) { Log.Error($"Assembly non trovato [{itemJob.path}]"); continue; } var assembly = Assembly.LoadFrom(pathAssembly); var types = assembly.GetTypes(); Type type = null; foreach (var t in types) { var interfaces = t.GetInterfaces(); if (interfaces.All(i => i != typeof(IJob))) { continue; } type = t; } //carica i parametri del job var dictionaryDataMap = new Dictionary <string, string>(); foreach (var entry in itemJob.parameters) { dictionaryDataMap.Add(entry.Key, entry.Value); } var jobDataMap = new JobDataMap(dictionaryDataMap); var job = JobBuilder.Create(type) .WithIdentity(itemTrigger.jobname, "group1") .SetJobData(jobDataMap) .Build(); var trigger = TriggerBuilder.Create() .WithIdentity(itemTrigger.name, "group1") .StartNow() .WithCronSchedule(itemTrigger.cronexpression) .Build(); //Tell quartz to schedule the job using our trigger await scheduler.ScheduleJob(job, trigger); } // some sleep to show what's happening await Task.Delay(TimeSpan.FromSeconds(60)); //60 } catch (SchedulerException se) { Log.Error("SchedulerService", se); } catch (ReflectionTypeLoadException exRef) { Log.Error("SchedulerService", exRef); } }
private void LoadFromXML(XmlNode info) { bool success = true; string reason = ""; amount_ = new IntNull(); lessThan_ = new IntNull(); XmlAttribute xmlAttr = info.Attributes ["logic"]; if (xmlAttr != null) { string tempString = XMLHelper.FetchString(xmlAttr); if (tempString == "and") { logic_ = TriggerLogic.AND; } else if (tempString == "or") { logic_ = TriggerLogic.OR; } else if (tempString == "not") { logic_ = TriggerLogic.NOT; } else if (tempString == "notand") { logic_ = TriggerLogic.NOTAND; } else if (tempString == "notor") { logic_ = TriggerLogic.NOTOR; } else { success = false; reason = "invalid logic tag: '" + tempString + "', was looking for (and, or, not)"; } } else { logic_ = TriggerLogic.AND; } if (success) { xmlAttr = info.Attributes ["type"]; if (xmlAttr != null) { string tempString = XMLHelper.FetchString(xmlAttr); if (tempString == "flag") { type_ = TriggerType.Flag; } else if (tempString == "artifact") { type_ = TriggerType.Artifact; } else if (tempString == "item") { type_ = TriggerType.Item; } else if (tempString == "event") { type_ = TriggerType.Item; } else if (tempString == "itemcap") { type_ = TriggerType.ItemCap; } else if (tempString == "turns") { type_ = TriggerType.Turns; } else if (tempString == "produceamount") { type_ = TriggerType.ProduceAmount; } else { success = false; reason = "invalid type tag found in trigger: '" + tempString + "'"; } } else { type_ = TriggerType.Event; } } if (success) { success = XMLHelper.SetUniqueStringFromAttribute(info, ref value_, "value"); } if (success) { success = XMLHelper.SetUniqueIntFromAttribute(info, ref amount_, "amount"); } if (success) { success = XMLHelper.SetUniqueIntFromAttribute(info, ref lessThan_, "less_than"); } if (success) { success = XMLHelper.SetUniqueIntFromAttribute(info, ref amount_, "greater_than"); } if (!success) { Debug.LogError("Error loading trigger XML: " + reason + " " + info.OuterXml); } }