コード例 #1
0
ファイル: LedSign.cs プロジェクト: rpwjanzen/blinken
        public static void RenderImageToLedSign(bool[] image)
        {
            const string uriText = "net.pipe://localhost/ledsign/sign";

            NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);

            EndpointAddress endpointAddress = new EndpointAddress(uriText);
            SignService.SignServiceClient client = new SignService.SignServiceClient(binding, endpointAddress);
            client.ScrollImage(image);
            client.Close();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: rpwjanzen/blinken
        static void Main(string[] args)
        {
            Thread updateSignThread = new Thread(() =>
                {
                    while (!g_stopRequested)
                    {
                        try
                        {
                            string[] onlinePlayers = File.ReadAllLines(Path);

                            string text = string.Empty;
                            for (int i = 0; i < onlinePlayers.Length; i++)
                            {
                                if (i != 0)
                                    text += ", ";

                                text += onlinePlayers[i];
                            }

                            const string uriText = "net.pipe://localhost/ledsign/sign";

                            NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                            EndpointAddress endpointAddress = new EndpointAddress(uriText);

                            using (SignService.SignServiceClient client = new SignService.SignServiceClient(binding, endpointAddress))
                            {
                                client.ScrollText(text);
                                client.Close();
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("She broke. :(" + e);
                        }

                        System.Threading.Thread.Sleep(TimeSpan.FromSeconds(30));
                    }
                });
            updateSignThread.IsBackground = true;
            updateSignThread.Start();

            Console.WriteLine("Monitoring " + Path + " ...");
            Console.ReadLine();
            g_stopRequested = true;
        }
コード例 #3
0
        public async Task <string> SignJson(string json, CancellationToken cancellationToken)
        {
            using var channel =
                      GrpcChannel.ForAddress(_serverAddress, new GrpcChannelOptions()
            {
                HttpHandler = _httpClientHandler
            });
            var client = new SignService.SignServiceClient(channel);

            try
            {
                var response = await client.SignAsync(new SignRequest()
                {
                    Json = json
                }, null, null, cancellationToken);

                return(response?.Json);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Failed signature generation");
                throw new Exception("Failed signature generation");
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: rpwjanzen/blinken
        private static void RenderToLedSign(string text)
        {
            const string uriText = "net.pipe://localhost/ledsign/sign";

            NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);

            EndpointAddress endpointAddress = new EndpointAddress(uriText);
            SignService.SignServiceClient client = new SignService.SignServiceClient(binding, endpointAddress);
            client.SetText(text);
            client.Close();
        }