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; } }
/// <summary> /// this method will install the given script to the script folder /// and copy the dll neede by the sript to the needed folder /// </summary> /// <param name="script_Archfilename">the full path of the script </param> /// <param name="installfolder_scriptanddll">the path that /// script and dll wll be installed</param> public void Install(string script_Archfilename, string installfolder_scriptanddll) { try { ScriptInfo scrinf = null; ScrablerCore core = new ScrablerCore(); DataSet set = new DataSet(); hydrobaseADO ad = new hydrobaseADO(); string tscrfilename = null, str; string[] files; if ((script_Archfilename != null) && (installfolder_scriptanddll != null) && (File.Exists(script_Archfilename) == true) && (Directory.Exists(installfolder_scriptanddll) == true)) { if (Directory.Exists(installfolder_scriptanddll + "\\" + ScrablerCore.ScriptsFolderDLL) != true) { Directory.CreateDirectory(installfolder_scriptanddll + "\\" + ScrablerCore.ScriptsFolderDLL); } FastZip ziphandler = new FastZip(); FileInfo fileinf = new FileInfo(script_Archfilename); ziphandler.ExtractZip(script_Archfilename, SDKBase.UsersTempDirectory + "\\" + fileinf.Name, "scrf"); files = Directory.GetFiles(SDKBase.UsersTempDirectory + "\\" + fileinf.Name); ad.AttachDataBaseinDataSet(set, files[0]); // MessageBox.Show(files[0]); scrinf = core.GetScriptInfo(set); core.SetReferences(set, installfolder_scriptanddll + "\\" + ScrablerCore.ScriptsFolderDLL + "\\" + scrinf.Title, files[0]); File.Copy(files[0], installfolder_scriptanddll + "\\" + ScrablerCore.ScriptsFolder + "\\" + files[0].Substring(files[0].LastIndexOf("\\") + 1)); str = files[0]; tscrfilename = files[0]; File.Delete(files[0]); ziphandler.ExtractZip(script_Archfilename, SDKBase.UsersTempDirectory + "\\" + fileinf.Name, "dll"); files = null; files = Directory.GetFiles(SDKBase.UsersTempDirectory + "\\" + fileinf.Name); foreach (string file in files) { FileInfo dllinf = new FileInfo(file); this.CopyDll(file, installfolder_scriptanddll + "\\" + ScrablerCore.ScriptsFolderDLL + "\\" + scrinf.Title + "\\" + dllinf.Name); //MessageBox.Show("hi6"); } core.SetReferences(set, installfolder_scriptanddll + "\\" + ScrablerCore.ScriptsFolderDLL + "\\" + scrinf.Title, tscrfilename); } FileInfo fileinf2 = new FileInfo(script_Archfilename); string [] tfile = Directory.GetFiles(SDKBase.UsersTempDirectory + "\\" + fileinf2.Name); foreach (string file in tfile) { File.Delete(file); } Directory.Delete(SDKBase.UsersTempDirectory + "\\" + fileinf2.Name); } catch (Exception e) { Program.Bugtracking(e); } }