Exemplo n.º 1
0
        public void VoidLog()
        {
            #region voidlog
            // RowaLogProxy("Product", "Component")
            // C:\ProgramData\Rowa\Protocol\Product\Component
            var rowaLogProxy = new RowaLogProxy(Globals.App.Name);

            try
            {
                "Debug".LogDebug();
                "UserIn".LogUserIn();
                "ExtIf".LogExtIf();
                "Info".LogInfo();
                "Warning".LogWarning();
                "Error".LogError();
                "Fatal".LogFatal();
                "Audit".LogAudit();
            }
            catch (Exception ex)
            {
                ex.LogException(); // LogFatal
            }

            rowaLogProxy.Dispose(); // Ist Notwendig sonst wird ein Thread in RowaLog nicht beendet
            #endregion
        }
Exemplo n.º 2
0
#pragma warning disable IDE0060 // Remove unused parameter
        static async Task Main(string[] args)
#pragma warning restore IDE0060 // Remove unused parameter
        {
            Console.Title = $"{Globals.App.Name} {Globals.App.Version}";
            await Task.Delay(1);

            // C:\ProgramData\Rowa\Protocol\ProLog3Server\ProLog3Server
            // Log und WWi
            using var rowaLogProxy       = new RowaLogProxy(Globals.App.Name, false);
            using var TableCommunication = new Table.ImageProcessingCommunication(4711)
                                           .DoRun();

            TableCommunication.OnConnect.Add((communication, socket) =>
            {
                Console.WriteLine($"Table new connection {socket.RemoteEndPoint.ToString()}".LogInfo());
            });
            TableCommunication.OnDisconnect.Add((communication, socket) =>
            {
                Console.WriteLine($"Table removed connection {socket.RemoteEndPoint.ToString()}".LogInfo());
            });

            TableCommunication.OnReceived.Add(async(communication, message) =>
            {
                Console.WriteLine($"Table recevied {message?.GetType().Name ?? "unkown"}".LogInfo());
                switch (message)
                {
                case Table.Messages.SetLightsRequest setLights:
                    communication.Send(new Table.Messages.SetLightsResponse().SetStateOk());
                    break;

                case Table.Messages.TurnRelativeRequest turnRelative:
                    int wait = 2;
                    if (turnRelative.Velocity < 100)
                    {
                        communication.Send(new Table.Messages.TurnRelativeResponse().SetStateError($"Velocity {turnRelative.Velocity} less 100"));
                        return;
                    }

                    Console.WriteLine($"TurnRelativ start and wait={wait} seconds".LogInfo());
                    await Task.Delay(TimeSpan.FromSeconds(wait));
                    Console.WriteLine($"TurnRelativ ready".LogInfo());
                    communication.Send(new Table.Messages.TurnRelativeResponse().SetStateOk());
                    break;

                default:
                    Console.WriteLine($"unhandled message {message?.GetType().Name ?? "unkown"}".LogError());
                    break;
                }
            });

            Console.WriteLine("End with return");
            Console.ReadLine();
            Console.WriteLine($"{Globals.App.Name} finshed".LogInfo());
        }
Exemplo n.º 3
0
        ///<param name="region">Takes in the --region option from the code fence options in markdown</param>
        ///<param name="session">Takes in the --session option from the code fence options in markdown</param>
        ///<param name="package">Takes in the --package option from the code fence options in markdown</param>
        ///<param name="project">Takes in the --project option from the code fence options in markdown</param>
        ///<param name="args">Takes in any additional arguments passed in the code fence options in markdown</param>
        ///<see>To learn more see <a href="https://aka.ms/learntdn">our documentation</a></see>
        static async Task <int> Main(
            string region  = null,
            string session = null,
            string package = null,
            string project = null,
            string[] args  = null)
        {
            await Task.Delay(1);

            using var rowaLogProxy = new RowaLogProxy(Globals.App.Name, false);

            var cancellationTokenSource = new CancellationTokenSource();

            Console.CancelKeyPress += (sender, e) => cancellationTokenSource.Cancel();

            return(region switch
            {
                "eagtrytest" => TryTest(),
                "setlights" => await Client.SetLightsAsync(),
                "rowalogzipcleanup" => await Client.RowaLogZipCleanUpAsync(),
                "turntable" => await Client.TurnTableAsync(),
                "turntableerror" => await Client.TurnTableErrorAsync(),
                _ => throw new ArgumentException("A --region argument must be passed", nameof(region))
            });
Exemplo n.º 4
0
 protected override void OnStartup(StartupEventArgs e)
 {
     _rowaLogProxy = new RowaLogProxy(Globals.App.Name, false, false);
     $"{Globals.App.Name} Start".LogInfo();
     base.OnStartup(e);
 }
Exemplo n.º 5
0
#pragma warning disable IDE0060 // Remove unused parameter
        static async Task Main(string[] args)
#pragma warning restore IDE0060 // Remove unused parameter
        {
            Console.Title = $"{Globals.App.Name} {Globals.App.Version}";
            // C:\ProgramData\Rowa\Protocol\EagClient\EagClient
            // Log und WWi
            using var rowaLogProxy       = new RowaLogProxy(Globals.App.Name, true);
            using var TableCommunication = new Table.ImageProcessingCommunication(6002, "127.0.0.1")
                                           .DoRun();

            TableCommunication.OnConnect.Add((communication, socket) =>
            {
                Console.WriteLine($"Table new connection {socket.RemoteEndPoint.ToString()}".LogInfo());
            });
            TableCommunication.OnDisconnect.Add((communication, socket) =>
            {
                Console.WriteLine($"Table removed connection {socket.RemoteEndPoint.ToString()}".LogInfo());
            });

            TableCommunication.OnReceived.Add((communication, message) =>
            {
                Console.WriteLine($"Table recevied {message?.GetType().Name ?? "unkown"}".LogInfo());
            });

            Console.WriteLine("Make your selection\r\nreturn => ende\r\ns or S => setlights\r\nt or T => turntable\r\n");
            bool running = true;

            while (running)
            {
                while (!Console.KeyAvailable)
                {
                    await Task.Delay(100);
                }
                var key = Console.ReadKey(true);
                Console.WriteLine();
                var elapsedTime = Stopwatch.StartNew();
                switch (key.KeyChar)
                {
                case '\r':
                case 'c':
                case 'C':
                    running = false;
                    break;

                case 's':
                {
                    var result = await TableCommunication.Send(new Table.Messages.SetLightsRequest
                        {
                            Top        = false,
                            Bottom     = false,
                            SideLeft   = false,
                            SideMiddle = false,
                            SideRight  = false
                        }).WaitAsync <Table.Messages.SetLightsResponse>();

                    if (result.IsOk())         // No Timeout
                    {
                        if (result.Message.IsOk())
                        {
                            Console.WriteLine("SetLight Ok".LogInfo());
                        }
                        else
                        {
                            Console.WriteLine("SetLight Server Error".LogError());
                        }
                    }
                    else
                    {
                        Console.WriteLine("SetLight Client TimeOut".LogError());
                    }
                }
                break;

                case 'S':
                {
                    if (await TableCommunication.SendAndWaitAsync <Table.Messages.SetLightsResponse>(new Table.Messages.SetLightsRequest
                        {
                            Top = true,
                            Bottom = true,
                            SideLeft = true,
                            SideMiddle = true,
                            SideRight = true
                        }) is var result && result.IsMessageOk())
                    {
                        Console.WriteLine("message Ok");
                    }