static void Main(string[] args) { IntPtr hWnd = FindWindow(null, "scriptrunner"); //put your console window caption here if (hWnd != IntPtr.Zero) { //Hide the window ShowWindow(hWnd, 0); // 0 = SW_HIDE } if (hWnd != IntPtr.Zero) { //Show window again ShowWindow(hWnd, 1); //1 = SW_SHOWNORMA } Core core = new Core(); Allias opt = new Allias(); List <Commands.ICommand> commands = new List <Commands.ICommand>(); ICommand [] cms = { new AutoscriptExecution(), new FileScriptExe(), new HiddenWin(), new Noarguments(), new ShownWindow(), new HelpCmd(), new InstallService(), new RemoveService() }; commands.AddRange(cms); Program.commands = commands; opt.CreateOptions(); opt.LoadAlliaces(); //opt.LoadAlliaces(); if (args.Length > 1) { foreach (ICommand cmd in commands) { if ((args[0].Equals(cmd.Argument())) || (args[0].Contains(cmd.Argument()))) { cmd.Action(args); break; } } System.Console.ReadLine(); Application.Run(); } else { HelpCmd helpcmd = new HelpCmd(); helpcmd.Action(null); System.Console.ReadLine(); Application.Exit(); } }
private void button1_Click(object sender, EventArgs e) { try { Allias al = new Allias(); al.AddAlliaces(txtAllias.Text, txtComnd.Text); this.Close(); } catch (Exception ex) { Program.errorreporting(ex); } }
public void ExecuteCommand(string Cmd) { try { Allias allias = new Allias(); Cmd = allias.ReplaceAllias(Cmd); if (Cmd != null) { string[] files = Directory.GetFiles(Program.ScriptsFolder);; if (Cmd.Contains(run) == true) { if ((Cmd.Contains(run) == true) && (Cmd.Contains(script) == true)) { string tscrpt = Cmd.Substring(Cmd.LastIndexOf(script) + script.Length + 1); //string[] files; //MessageBox.Show(Program.ScriptsFolder + "\\" + tscrpt); //files = Directory.GetFiles(Program.ScriptsFolder ); Executescript(this.SearchList(files, tscrpt)); // MessageBox.Show(this.SearchList(files,tscrpt)); /*else if ((files!=null)&&(files.Length >0)&&(File.Exists(files[0])==true)) * { * Executescript(files[0]); * * // MessageBox.Show(tscrpt); * }*/ } } else if (Cmd.Contains(stop) == true) { if ((Cmd.Contains(stop) == true) && (Cmd.Contains(script) == true)) { string tname, tscript2; DataSet set; ScrablerCore tscrabl = new ScrablerCore(); string tscrpt = Cmd.Substring(Cmd.LastIndexOf(script) + script.Length + 1); //this.SearchList(files,tscrpt) // files = Directory.GetFiles(Program.ScriptsFolder); tscript2 = this.SearchList(files, tscrpt); tname = Path.GetFileName(tscript2); // ScrablerCore.AssemblyCol.Remove(ScrablerCore.AssemblyCol.GetItem(tname)); ScrablerCore.AssemblyCol.Remove(ScrablerCore.AssemblyCol.GetItem(tname)); } } else if (Cmd.Contains(Core.code) == true) { Program.Console.CommandBox.Multiline = true; Program.Console.CommandBox.ScrollBars = ScrollBars.Both; string tcode; tcode = Cmd.Substring(Cmd.LastIndexOf(code) + code.Length); ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\Scrabler.dll"); ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath); scarabler.Eval(tcode); // } else if (Cmd.Contains(Core.exit) == true) { Application.Exit(); } else if (Cmd.Contains(Core.listscripts) == true) { this.ShowList(files); } else if (Cmd.Contains(Core.loadedscripts) == true) { int i = 0; Program.Console.WriteLine("Loaded Scripts: \n"); for (i = 0; i < ScrablerCore.AssemblyCol.Count; i++) { Type[] t = ScrablerCore.AssemblyCol.GetItem(i).GetTypes(); // foreach (Type d in t) { Program.Console.WriteLine("NameSapce: " + t[0].Namespace); } } } else if (Cmd.Contains(Core.addAllias) == true) { //string tmp = Cmd.Substring(Cmd.LastIndexOf(Core.addAllias) + addAllias.Length + 1); // string[] tmpar = tmp.Split(','); // MessageBox.Show(tmp); AddAllias adallias = new AddAllias(); adallias.Show(); //allias.LoadAlliaces(); } else if (Cmd.Contains(Core.showAllias) == true) { allias.ShowAllias(); } ///ScrablerCore.AssemblyCol } } catch (Exception ex) { Program.errorreporting(ex); } }