public string GetText(int handle)
        {
            try
            {
                var ptr = new IntPtr(handle);
                foreach (var form in _luaForms)
                {
                    if (form.Handle == ptr)
                    {
                        return(form.Text);
                    }

                    foreach (Control control in form.Controls)
                    {
                        if (control.Handle == ptr)
                        {
                            if (control is LuaDropDown)
                            {
                                return((control as LuaDropDown).SelectedItem.ToString());
                            }

                            return(control.Text);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ConsoleLuaLibrary.Log(ex.Message);
            }

            return(string.Empty);
        }
        public string GetProperty(int handle, string property)
        {
            try
            {
                var ptr = new IntPtr(handle);
                foreach (var form in _luaForms)
                {
                    if (form.Handle == ptr)
                    {
                        return(form.GetType().GetProperty(property).GetValue(form, null).ToString());
                    }

                    foreach (Control control in form.Controls)
                    {
                        if (control.Handle == ptr)
                        {
                            return(control.GetType().GetProperty(property).GetValue(control, null).ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ConsoleLuaLibrary.Log(ex.Message);
            }

            return(string.Empty);
        }
        public void SetDropdownItems(
            int handle,
            LuaTable items)
        {
            try {
                var ptr = new IntPtr(handle);
                foreach (var form in _luaForms)
                {
                    if (form.Handle == ptr)
                    {
                        return;
                    }

                    foreach (Control control in form.Controls)
                    {
                        if (control.Handle == ptr)
                        {
                            if (control is LuaDropDown)
                            {
                                var dropdownItems = items.Values.Cast <string>().ToList();
                                dropdownItems.Sort();
                                (control as LuaDropDown).SetItems(dropdownItems);
                            }

                            return;
                        }
                    }
                }
            } catch (Exception ex) {
                ConsoleLuaLibrary.Log(ex.Message);
            }
        }
Exemplo n.º 4
0
        public void DrawImageRegion(string path, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int?dest_width = null, int?dest_height = null)
        {
            if (!File.Exists(path))
            {
                ConsoleLuaLibrary.Log("File not found: " + path + "\nScript Terminated");
                return;
            }

            luaPictureBox.DrawImageRegion(path, source_x, source_y, source_width, source_height, dest_x, dest_y, dest_width, dest_height);
        }
Exemplo n.º 5
0
        public void DrawImage(string path, int x, int y, int?width = null, int?height = null, bool cache = true)
        {
            if (!File.Exists(path))
            {
                ConsoleLuaLibrary.Log("File not found: " + path + "\nScript Terminated");
                return;
            }

            luaPictureBox.DrawImage(path, x, y, width, height, cache);
        }
Exemplo n.º 6
0
        public void DrawImageRegion(string path, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int destX, int destY, int?destWidth = null, int?destHeight = null)
        {
            if (!File.Exists(path))
            {
                ConsoleLuaLibrary.Log($"File not found: {path}\nScript Terminated");
                return;
            }

            luaPictureBox.DrawImageRegion(path, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight);
        }
Exemplo n.º 7
0
 public void DrawPolygon(LuaTable points, int?x = null, int?y = null, Color?line = null, Color?background = null)
 {
     try
     {
         luaPictureBox.DrawPolygon(points, x, y, line, background);
     }
     catch (Exception ex)
     {
         ConsoleLuaLibrary.Log(ex.Message);
     }
 }
Exemplo n.º 8
0
 public void DrawPixel(int x, int y, Color?color = null)
 {
     try
     {
         luaPictureBox.DrawPixel(x, y, color);
     }
     catch (Exception ex)
     {
         ConsoleLuaLibrary.Log(ex.Message);
     }
 }
Exemplo n.º 9
0
 public void DrawIcon(string path, int x, int y, int?width = null, int?height = null)
 {
     try
     {
         luaPictureBox.DrawIcon(path, x, y, width, height);
     }
     catch (Exception ex)
     {
         ConsoleLuaLibrary.Log(ex.Message);
     }
 }
Exemplo n.º 10
0
 public void DrawEllipse(int x, int y, int width, int height, Color?line = null, Color?background = null)
 {
     try
     {
         luaPictureBox.DrawEllipse(x, y, width, height, line, background);
     }
     catch (Exception ex)
     {
         ConsoleLuaLibrary.Log(ex.Message);
     }
 }
Exemplo n.º 11
0
 public void DrawBox(int x, int y, int x2, int y2, Color?line = null, Color?background = null)
 {
     try
     {
         luaPictureBox.DrawBox(x, y, x2, y2, line, background);
     }
     catch (Exception ex)
     {
         ConsoleLuaLibrary.Log(ex.Message);
     }
 }
Exemplo n.º 12
0
 public void DrawBezier(LuaTable points, Color color)
 {
     try
     {
         luaPictureBox.DrawBezier(points, color);
     }
     catch (Exception ex)
     {
         ConsoleLuaLibrary.Log(ex.Message);
     }
 }
Exemplo n.º 13
0
 public void FrameSkip(int numFrames)
 {
     if (numFrames > 0)
     {
         Global.Config.FrameSkip = numFrames;
         GlobalWin.MainForm.FrameSkipMessage();
     }
     else
     {
         ConsoleLuaLibrary.Log("Invalid frame skip value");
     }
 }
Exemplo n.º 14
0
 public static void Print(params object[] outputs)
 {
     ConsoleLuaLibrary.Log(outputs);
 }