Пример #1
0
        public void SetButton(Keys key, GMacroKeyButton btn)
        {
            int num;

            if (key == Keys.Shift)
            {
                num = 0x10000;
            }
            else if (key == Keys.Alt)
            {
                num = 0x10001;
            }
            else if (key == Keys.Control)
            {
                num = 0x10002;
            }
            else
            {
                num = (int)key;
            }
            if ((num >= 0) && (num < this.m_Buttons.Length))
            {
                this.SetButton(this.m_Buttons, num, btn);
            }
            else
            {
                num -= 0x10000;
                if ((num >= 0) && (num < this.m_HighButtons.Length))
                {
                    this.SetButton(this.m_HighButtons, num, btn);
                }
            }
        }
Пример #2
0
        public void PlaceKey(Keys key, string name, float w, float h)
        {
            GMacroKeyButton btn = new GMacroKeyButton(key, name, this.m_Bold, 4 + ((int)(this.m_fX * 28f)), 4 + ((int)(this.m_fY * 28f)), 1 + ((int)(w * 28f)), 1 + ((int)(h * 28f)));

            this.SetButton(key, btn);
            base.m_Children.Add(btn);
            this.m_fX += w;
        }
Пример #3
0
        private void SetButton(object[] objs, int index, GMacroKeyButton btn)
        {
            object obj2 = objs[index];

            if (!(obj2 is GMacroKeyButton[]))
            {
                if (obj2 is GMacroKeyButton)
                {
                    objs[index] = new GMacroKeyButton[] { (GMacroKeyButton)obj2, btn };
                }
                else
                {
                    objs[index] = btn;
                }
            }
        }
Пример #4
0
        public void Update()
        {
            ArrayList dataStore = Engine.GetDataStore();

            Gump[] gumpArray = base.m_Children.ToArray();
            for (int i = 0; i < gumpArray.Length; i++)
            {
                GMacroKeyButton button = gumpArray[i] as GMacroKeyButton;
                if ((button != null) && (button.Macro != null))
                {
                    dataStore.Add(button);
                }
            }
            bool      flag  = (this.m_Mods & MacroModifiers.All) != MacroModifiers.None;
            bool      flag2 = (this.m_Mods & MacroModifiers.Ctrl) != MacroModifiers.None;
            bool      flag3 = (this.m_Mods & MacroModifiers.Alt) != MacroModifiers.None;
            bool      flag4 = (this.m_Mods & MacroModifiers.Shift) != MacroModifiers.None;
            ArrayList list  = Macros.List;

            for (int j = 0; j < list.Count; j++)
            {
                Macro mc = (Macro)list[j];
                if (flag || (((mc.Control == flag2) && (mc.Alt == flag3)) && (mc.Shift == flag4)))
                {
                    object obj2 = this.GetButton(mc.Key);
                    if (obj2 is GMacroKeyButton[])
                    {
                        GMacroKeyButton[] buttonArray = (GMacroKeyButton[])obj2;
                        for (int m = 0; m < buttonArray.Length; m++)
                        {
                            this.SetMacro(dataStore, buttonArray[m], mc);
                        }
                    }
                    else if (obj2 is GMacroKeyButton)
                    {
                        this.SetMacro(dataStore, (GMacroKeyButton)obj2, mc);
                    }
                }
            }
            for (int k = 0; k < dataStore.Count; k++)
            {
                ((GMacroKeyButton)dataStore[k]).Macro = null;
            }
            Engine.ReleaseDataStore(dataStore);
        }
Пример #5
0
 private void SetMacro(ArrayList list, GMacroKeyButton btn, Macro mc)
 {
     if (list.Contains(btn) || (btn.Macro == null))
     {
         list.Remove(btn);
         btn.Macro = mc;
     }
     else if (btn.Macro is Macro)
     {
         btn.Macro = new Macro[] { (Macro)btn.Macro, mc };
     }
     else if (btn.Macro is Macro[])
     {
         Macro[] macro       = (Macro[])btn.Macro;
         Macro[] macroArray2 = new Macro[macro.Length + 1];
         for (int i = 0; i < macro.Length; i++)
         {
             macroArray2[i] = macro[i];
         }
         macroArray2[macro.Length] = mc;
         btn.Macro = macroArray2;
     }
 }
Пример #6
0
 private void SetMacro(ArrayList list, GMacroKeyButton btn, Macro mc)
 {
     if (list.Contains(btn) || (btn.Macro == null))
     {
         list.Remove(btn);
         btn.Macro = mc;
     }
     else if (btn.Macro is Macro)
     {
         btn.Macro = new Macro[] { (Macro) btn.Macro, mc };
     }
     else if (btn.Macro is Macro[])
     {
         Macro[] macro = (Macro[]) btn.Macro;
         Macro[] macroArray2 = new Macro[macro.Length + 1];
         for (int i = 0; i < macro.Length; i++)
         {
             macroArray2[i] = macro[i];
         }
         macroArray2[macro.Length] = mc;
         btn.Macro = macroArray2;
     }
 }
Пример #7
0
 private void SetButton(object[] objs, int index, GMacroKeyButton btn)
 {
     object obj2 = objs[index];
     if (!(obj2 is GMacroKeyButton[]))
     {
         if (obj2 is GMacroKeyButton)
         {
             objs[index] = new GMacroKeyButton[] { (GMacroKeyButton) obj2, btn };
         }
         else
         {
             objs[index] = btn;
         }
     }
 }
Пример #8
0
 public void SetButton(Keys key, GMacroKeyButton btn)
 {
     int num;
     if (key == Keys.Shift)
     {
         num = 0x10000;
     }
     else if (key == Keys.Alt)
     {
         num = 0x10001;
     }
     else if (key == Keys.Control)
     {
         num = 0x10002;
     }
     else
     {
         num = (int) key;
     }
     if ((num >= 0) && (num < this.m_Buttons.Length))
     {
         this.SetButton(this.m_Buttons, num, btn);
     }
     else
     {
         num -= 0x10000;
         if ((num >= 0) && (num < this.m_HighButtons.Length))
         {
             this.SetButton(this.m_HighButtons, num, btn);
         }
     }
 }
Пример #9
0
 public void PlaceKey(Keys key, string name, float w, float h)
 {
     GMacroKeyButton btn = new GMacroKeyButton(key, name, this.m_Bold, 4 + ((int) (this.m_fX * 28f)), 4 + ((int) (this.m_fY * 28f)), 1 + ((int) (w * 28f)), 1 + ((int) (h * 28f)));
     this.SetButton(key, btn);
     base.m_Children.Add(btn);
     this.m_fX += w;
 }