Ejemplo n.º 1
0
    public override HIDInput ReadJson(JsonReader reader, Type objectType, HIDInput existingValue, bool hasExistingValue, JsonSerializer serializer)
    {
        HIDInput res = null;

        JObject jObject = JObject.Load(reader);


        if (string.IsNullOrEmpty(getValue(jObject, "PosX")))  //key
        {
            HIDKeyInput temp = new HIDKeyInput();
            temp.Key    = (Keys)int.Parse(getValue(jObject, "Key"));
            temp.Status = (KeyStatus)int.Parse(getValue(jObject, "Status"));
            res         = temp;
        }
        else    //mouse
        {
            HIDMouseInput temp = new HIDMouseInput();
            temp.PosX   = int.Parse(getValue(jObject, "PosX"));
            temp.PosY   = int.Parse(getValue(jObject, "PosY"));
            temp.Status = (MouseStatus)int.Parse(getValue(jObject, "Status"));
            res         = temp;
        }

        res.Time = int.Parse(getValue(jObject, "Time"));
        return(res);
    }
Ejemplo n.º 2
0
        private static HIDInput dataGridRow_to_HIDInput(DataGridView dv, int row)
        {
            if (dv.Rows[row].Cells["posx"].Value == null)
            {
                return(null);
            }

            string   posy = (string)dv.Rows[row].Cells["posy"].Value;
            HIDInput temp = null;

            if (string.IsNullOrEmpty(posy))  //keyboard
            {
                HIDKeyInput k = new HIDKeyInput();
                k.Key    = (Keys)dv.Rows[row].Cells["posx"].Value;
                k.Status = (KeyStatus)dv.Rows[row].Cells["status"].Value;
                temp     = k;
            }
            else    //mouse
            {
                HIDMouseInput m = new HIDMouseInput();
                m.PosX   = int.Parse((string)dv.Rows[row].Cells["posx"].Value);
                m.PosY   = int.Parse((string)dv.Rows[row].Cells["posy"].Value);
                m.Status = (MouseStatus)dv.Rows[row].Cells["status"].Value;
                temp     = m;
            }
            temp.Time = int.Parse(dv.Rows[row].Cells["time"].Value.ToString());
            return(temp);
        }
Ejemplo n.º 3
0
        public void settings_to_UI(settings res)
        {
            //sleep

            checkBox2.Checked    = res.Launch.Sleep.Enable;
            numericUpDown1.Value = res.Launch.Sleep.Minutes;
            //time

            checkBox1.Checked    = res.Launch.Timing.Enable;
            numericUpDown4.Value = res.Launch.Timing.Hour;
            numericUpDown3.Value = res.Launch.Timing.Minute;
            numericUpDown2.Value = res.Launch.Timing.Second;
            //http

            checkBox3.Checked       = res.httpGet.Enable;
            textBox1.Text           = res.httpGet.URL;
            comboBox1.SelectedIndex = (int)res.httpGet.Operator;
            textBox2.Text           = res.httpGet.value;
            //proccess
            textBox4.Text     = res.Proccess.Close;
            checkBox4.Checked = res.Proccess.Enable;

            dataGridView1.Rows.Clear();



            for (int i = 0; i < res.HID.Count; i++)
            {
                if (res.HID[i].GetType() == typeof(HIDMouseInput))
                {
                    HIDMouseInput m = (HIDMouseInput)res.HID[i];
                    this.dataGridView1.Rows.Add(this.dataGridView1.Rows.Count, m.Status, m.PosX.ToString(), m.PosY.ToString(), m.Time);
                }
                else if (res.HID[i].GetType() == typeof(HIDKeyInput))
                {
                    HIDKeyInput k = (HIDKeyInput)res.HID[i];
                    this.dataGridView1.Rows.Add(this.dataGridView1.Rows.Count, k.Status, k.Key, string.Empty, k.Time);
                }
            }
        }
Ejemplo n.º 4
0
 public KeyboardEventArgs(HIDKeyInput input)
 {
     KeyInput = input;
 }