상속: IDisposable
예제 #1
0
        public ArtNetRecorder(OutputProcessor writer, int[] universes)
        {
            if (universes.Length == 0)
                throw new ArgumentException("No universes specified");

            this.writer = writer;

            this.socket = new ArtNetSocket();
            this.socket.EnableBroadcast = true;

            this.socket.NewPacket += Socket_NewPacket;

            this.socket.Open(IPAddress.Any, IPAddress.Broadcast);

            this.universes = new Dictionary<int, UniverseData>();

            foreach (int universe in universes)
            {
                var universeData = new UniverseData(universe);

                this.universes.Add(universe, universeData);

                this.writer.AddUniverse(universe);
            }
        }
예제 #2
0
        public static void Main(string[] args)
        {
            try
            {
                var arguments = Args.Parse <Arguments>(args);

                using (var writer = new OutputProcessor(arguments))
                {
                    IRecorder recorder;

                    switch (arguments.InputType)
                    {
                    case Arguments.InputTypes.sACN:
                        recorder = new AcnRecorder(writer, arguments.Universes);
                        break;

                    case Arguments.InputTypes.ArtNet:
                        recorder = new ArtNetRecorder(writer, arguments.Universes);
                        break;

                    default:
                        throw new ArgumentException("Invalid input type");
                    }

                    recorder.StartRecord();

                    Console.WriteLine("Recording...");
                    Console.WriteLine();
                    Console.WriteLine("Press enter to stop recording");

                    Console.ReadLine();

                    recorder.StopRecord();

                    recorder.Dispose();
                    recorder = null;
                }
            }
            catch (ArgException ex)
            {
                Console.WriteLine("Argument error {0}", ex.Message);

                Console.WriteLine(ArgUsage.GenerateUsageFromTemplate <Arguments>());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unhandled exception: {0}", ex);
            }
        }
예제 #3
0
        public static void Main(string[] args)
        {
            try
            {
                var arguments = Args.Parse<Arguments>(args);

                using (var writer = new OutputProcessor(arguments))
                {
                    IRecorder recorder;

                    switch (arguments.InputType)
                    {
                        case Arguments.InputTypes.sACN:
                            recorder = new AcnRecorder(writer, arguments.Universes);
                            break;

                        case Arguments.InputTypes.ArtNet:
                            recorder = new ArtNetRecorder(writer, arguments.Universes);
                            break;

                        default:
                            throw new ArgumentException("Invalid input type");
                    }

                    recorder.StartRecord();

                    Console.WriteLine("Recording...");
                    Console.WriteLine();
                    Console.WriteLine("Press enter to stop recording");

                    Console.ReadLine();

                    recorder.StopRecord();

                    recorder.Dispose();
                    recorder = null;
                }
            }
            catch (ArgException ex)
            {
                Console.WriteLine("Argument error {0}", ex.Message);

                Console.WriteLine(ArgUsage.GenerateUsageFromTemplate<Arguments>());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unhandled exception: {0}", ex);
            }
        }
예제 #4
0
        public AcnRecorder(OutputProcessor writer, int[] universes)
        {
            if (universes.Length == 0)
                throw new ArgumentException("No universes specified");

            this.writer = writer;

            this.acnSocket = new Acn.Sockets.StreamingAcnSocket(acnId, "DMX Recorder");

            this.acnSocket.NewPacket += AcnSocket_NewPacket;

            this.acnSocket.Open(IPAddress.Any);

            this.universes = new Dictionary<int, UniverseData>();

            foreach (int universe in universes)
            {
                var universeData = new UniverseData(universe);

                this.universes.Add(universe, universeData);

                this.writer.AddUniverse(universe);
            }
        }