public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); this.taskId = config["taskId"]; this.taskName = config["taskName"]; }
public IPlugin CreatePlugin(IStrip s, PluginConfig pc) { bool?config = pc.enabled; // Voodoo: create plugin System.Reflection.Assembly asy; if (pc.assembly == null) { asy = System.Reflection.Assembly.GetExecutingAssembly(); } else { asy = System.Reflection.Assembly.LoadFrom(pc.assembly); } IPlugin gin = (IPlugin)asy.CreateInstance(pc.plugin); if (gin == null) { // throw something worthwhile throw new Exception($"Could not create plugin: {pc.plugin}"); } gin.Initialize(s, pc); // TODO Move this to constructor gin.enabled = config ?? true; // TODO: Plugin should handle this if (pc.tags != null) { gin.tags.AddRange(pc.tags); } gin.Name = pc.name; return(gin); }
public void Render(IStrip s) { velocity += acceleration; location += velocity; intensity += intensityVelocity; var start = location - intensity; var end = location + intensity; s.Fill(start, end, color, FillType.Factor); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); oauth_client_name = config["OAUTH_CLIENT_NAME"]; oauth_client_secret = config["OAUTH_CLIENT_SECRET"]; user_name = config["username"]; user_password = config["password"]; influxConfig = Services.Configuration.GetServiceConfiguration("influxDB"); enable_logging = influxConfig != null; }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); this.height = config["height"]; this.Days = config["days"]; s2d = s as RGBWStrip2D; if (s2d == null) { throw new ArgumentException("Strip must be of type Strip2D"); } }
public bool IsVisible(IStrip s) { if (location + intensity < 0 || location - intensity > s.led_count) { return(false); } if (intensity <= 0) { return(false); } return(true); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); DayColor = RGBWColor.Parse((string)config["day"]); NightColor = RGBWColor.Parse((string)config["night"]); Services.Sun.OnSunEvent += (ev) => { if (enabled) { _smudged = true; } }; }
async void _init() { StripElement.IsReversed = true; _strip = ContainerHost.Container.Resolve<IStrip>(); var w = ContainerHost.Container.Resolve<IStripWriter>(); await w.Init(); _strip.Clear(); await Task.Delay(3000); // _strip.Rainbow(); //return; _loop(); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); s2d = s as RGBWStrip2D; if (s2d == null) { throw new ArgumentException("Strip must be of type RGBWStrip2D"); } // TODO: Use magic to properly initialize 2d plugins var loc = config.location.Replace("(", "").Replace(")", "").Split(",").Select(x => int.Parse(x.Trim())); this.location = new Point(loc.ElementAt(0), loc.ElementAt(1)); //this.Font = this.FontCollection.Install("fonts/ostrich-sans-regular.ttf").CreateFont(22); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); var plu = Services.Configuration.CreatePlugin(s, config["timegate_plugin"].ToObject <PluginConfig>()); plugin = (IPlugin2D)plu; // TODO: Error checking (verify it's an IPlugin2D) string ts = config["timeStart"]; string te = config["timeEnd"]; timeStart = DateTime.ParseExact(ts, "h:mm tt", CultureInfo.InvariantCulture).TimeOfDay; timeEnd = DateTime.ParseExact(te, "h:mm tt", CultureInfo.InvariantCulture).TimeOfDay; var strdays = (string)config["days"]; days = strdays.ToUpper().ToList().Select(x => { if (x == 'M') { return(DayOfWeek.Monday); } if (x == 'T') { return(DayOfWeek.Tuesday); } if (x == 'W') { return(DayOfWeek.Wednesday); } if (x == 'R') { return(DayOfWeek.Thursday); } if (x == 'F') { return(DayOfWeek.Friday); } if (x == 'S') { return(DayOfWeek.Saturday); } if (x == 'U') { return(DayOfWeek.Sunday); } throw new ArgumentException("Invalid day of week"); }).ToArray(); }
public override async void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); if (!flow_plugin_initialized) { flow_plugin_initialized = true; Services.Sun.OnSunrise += async(_) => { Console.WriteLine("Sunrise"); await hourly(); }; RecurringJob.AddOrUpdate("hourly-flow-palette", () => hourly(), Cron.Hourly); await hourly(); } }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); s2d = s as RGBWStrip2D; if (s2d == null) { throw new ArgumentException("Strip must be of type RGBWStrip2D"); } baseURL = (string)config["baseURL"]; var tok = (JToken)config["busStops"]; var busstops = tok.ToObject <BusStop[]>(); var loc = config.location.Replace("(", "").Replace(")", "").Split(",").Select(x => int.Parse(x.Trim())); this.location = new Point(loc.ElementAt(0), loc.ElementAt(1)); stops = new StopCollection(baseURL, busstops); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); s2d = s as RGBWStrip2D; if (s2d == null) { throw new ArgumentException("Strip must be of type RGBWStrip2D"); } width = s2d.width; height = s2d.height; state = new bool[width, height]; // Generate random gamestate Random random = new Random(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { state[x, y] = random.Next(3) == 0; } } }
public virtual void Initialize(IStrip s, PluginConfig config) { this.strip = s; }
public IEnumerable <IPlugin> GetPluginsForStrip(IStrip strip) { return(pluginsByStrip[strip]); }
public IStrip AddStrip(string name, IStrip strip) { strips.Add(strip); stripsByName.Add(name, strip); return(strip); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); this.Color = RGBWColor.Parse((string)config["color"]); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); UserURL = "https://www.duolingo.com/users/" + (string)config["username"]; }