Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Toolbox.Logging.PrintGreeting();
            WaveProperties properties = GetWaveProperties(args);

            if (properties.Error == null)
            {
                Task.Run(() => CalculateWave(properties.Singularity, properties.Bailout, properties.Interval, properties.WaveFactor));
            }
            else
            {
                Toolbox.Logging.PrintUsage(properties.Error.Message);
            }
            Console.Read();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Bitmap bmp = new Bitmap("frog.png");

            for (int y = 0; y < bmp.Height; y++)
            {
                for (int x = 0; x < bmp.Width; x++)
                {
                    Console.Write("#", bmp.GetPixel(x, y));
                }
                Console.WriteLine();
            }



            Console.Read();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            WriteSermonWord();

            var server = new AsyncServer();

            server.Connect();
            while (true)
            {
                var letter = CollectArguments();
                System.Console.WriteLine(server.GetSermon(letter.ToString()));
                Console.Read();
            }

            //server.Send("DOMINUS VOBISCUM");
            //var resp = server.Receive();
            //System.Console.WriteLine(resp);
            //server.Send(letter.ToString());
            //var rp = server.Receive();
            //System.Console.WriteLine(rp);
        }
Exemplo n.º 4
0
        private void DisplayUsers()
        {
            // authenticates
            AuthenticationResponse authentication =
                new Authentication(new Credentials("admin", "password"))
                .PerformRequestAsync()
                .Result;

            if (authentication.IsSuccess)
            {
                Console.WriteLine("Authentication success.", Color.Cyan);
                Console.WriteLineFormatted(
                    "{0}: {1}",
                    Color.White,
                    new Formatter[]
                {
                    new Formatter("Context ID", Color.White),
                    new Formatter(authentication.ContextID, Color.PaleGreen)
                }
                    );
            }
            else
            {
                Console.WriteLine("Authentication failed.", Color.Cyan);
                Console.WriteLine(authentication.Error.ErrorMessage, Color.Gray);
            }
            Console.WriteLine();

            // get device list
            DevicesResponse devices = new Devices()
                                      .PerformRequestAsync()
                                      .Result;

            if (devices.IsSuccess)
            {
                Console.WriteLine("Device list:", Color.Cyan);
                foreach (Device device in devices.Devices.OrderBy(d => !d.IsConnected).ThenBy(d => d.DisplayName))
                {
                    Console.WriteLineFormatted(
                        " - {0} ({1}{2}{3})",
                        Color.White,
                        new Formatter[]
                    {
                        new Formatter(device.DisplayName, Color.White),
                        new Formatter(
                            device.IsConnected ? device.HasAddress ? device.Addresses[0].IpAddress : "no address" : "disconnected",
                            device.IsConnected ? device.HasAddress ? Color.PaleGreen : Color.LightGoldenrodYellow : Color.IndianRed
                            ),
                        new Formatter(
                            device.IsConnected ? device.IsEthernet ? ", " : ", " : "",
                            Color.White
                            ),
                        new Formatter(
                            device.IsConnected ? device.IsEthernet ? "ethernet" : "wireless" : "",
                            device.IsConnected ? device.IsEthernet ? Color.PaleGreen : Color.LightGoldenrodYellow : Color.White
                            )
                    }
                        );
                }
            }
            else
            {
                Console.WriteLine("Failed.", Color.Cyan);
                Console.WriteLine(authentication.Error.ErrorMessage, Color.Gray);
            }
            Console.WriteLine();

            // disables wifi
            WsResponse ws = new WsRequest(
                "NMC.Wifi", "set",
                new Dictionary <string, string>()
            {
                { "Enable", "False" },
                { "Status", "False" }
            })
                            .PerformRequestAsync()
                            .Result;

            Console.WriteLine("Disabling Wi-Fi.", Color.Cyan);
            if (ws.IsSuccess)
            {
                Console.WriteLineFormatted(
                    "{0}.",
                    Color.White,
                    new Formatter[]
                {
                    new Formatter("Succeed", Color.PaleGreen),
                }
                    );
            }
            else
            {
                Console.WriteLineFormatted(
                    "{0}. {1} ({2}).",
                    Color.White,
                    new Formatter[]
                {
                    new Formatter("Failed", Color.IndianRed),
                    new Formatter(ws.Error.ErrorMessage, Color.Gray),
                    new Formatter(ws.Error.ErrorCode, Color.Gray)
                }
                    );
            }
            Console.WriteLine();

            // gets ws paths
            Console.WriteLine("Listing WS paths.", Color.Cyan);
            foreach (WsPath path in WsRequest.GetWsPaths().Result)
            {
                Console.WriteLineFormatted(
                    " - {0} [ {1} ]",
                    Color.White,
                    new Formatter[]
                {
                    new Formatter(path.Path, Color.PaleGreen),
                    new Formatter(string.Join(", ", path.Methods.ToArray()), Color.Gray),
                }
                    );
            }

            Console.Read();
        }