Inheritance: System.Exception
Beispiel #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();
                }
            }
        }
Beispiel #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));
        }
Beispiel #3
0
        public void SetPadding(float pixels)
        {
            if (pixels < 0)
            {
                throw new ArgumentOutOfRangeException("pixels");
            }

            WindowerException.Check(NativeMethods.windower_text_set_padding(this.handle, pixels));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #9
0
 public void HideBackground()
 {
     WindowerException.Check(NativeMethods.windower_text_hide_background(this.handle));
 }
Beispiel #10
0
 public void ShowBackground()
 {
     WindowerException.Check(NativeMethods.windower_text_show_background(this.handle));
 }
Beispiel #11
0
 public void SetStyle(FontStyles style)
 {
     WindowerException.Check(NativeMethods.windower_text_set_style(this.handle, style));
 }
Beispiel #12
0
 public void SetKeyState(Key key, KeyState state)
 {
     WindowerException.Check(NativeMethods.windower_set_key_state(this.handle, key, state));
 }
Beispiel #13
0
 public void SetLocation(int x, int y)
 {
     WindowerException.Check(NativeMethods.windower_text_set_location(this.handle, x, y));
 }
Beispiel #14
0
 public void Hide()
 {
     WindowerException.Check(NativeMethods.windower_text_hide(this.handle));
 }
Beispiel #15
0
 public void Show()
 {
     WindowerException.Check(NativeMethods.windower_text_show(this.handle));
 }
Beispiel #16
0
 public void SetAlignment(TextAlignment alignment)
 {
     WindowerException.Check(NativeMethods.windower_text_set_alignment(this.handle, alignment));
 }
Beispiel #17
0
 public void SetForeground(byte red, byte green, byte blue)
 {
     WindowerException.Check(NativeMethods.windower_text_set_foreground(this.handle, red, green, blue, 255));
 }
Beispiel #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));
 }
Beispiel #19
0
 public void Unblock(InputKinds kind)
 {
     WindowerException.Check(NativeMethods.windower_unblock(this.handle, kind));
 }
Beispiel #20
0
 public void SetWeight(FontWeight weight)
 {
     WindowerException.Check(NativeMethods.windower_text_set_weight(this.handle, weight));
 }