Inheritance: System.Exception
Esempio n. 1
0
        public string NextCommand()
        {
            SafeCommandHandle command = null;

            try
            {
                uint   length;
                IntPtr ptr;

                ErrorCode result = NativeMethods.windower_next_command(this.handle, out command);
                if (result == ErrorCode.OutOfRange)
                {
                    return(null);
                }

                WindowerException.Check(result);
                WindowerException.Check(NativeMethods.windower_command_length(command, out length));
                WindowerException.Check(NativeMethods.windower_command_string(command, out ptr));

                byte[] buffer = new byte[length];
                Marshal.Copy(ptr, buffer, 0, (int)length);
                return(UTF8.GetString(buffer));
            }
            finally
            {
                if (command != null)
                {
                    command.Dispose();
                }
            }
        }
Esempio n. 2
0
        public Text(Instance instance, string name)
        {
            int asciinamelength = Instance.ASCII.GetMaxByteCount(name.Length) + 1;

            byte[] asciiname = new byte[asciinamelength];
            Instance.ASCII.GetBytes(name, 0, name.Length, asciiname, 0);
            WindowerException.Check(NativeMethods.windower_text_create(instance.Handle, out this.handle, asciiname));
        }
Esempio n. 3
0
        public void SetPadding(float pixels)
        {
            if (pixels < 0)
            {
                throw new ArgumentOutOfRangeException("pixels");
            }

            WindowerException.Check(NativeMethods.windower_text_set_padding(this.handle, pixels));
        }
Esempio n. 4
0
        public Instance(Process process)
        {
            NativeMethods.Initialize();

            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            WindowerException.Check(NativeMethods.windower_create(out this.handle, (uint)process.Id));
        }
Esempio n. 5
0
        public void SetFont(string typeface, float size)
        {
            if (typeface == null)
            {
                throw new ArgumentNullException("typeface");
            }

            int utf8typefacelength = Instance.UTF8.GetMaxByteCount(typeface.Length) + 1;

            byte[] utf8typeface = new byte[utf8typefacelength];
            Instance.UTF8.GetBytes(typeface, 0, typeface.Length, utf8typeface, 0);
            WindowerException.Check(NativeMethods.windower_text_set_font(this.handle, utf8typeface, size));
        }
Esempio n. 6
0
        public void SetText(string text)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }

            int utf8textlength = Instance.UTF8.GetMaxByteCount(text.Length) + 1;

            byte[] utf8text = new byte[utf8textlength];
            Instance.UTF8.GetBytes(text, 0, text.Length, utf8text, 0);
            WindowerException.Check(NativeMethods.windower_text_set_text(this.handle, utf8text));
        }
Esempio n. 7
0
        public void SendString(string text)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }

            int utf8textlength = Encoding.UTF8.GetMaxByteCount(text.Length) + 1;

            byte[] utf8text = new byte[utf8textlength];
            UTF8.GetBytes(text, 0, text.Length, utf8text, 0);
            WindowerException.Check(NativeMethods.windower_send_string(this.handle, utf8text));
        }
Esempio n. 8
0
        public Instance(string domain, Process process)
        {
            NativeMethods.Initialize();

            if (domain == null)
            {
                throw new ArgumentNullException("domain");
            }

            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            int utf8domainlength = UTF8.GetMaxByteCount(domain.Length) + 1;

            byte[] utf8domain = new byte[utf8domainlength];
            UTF8.GetBytes(domain, 0, domain.Length, utf8domain, 0);
            WindowerException.Check(NativeMethods.windower_create_remote(out this.handle, utf8domain, (uint)process.Id));
        }
Esempio n. 9
0
 public void HideBackground()
 {
     WindowerException.Check(NativeMethods.windower_text_hide_background(this.handle));
 }
Esempio n. 10
0
 public void ShowBackground()
 {
     WindowerException.Check(NativeMethods.windower_text_show_background(this.handle));
 }
Esempio n. 11
0
 public void SetStyle(FontStyles style)
 {
     WindowerException.Check(NativeMethods.windower_text_set_style(this.handle, style));
 }
Esempio n. 12
0
 public void SetKeyState(Key key, KeyState state)
 {
     WindowerException.Check(NativeMethods.windower_set_key_state(this.handle, key, state));
 }
Esempio n. 13
0
 public void SetLocation(int x, int y)
 {
     WindowerException.Check(NativeMethods.windower_text_set_location(this.handle, x, y));
 }
Esempio n. 14
0
 public void Hide()
 {
     WindowerException.Check(NativeMethods.windower_text_hide(this.handle));
 }
Esempio n. 15
0
 public void Show()
 {
     WindowerException.Check(NativeMethods.windower_text_show(this.handle));
 }
Esempio n. 16
0
 public void SetAlignment(TextAlignment alignment)
 {
     WindowerException.Check(NativeMethods.windower_text_set_alignment(this.handle, alignment));
 }
Esempio n. 17
0
 public void SetForeground(byte red, byte green, byte blue)
 {
     WindowerException.Check(NativeMethods.windower_text_set_foreground(this.handle, red, green, blue, 255));
 }
Esempio n. 18
0
 public void SetBackground(byte red, byte green, byte blue, byte alpha)
 {
     WindowerException.Check(NativeMethods.windower_text_set_background(this.handle, red, green, blue, alpha));
 }
Esempio n. 19
0
 public void Unblock(InputKinds kind)
 {
     WindowerException.Check(NativeMethods.windower_unblock(this.handle, kind));
 }
Esempio n. 20
0
 public void SetWeight(FontWeight weight)
 {
     WindowerException.Check(NativeMethods.windower_text_set_weight(this.handle, weight));
 }