private void SetMacro(ArrayList list, GMacroKeyButton btn, Macro mc) { if (list.Contains((object)btn) || btn.Macro == null) { list.Remove((object)btn); btn.Macro = (object)mc; } else if (btn.Macro is Macro) { btn.Macro = (object)new Macro[2] { (Macro)btn.Macro, mc }; } else { if (!(btn.Macro is Macro[])) { return; } Macro[] macroArray1 = (Macro[])btn.Macro; Macro[] macroArray2 = new Macro[macroArray1.Length + 1]; for (int index = 0; index < macroArray1.Length; ++index) { macroArray2[index] = macroArray1[index]; } macroArray2[macroArray1.Length] = mc; btn.Macro = (object)macroArray2; } }
public void PlaceKey(Keys key, string name, float w, float h) { GMacroKeyButton btn = new GMacroKeyButton(key, name, this.m_Bold, 4 + (int)((double)this.m_fX * 28.0), 4 + (int)((double)this.m_fY * 28.0), 1 + (int)((double)w * 28.0), 1 + (int)((double)h * 28.0)); this.SetButton(key, btn); this.m_Children.Add((Gump)btn); this.m_fX += w; }
public void SetButton(Keys key, GMacroKeyButton btn) { int index1 = key != Keys.Shift ? (key != Keys.Alt ? (key != Keys.Control ? (int)key : 65538) : 65537) : 65536; if (index1 >= 0 && index1 < this.m_Buttons.Length) { this.SetButton(this.m_Buttons, index1, btn); } else { int index2 = index1 - 65536; if (index2 < 0 || index2 >= this.m_HighButtons.Length) { return; } this.SetButton(this.m_HighButtons, index2, btn); } }
public void Update() { ArrayList dataStore = Engine.GetDataStore(); foreach (Gump gump in this.m_Children.ToArray()) { GMacroKeyButton gmacroKeyButton = gump as GMacroKeyButton; if (gmacroKeyButton != null && gmacroKeyButton.Macro != null) { dataStore.Add((object)gmacroKeyButton); } } bool flag1 = (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; MacroCollection list = Macros.List; for (int index = 0; index < list.Count; ++index) { Macro mc = list[index]; if (flag1 || mc.Control == flag2 && mc.Alt == flag3 && mc.Shift == flag4) { object button = this.GetButton(mc.Key); if (button is GMacroKeyButton[]) { foreach (GMacroKeyButton btn in (GMacroKeyButton[])button) { this.SetMacro(dataStore, btn, mc); } } else if (button is GMacroKeyButton) { this.SetMacro(dataStore, (GMacroKeyButton)button, mc); } } } for (int index = 0; index < dataStore.Count; ++index) { ((GMacroKeyButton)dataStore[index]).Macro = (object)null; } Engine.ReleaseDataStore(dataStore); }
private void SetButton(object[] objs, int index, GMacroKeyButton btn) { object obj = objs[index]; if (obj is GMacroKeyButton[]) { return; } if (obj is GMacroKeyButton) { objs[index] = (object)new GMacroKeyButton[2] { (GMacroKeyButton)obj, btn } } ; else { objs[index] = (object)btn; } }