void LOadScript(string file)
        {
            try
            {
                if (file != null)
                {
                    info = new ScriptInfo();
                    lstRefs.Items.Clear();
                    core.ReadScript(file, true);
                    info = core.GetScriptInfo(ScrablerCore.ScriptsSet);
                    txtScriptName.Text           = info.Title;
                    txtAuthor.Text               = info.Author;
                    txtClass.Text                = core.GetClass(ScrablerCore.ScriptsSet);
                    txtCopyright.Text            = info.Copyright;
                    txtDescription.Text          = info.Description;
                    txtLanguage.Text             = core.GetLanguage(ScrablerCore.ScriptsSet);
                    txtLowerappVer.Text          = info.LowerApplicationVersion;
                    txtMaxAppver.Text            = info.MaxApplicationVersion;
                    txtScrablerVersion.Text      = info.ScrablerVersion;
                    txtNamespace.Text            = core.GetNameSace(ScrablerCore.ScriptsSet);
                    txtFunction.Text             = core.GetFunction(ScrablerCore.ScriptsSet);
                    this.textEditorControl1.Text = core.GetCode(ScrablerCore.ScriptsSet);
                    txtVersion.Text              = info.Version;

                    // MessageBox.Show(core.GetCode(ScrablerCore.ScriptsSet));
                    string[] refs = core.GetReferences(ScrablerCore.ScriptsSet);
                    lstRefs.Items.AddRange(refs);
                    if (txtLanguage.Text != null)
                    {
                        textEditorControl1.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter(txtLanguage.Text);
                    }
                    else
                    {
                        textEditorControl1.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("C#");
                    }
                }
            }
            catch (Exception e)
            {
                Program.Bugtracking(e);
                //return null;
            }
        }
Beispiel #2
0
        //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);
            }
        }