//public void Autoexecutescripts() //{ // try // { // string[] filelist = Directory.GetFiles(Program.ScriptsFolder); // scarabler.GetExeCutingApplicationVersion(Assembly.LoadFile(Application.ExecutablePath)); // if (filelist != null) // { // // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\AxInterop.MOZILLACONTROLLib.dll"); // // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\Interop.MOZILLACONTROLLib.dll"); // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath); // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\Scrabler.dll"); // //ScrablerCore.definedConstants = definedConstants; // // ScrablerCore.definedValues = definedValues; // //Interop.MOZILLACONTROLLib.dll // foreach (string file in filelist) // { // if ((file != null) &&(file.EndsWith("scrf")==true )) // {int i; // scarabler.ReadScript(file); // // if (Program.hidden == false) // { // for (i = 0; i < ScrablerCore.AssemblyCol.Count; i++) // { // Type[] t = ScrablerCore.AssemblyCol.GetItem(i).GetTypes(); // // foreach (Type d in t) // { // System.Console.WriteLine("NameSapce: " + t[0].Namespace); // } // } // } // } // } // //autoastart.scrf // if (File.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\autoastart.scrf") == true) // { // this.Executescript(Path.GetDirectoryName(Application.ExecutablePath) + "\\autoastart.scrf"); // } // } // } // catch (Exception ex) // { // Program.errorreporting(ex); // } //} public void Autoexecutescripts(string username, int version) { try { if (username != null) { if (version == 1) { scarabler.GetExeCutingApplicationVersion(Assembly.LoadFile(Application.ExecutablePath)); string[] filelist = Directory.GetFiles(Program.ScriptsFolder); if (filelist != null) { // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\AxInterop.MOZILLACONTROLLib.dll"); // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\Interop.MOZILLACONTROLLib.dll"); // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath); ScrablerCore.cp.ReferencedAssemblies.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace(@"file:\", "") + "\\Scrabler.dll"); //ScrablerCore.definedConstants = definedConstants; // ScrablerCore.definedValues = definedValues; //Interop.MOZILLACONTROLLib.dll foreach (string file in filelist) { if ((file != null) && (file.EndsWith(ScrablerCore.scriptextenstion) == true)) { int i; // ProcessHost prohost = new ProcessHost(); scarabler.ReadScript(file); } if ((file != null) && (file.EndsWith("cs") == true)) { int i; scarabler.ReadScriptInLightMode(file); } } //autoastart.scrf } } else { scrablerV2.GetExeCutingApplicationVersion(Assembly.LoadFile(Application.ExecutablePath)); string[] filelist = Directory.GetDirectories(Program.ScriptsFolder); //MessageBox.Show("hhh 2" + Program.ScriptsFolder); // if (filelist != null) { // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\AxInterop.MOZILLACONTROLLib.dll"); // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\Interop.MOZILLACONTROLLib.dll"); // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath); ScrablerV2.cp.ReferencedAssemblies.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace(@"file:\", "") + "\\Scrabler.dll"); foreach (string file in filelist) { if (file != null) { int i; // ProcessHost prohost = new ProcessHost(); scrablerV2.ReadScript2(file); } } //autoastart.scrf } } } } catch (Exception ex) { Program.errorreporting(ex); } }
public void Autoexecutescripts() { try { //if (username != null) //{ string[] filelist = Directory.GetFiles(Program.ScriptsFolder); scarabler.GetExeCutingApplicationVersion(Assembly.LoadFile(Application.ExecutablePath)); if (filelist != null) { // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\AxInterop.MOZILLACONTROLLib.dll"); // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\")) + "\\Interop.MOZILLACONTROLLib.dll"); // ScrablerCore.cp.ReferencedAssemblies.Add(Application.ExecutablePath); ScrablerCore.cp.ReferencedAssemblies.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace(@"file:\", "") + "\\Scrabler.dll"); //ScrablerCore.definedConstants = definedConstants; // ScrablerCore.definedValues = definedValues; //Interop.MOZILLACONTROLLib.dll foreach (string file in filelist) { //if ((file != null) && (file.EndsWith("scrf") == true)) //{ // int i; // // ProcessHost prohost = new ProcessHost(); // scarabler.ReadScript(file); //} //if ((file != null) && (file.EndsWith("cs") == true)) //{ // int i; // scarabler.ReadScriptInLightMode(file); //} //if ((file != null) && (file.EndsWith(Scrabler.ScrablerV2.scriptext) == true)) //{ // scr2.ReadScript2(file); //} // MessageBox.Show(file); //char[] pass = password.ToCharArray(); //fixed (char* pchar= pass) //{ //Core core = new Core(); //core.Executescript(file); ProcessStartInfo inf = new ProcessStartInfo(); inf.CreateNoWindow = true; inf.Arguments = "-af" + " \"" + file + "\""; inf.FileName = Path.Combine(Application.StartupPath, "ScriptRunner.exe"); Process pr = new Process(); pr.StartInfo = inf; // pr.Start(); this.aproc.Add(pr); ProcessWatcher prwtch = new ProcessWatcher(pr); prwtch.MaxAllowedBytes = maxmemoryperapp; prwtch.Start(); this.procwatcher.Add(prwtch); // } } //autoastart.scrf } //} } catch (Exception ex) { Program.errorreporting(ex); } }