Exemple #1
0
 public LEDerZaumZeug(LEDerConfig config, PixelProgram sequenz)
 {
     this.config         = config;
     this.sequenz        = sequenz;
     this.activePipeline = null;
 }
Exemple #2
0
        static async Task Main(string[] args)
        {
            var programmladepfad = StdPath;
            var path             = @"./PlugIns";

            //var repo = new PluginTypeRepo();
            //repo.WithAssembliesInPath(path);
            //var mix =repo.GetTypesImplementing<IMixer>();
            //var flt =repo.GetTypesImplementing<IFilter>();
            //var outp =repo.GetTypesImplementing<IOutput>();

            // Cmd params
            if (args.Length == 1 && File.Exists(args[0]))
            {
                programmladepfad = args[0];
            }

            try
            {
                NLog.LogManager.ThrowExceptions = true;
                logger.Debug("init main");
                LEDerConfig lederconfig = null;
                Console.WriteLine("LEDerZaumzeug!\nPixelgenerator meiner Wahl.");
                Console.WriteLine("lese Konfig: " + CfgPath);
                using (var stream = File.OpenRead(CfgPath))
                {
                    lederconfig = await SerialisierungsFabrik.ReadConfigFromStreamAsync(stream);
                }

                PixelProgram programmsequenz = null;
                using (Stream stream = File.OpenRead(programmladepfad))
                {
                    programmsequenz = await SerialisierungsFabrik.ReadProgramFromStreamAsync(stream);
                }

                using (var pixelator = new LEDerZaumZeug(lederconfig, programmsequenz))
                {
                    await pixelator.AddOutputsFromCfg();

                    await pixelator.StartAsync();

                    Console.WriteLine("ENTER zum Beenden!!!!!");
                    Console.ReadLine();

                    // Synce auf
                    pixelator.Stop();
                    Console.WriteLine("==========");
                }
            }
            catch (Exception ex)
            {
                //NLog: catch setup errors
                logger.Error(ex, "Stopped program because of exception");
                throw;
            }
            finally
            {
                // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
                NLog.LogManager.Shutdown();
            }
        }