Example #1
0
 void Sort()
 {
     //Makes sure messages are actually being sent, and then sorts the
     //message appropriately to what it corresponds to
     //Very temporary... Only sorts controller inputs (GPS wasn't working)
     client = GetComponent <HelloClient>();
     m      = client._helloRequester.sentMessage;
     if (m != "null")
     {
         msg = float.Parse(m);
         if (msg >= 155)
         {
             xbox[11] = (msg - 160);
         }
         else if (msg >= 145)
         {
             xbox[10] = (msg - 150);
         }
         else if (msg >= 135)
         {
             xbox[9] = (msg - 140);
         }
         else if (msg >= 125)
         {
             xbox[8] = (msg - 130);
         }
         else if (msg >= 115)
         {
             xbox[7] = (msg - 120);
         }
         else if (msg >= 105)
         {
             xbox[6] = (msg - 110);
         }
         else if (msg >= 95)
         {
             xbox[5] = (msg - 100);
         }
         else if (msg >= 85)
         {
             xbox[4] = (msg - 90);
         }
         else if (msg >= 75)
         {
             xbox[3] = (msg - 80);
         }
         else if (msg >= 65)
         {
             xbox[2] = (msg - 70);
         }
         else if (msg >= 55)
         {
             xbox[1] = (msg - 60);
         }
         else if (msg >= 45)
         {
             xbox[0] = (msg - 50);
         }
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("starting sample runner");

            using (var scope = new TraceContextScope("Пример", TraceContextMode.New))
            {
                //Childs = new List<Process>() {
                //Process.Start(nameof(EchoApp))
                //, Process.Start(nameof(HelloApp))};

                AppDomain.CurrentDomain.ProcessExit        += CurrentDomain_ProcessExit;
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Console.WriteLine("wait...");
                Thread.Sleep(TimeSpan.FromSeconds(2));

                using (var echo = new EchoClient())
                    echo.Echo("Hello");

                using (var hello = new HelloClient())
                    hello.Hello();

                var txt = scope.Root.ToString();
            }

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Example #3
0
        public void Run()
        {
            HelloClient client = new HelloClient("Service1OverRabbit");

            Console.WriteLine("Client Saying Hello...");
            Console.WriteLine(client.Hello("Bob"));

            client.ChannelFactory.Close();
        }
Example #4
0
        /// <summary>
        /// Callback method for when we receive the HelloClient data.
        /// </summary>
        /// <param name="helloClient">The HelloClient packet data.</param>
        private void OnHelloClient(HelloClient helloClient)
        {
            Logger.Get().Info(this, "Received HelloClient from server");

            // Fill the player data dictionary with the info from the packet
            foreach (var(id, username) in helloClient.ClientInfo)
            {
                _playerData[id] = new ClientPlayerData(id, username);
            }
        }
Example #5
0
        public async Task GrpcAsync()
        {
            var client = new HelloClient();

            client.Connect();
            for (var i = 0; i < 1000; ++i)
            {
                await client.SendMessageAsync();
            }
            await client.ShutdownAsync();
        }
Example #6
0
        static void Main(string[] args)
        {
            try
            {
                InstanceContext site  = new InstanceContext(new CallbackHandler());
                HelloClient     proxy = new HelloClient(site);
                Console.WriteLine("Client");
                proxy.HelloFromClient();

                Console.ReadLine();
                proxy.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #7
0
 static void Main(string[] args)
 {
     Console.Title = "Hello Service Client";
     Console.ForegroundColor = ConsoleColor.White;
     Console.WriteLine("Hello Service Client");
     Console.ForegroundColor = ConsoleColor.Gray;
     Console.WriteLine();            
     // create a client using the configuration file App.config
     var client = new HelloClient("HelloService");
     Console.WriteLine("Client Saying Hello to Qpid");
     client.Hello("Qpid");
     Console.WriteLine("Client Saying Hello to AMQP");
     client.Hello("AMQP");
     // closing the client service 
     client.ChannelFactory.Close();         
     Console.WriteLine();
     Console.Write("Press Enter to Exit...");
     Console.ReadLine();
 }
Example #8
0
        static void Main()
        {
            Console.WriteLine("--    EchoServer/HelloClient    --");
            EchoServer.StartEchoServer();
            HelloClient.Connect();

            Task.Delay(50).Wait(); //Wait 50 milliseconds to let HelloClient finish

            Console.WriteLine("--    BasicServer/BasicClient    --");
            BasicServer.StartBasicServer();
            BasicClient.Connect();

            Task.Delay(50).Wait(); //Wait 50 milliseconds to let BasicClient finish

            Console.WriteLine("--    EasyTcpPacketExample    --");
            EasyTcpPacketExample.Start();
            EasyTcpPacketExample.Connect();

            Task.Delay(50).Wait(); //Wait 50 milliseconds to let EasyTcpPacketExample finish

            Console.WriteLine("--    EncryptionExample    --");
            EncryptionExample.Start();
            EncryptionExample.Connect();

            Task.Delay(50).Wait(); //Wait 50 milliseconds to let EncryptionExample finish

            Console.WriteLine("--    FileServer/FileClient    --");
            FileServer.StartFileServer();
            FileClient.Download("TestFile.txt", "DownloadedTestFile.txt");
            FileClient.Upload("TestFile.txt", "UploadedTestFile.txt");

            Task.Delay(50).Wait(); //Wait 50 milliseconds to let FileClient finish

            Console.WriteLine("--    EchoServer/SpeedTestClient    --");
            SpeedTestClient.RunSpeedTest();

            Console.WriteLine("--    ActionEchoServer/ActionSpeedTestClient    --");
            ActionEchoServer.StartEchoServer();
            ActionSpeedTestClient.RunSpeedTest();

            Task.Delay(-1).Wait();
        }
Example #9
0
        static async Task MainAsync(string[] args)
        {
            var isServer = args[0].Equals("server");

            if (isServer)
            {
                var server = new HelloServer();
                server.Listen();
                Console.WriteLine("Listening...");
                Console.ReadKey();
                await server.ShutdownAsync();
            }
            else
            {
                var client = new HelloClient();
                client.Connect();
                Console.WriteLine(await client.SendMessageAsync());
                await client.ShutdownAsync();
            }
        }
Example #10
0
        static void Main()
        {
            // Create a client.
            HelloClient client = new HelloClient();

            // Add a reference-parameter header to the address.
            // Since the EndpointAddress class is immutable, we must use
            // EndpointAddressBuilder to change the value.
            EndpointAddressBuilder builder = new EndpointAddressBuilder(client.Endpoint.Address);
            AddressHeader header = AddressHeader.CreateAddressHeader(IDName, IDNamespace, "John");
            builder.Headers.Add(header);
            client.Endpoint.Address = builder.ToEndpointAddress();

            // Call the Hello service operation.
            Console.WriteLine(client.Hello());

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Example #11
0
    //to remove
    //private bool fond = false;
    //private string[] labels2;
    //private TFSession session2;
    //private TFGraph graph2;
    //public static Color32[] img32;
    //public TextAsset labelMap2;
    //public TextAsset model2;
    //private Thread modelThread2;

    // Use this for initialization
    void Start()
    {
#if UNITY_ANDROID
        TensorFlowSharp.Android.NativeBinding.Init();
#endif
        //load labels into string array
        labels = labelMap.ToString().Split('\n');

        //load graph
        graph = new TFGraph();
        graph.Import(model.bytes);
        session = new TFSession(graph);

        string[] lines = dictMap.text.Split("\n"[0]);
        d = new Dictionary <string, string>();
        foreach (string line in lines)
        {
            String[] strlist = line.Split(spearator);
            d.Add(strlist[0].ToLower().Trim(), strlist[1].Trim());
        }

        hc = new HelloClient();
    }
Example #12
0
        static void Main()
        {
            // Create a client.
            HelloClient client = new HelloClient();

            // Add a reference-parameter header to the address.
            // Since the EndpointAddress class is immutable, we must use
            // EndpointAddressBuilder to change the value.
            EndpointAddressBuilder builder = new EndpointAddressBuilder(client.Endpoint.Address);
            AddressHeader          header  = AddressHeader.CreateAddressHeader(IDName, IDNamespace, "John");

            builder.Headers.Add(header);
            client.Endpoint.Address = builder.ToEndpointAddress();

            // Call the Hello service operation.
            Console.WriteLine(client.Hello());

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
Example #13
0
 public ModuleService(HelloClient graphQLClient)
 {
     GraphQLClient = graphQLClient;
 }