public static void HotKeyPlay( Macro m ) { if ( m != null ) { Play( m ); World.Player.SendMessage( LocString.PlayingA1, m ); Engine.MainWindow.PlayMacro( m ); } }
public MacroInsertIf( Macro m, int idx ) { m_Macro = m; m_Idx = idx; // // Required for Windows Form Designer support // InitializeComponent(); foreach ( Counter c in Counter.List ) varList.Items.Add( c.Name ); }
public MacroInsertWait( Macro m, int idx ) { m_Macro = m; m_Idx = idx; // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // }
private static void Recurse(TreeNodeCollection nodes, string path) { try { string[] macros = Directory.GetFiles(path, "*.macro"); for (int i = 0; i < macros.Length; i++) { Macro m = null; for (int j = 0; j < m_List.Count; j++) { Macro check = (Macro)m_List[j]; if (check.Filename == macros[i]) { m = check; break; } } if (m == null) { Add(m = new Macro(macros[i])); } if (nodes != null) { TreeNode node = new TreeNode(Path.GetFileNameWithoutExtension(m.Filename)); node.Tag = m; nodes.Add(node); } } } catch { } try { string[] dirs = Directory.GetDirectories(path); for (int i = 0; i < dirs.Length; i++) { if (dirs[i] != "" && dirs[i] != "." && dirs[i] != "..") { if (nodes != null) { TreeNode node = new TreeNode(String.Format("[{0}]", Path.GetFileName(dirs[i]))); node.Tag = dirs[i]; nodes.Add(node); Recurse(node.Nodes, dirs[i]); } else { Recurse(null, dirs[i]); } } } } catch { } }
//public static bool IsWaiting{ get{ return Playing && m_Current != null && m_Current.Waiting; } } public static void Add( Macro m ) { HotKey.Add( HKCategory.Macros, HKSubCat.None, Language.Format( LocString.PlayA1, m ), new HotKeyCallbackState( HotKeyPlay ), m ); m_List.Add( m ); }
private void RedrawActionList( Macro m ) { int sel = actionList.SelectedIndex; m.DisplayTo( actionList ); actionList.SelectedIndex = sel; }
private static void Recurse( TreeNodeCollection nodes, string path ) { try { string[] macros = Directory.GetFiles( path, "*.macro" ); for (int i=0;i<macros.Length;i++) { Macro m = null; for(int j=0;j<m_List.Count;j++) { Macro check = (Macro)m_List[j]; if ( check.Filename == macros[i] ) { m = check; break; } } if ( m == null ) Add( m = new Macro( macros[i] ) ); if ( nodes != null ) { TreeNode node = new TreeNode( Path.GetFileNameWithoutExtension( m.Filename ) ); node.Tag = m; nodes.Add( node ); } } } catch { } try { string[] dirs = Directory.GetDirectories( path ); for (int i=0;i<dirs.Length;i++) { if ( dirs[i] != "" && dirs[i] != "." && dirs[i] != ".." ) { if ( nodes != null ) { TreeNode node = new TreeNode( String.Format( "[{0}]", Path.GetFileName( dirs[i] ) ) ); node.Tag = dirs[i]; nodes.Add( node ); Recurse( node.Nodes, dirs[i] ); } else { Recurse( null, dirs[i] ); } } } } catch { } }
public static void Remove( Macro m ) { HotKey.Remove( Language.Format( LocString.PlayA1, m ) ); m_List.Remove( m ); }
public static void Select( Macro m, ListBox actionList, Button play, Button rec, CheckBox loop ) { if ( m == null ) return; m.DisplayTo( actionList ); if ( Recording ) { play.Enabled = false; play.Text = "Play"; rec.Enabled = true; rec.Text = "Stop"; } else { play.Enabled = true; if ( m.Playing ) { play.Text = "Stop"; rec.Enabled = false; } else { play.Text = "Play"; rec.Enabled = true; } rec.Text = "Record"; loop.Checked = m.Loop; } }
public static void Record( Macro m ) { if ( m_Current != null ) m_Current.Stop(); m_Current = m; m_Current.Record(); }
public static void RecordAt( Macro m, int at ) { if ( m_Current != null ) m_Current.Stop(); m_Current = m; m_Current.RecordAt( at ); }
public static void PlayAt( Macro m, int at ) { if ( m_Current != null ) { if ( m_Current.Playing && m_Current.Loop && !m.Loop ) m_PrevPlay = m_Current; else m_PrevPlay = null; m_Current.Stop(); } else { m_PrevPlay = null; } LiftAction.LastLift = null; m_Current = m; m_Current.PlayAt( at ); m_Timer.Macro = m_Current; m_Timer.Start(); if ( Engine.MainWindow.WaitDisplay != null ) Engine.MainWindow.WaitDisplay.Text = ""; }
public void PlayMacro( Macro m ) { playMacro.Text = "Stop"; recMacro.Enabled = false; }
public void OnMacroStart( Macro m ) { actionList.SelectedIndex = -1; macroTree.Enabled = actionList.Enabled = false; newMacro.Enabled = delMacro.Enabled = false; //macroList.SelectedItem = m; macroTree.SelectedNode = FindNode( macroTree.Nodes, m ); macroTree.Update(); macroTree.Refresh(); m.DisplayTo( actionList ); }
//public static bool IsWaiting{ get{ return Playing && m_Current != null && m_Current.Waiting; } } public static void Add(Macro m) { HotKey.Add(HKCategory.Macros, HKSubCat.None, Language.Format(LocString.PlayA1, m), new HotKeyCallbackState(HotKeyPlay), m); m_List.Add(m); }
public static void Stop( bool restartPrev ) { m_Timer.Stop(); if ( m_Current != null ) { m_Current.Stop(); m_Current = null; } ClientCommunication.PostMacroStop(); if ( Engine.MainWindow.WaitDisplay != null ) Engine.MainWindow.WaitDisplay.Text = ""; Engine.MainWindow.OnMacroStop(); //if ( restartPrev ) // Play( m_PrevPlay ); m_PrevPlay = null; }
public static void Remove(Macro m) { HotKey.Remove(Language.Format(LocString.PlayA1, m)); m_List.Remove(m); }
private void newMacro_Click(object sender, System.EventArgs e) { if ( InputBox.Show( this, Language.GetString( LocString.NewMacro ), Language.GetString( LocString.EnterAName ) ) ) { string name = InputBox.GetString(); if ( name == null || name == "" || name.IndexOfAny( Path.GetInvalidPathChars() ) != -1 || name.IndexOfAny( m_InvalidNameChars ) != -1 ) { MessageBox.Show( this, Language.GetString( LocString.InvalidChars ), Language.GetString( LocString.Invalid ), MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } TreeNode node = GetMacroDirNode(); string path = (node == null || !(node.Tag is string)) ? Config.GetUserDirectory("Macros") : (string)node.Tag; path = Path.Combine( path, name+".macro" ); if ( File.Exists( path ) ) { MessageBox.Show( this, Language.GetString( LocString.MacroExists ), Language.GetString( LocString.Invalid ), MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } try { File.CreateText( path ).Close(); } catch { return; } Macro m = new Macro( path ); MacroManager.Add( m ); TreeNode newNode = new TreeNode( Path.GetFileNameWithoutExtension( m.Filename ) ); newNode.Tag = m; if ( node == null ) macroTree.Nodes.Add( newNode ); else node.Nodes.Add( newNode ); macroTree.SelectedNode = newNode; } RedrawMacros(); }