Proc Methods

master
Leonardo Domingues 2021-12-06 15:15:37 -03:00
parent 59e4b137c5
commit b8e5810103
1 changed files with 35 additions and 3 deletions

View File

@ -62,7 +62,7 @@ type DEVMODE struct {
/***************** Clip Functions *****************/ /***************** Clip Functions *****************/
func (c *Cli) ClipRead() (string, error) { func (c *Cli) ClipRead() (string, error) {
bs, err := c.HttpCli().RawGet(fmt.Sprintf("/ipc/wingui/clip/read")) bs, err := c.HttpCli().RawGet("/ipc/wingui/clip/read")
return string(bs), err return string(bs), err
} }
@ -74,7 +74,7 @@ func (c *Cli) ClipWrite(site string) error {
/***************** Mouse Functions *****************/ /***************** Mouse Functions *****************/
func (c *Cli) MouseClick() error { func (c *Cli) MouseClick() error {
err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/mouse/click"), nil) err := c.HttpCli().JsonGet("/ipc/wingui/mouse/click", nil)
return err return err
} }
@ -389,7 +389,7 @@ func (c *Cli) ScreenWaitClickCenter(f string, m int) ([]byte, error) {
} }
func (c *Cli) ScreenRes() ([]byte, error) { func (c *Cli) ScreenRes() ([]byte, error) {
url := fmt.Sprintf("/ipc/wingui/screen/res") url := "/ipc/wingui/screen/res"
ret, err := c.HttpCli().RawGet(url) ret, err := c.HttpCli().RawGet(url)
if err != nil { if err != nil {
@ -500,6 +500,38 @@ func (c *Cli) DialogWarn(t, m string) error {
return err return err
} }
/***************** Process Functions *****************/
func (c *Cli) ProcAll() (ret []map[string]interface{}, err error) {
err = c.HttpCli().JsonGet("/ipc/wingui/proc/all", &ret)
return ret, err
}
func (c *Cli) ProcPids() (ret []int, err error) {
err = c.HttpCli().JsonGet("/ipc/wingui/proc/pids", &ret)
return ret, err
}
func (c *Cli) ProcKill(cmd int) (ret string, err error) {
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/proc/kill?cmd=%d", cmd), &ret)
return ret, err
}
func (c *Cli) ProcExec(cmd string) error {
err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/proc/exec?cmd=%s", cmd), nil)
return err
}
func (c *Cli) ProcName(pid int) (ret string, err error) {
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/proc/name?cmd=%d", pid), &ret)
return ret, err
}
func (c *Cli) ProcPath(pid int) (ret string, err error) {
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/proc/path?cmd=%d", pid), &ret)
return ret, err
}
func NewCli() *Cli { func NewCli() *Cli {
ret := &Cli{ApiCli: api.NewApiCli()} ret := &Cli{ApiCli: api.NewApiCli()}
return ret return ret