public JSUILabel(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UILabel"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.UILabel = new Label(); this.UILabel.BackColor = Color.Transparent; this.UILabel.Font = new Font("Tahoma", (float)9, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); this.UILabel.AutoSize = true; this.UILabel.Location = new Point(32, 32); this._x = 0; this._y = 0; this.UILabel.Text = String.Empty; this._value = String.Empty; this.ID = String.Empty; this._visible = true; this._enabled = true; this._link = false; this._size = 9; this.UILabel.ForeColor = Color.Black; this.UILabel.MouseClick += this.UILabelMouseClick; parent.UIPanel.Controls.Add(this.UILabel); }
public bool Save(object a) { if (this.Data == null) { return(false); } JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { String path = a.ToString(); path = new String(path.Where(x => !Path.GetInvalidFileNameChars().Contains(x)).ToArray()); path = Path.Combine(script.DataPath, path); if (new FileInfo(path).Directory.FullName != new DirectoryInfo(script.DataPath).FullName) { return(false); } try { File.WriteAllBytes(path, Zip.Decompress(this.Data)); return(true); } catch { } } return(false); }
public JSUIListBox(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UIListBox"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.Shadow = new List <String>(); this.UIListBox = new ListBox(); this.UIListBox.FormattingEnabled = true; this.UIListBox.Width = 100; this.UIListBox.Height = 100; this.UIListBox.ScrollAlwaysVisible = true; this.UIListBox.HorizontalScrollbar = false; this.UIListBox.Location = new Point(32, 32); this._x = 0; this._y = 0; this.ID = String.Empty; this._visible = true; this._enabled = true; this._width = 100; this._height = 100; this.UIListBox.SelectedIndexChanged += this.UIListBoxSelectedIndexChanged; this.UIListBox.MouseDoubleClick += this.UIListBoxMouseDoubleClick; parent.UIPanel.Controls.Add(this.UIListBox); }
public JSUICheckBox(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UICheckBox"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.UICheckBox = new CheckBox(); this.UICheckBox.BackColor = Color.Transparent; this.UICheckBox.Location = new Point(32, 32); this.UICheckBox.AutoSize = true; this.UICheckBox.UseVisualStyleBackColor = true; this._x = 0; this._y = 0; this.UICheckBox.Text = String.Empty; this._value = String.Empty; this.ID = String.Empty; this._visible = true; this._enabled = true; this._checked = false; this.UICheckBox.CheckedChanged += this.UICheckBoxCheckedChanged; parent.UIPanel.Controls.Add(this.UICheckBox); }
public JSUITextArea(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UITextArea"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.UITextBox = new TextBox(); this.UITextBox.Font = new Font("Tahoma", (float)9, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); this.UITextBox.Multiline = true; this.UITextBox.ScrollBars = ScrollBars.Vertical; this.UITextBox.Text = String.Empty; this._value = String.Empty; this.UITextBox.Location = new Point(32, 32); this._x = 0; this._y = 0; this.UITextBox.Width = 100; this._width = 100; this.UITextBox.Height = 100; this._height = 100; this.ID = String.Empty; this._visible = true; this._enabled = true; this._readonly = false; this.UITextBox.KeyPress += this.UITextBoxKeyPress; this.UITextBox.TextChanged += this.UITextBoxTextChanged; this.UITextBox.MouseClick += this.UITextBoxMouseClick; parent.UIPanel.Controls.Add(this.UITextBox); }
public static bool JS_Delete(ScriptEngine eng, object a) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { String path = a.ToString(); path = new String(path.Where(x => !Path.GetInvalidFileNameChars().Contains(x)).ToArray()); path = Path.Combine(script.DataPath, path); if (new FileInfo(path).Directory.FullName != new DirectoryInfo(script.DataPath).FullName) { return(false); } try { if (File.Exists(path)) { File.Delete(path); return(true); } } catch { } } return(false); }
public JSUIComboBox(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UIComboBox"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.Shadow = new List <String>(); this.UIComboBox = new ComboBox(); this.UIComboBox.DropDownStyle = ComboBoxStyle.DropDownList; this.UIComboBox.Width = 120; this.UIComboBox.Location = new Point(32, 32); this.ID = String.Empty; this._x = 0; this._y = 0; this._visible = true; this._enabled = true; this._width = 100; this.UIComboBox.SelectedIndexChanged += this.UIComboBoxSelectedIndexChanged; parent.UIPanel.Controls.Add(this.UIComboBox); }
public JSUIGroupBox(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UIGroupBox"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.UIGroupBox = new GroupBox(); this.UIGroupBox.Text = String.Empty; this._value = String.Empty; this.UIGroupBox.Location = new Point(32, 32); this._x = 0; this._y = 0; this.UIGroupBox.Width = 100; this._width = 100; this.UIGroupBox.Height = 100; this._height = 100; this.ID = String.Empty; parent.UIPanel.Controls.Add(this.UIGroupBox); }
public static bool JS_Append(ScriptEngine eng, object a, object b) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { if (!(a is Undefined) && !(b is Undefined)) { String path = a.ToString(); path = new String(path.Where(x => !Path.GetInvalidFileNameChars().Contains(x)).ToArray()); path = Path.Combine(script.DataPath, path); if (new FileInfo(path).Directory.FullName != new DirectoryInfo(script.DataPath).FullName) { return(false); } try { using (StreamWriter writer = File.Exists(path) ? File.AppendText(path) : File.CreateText(path)) writer.Write(b.ToString()); return(true); } catch { } } } return(false); }
public JSUITextBox(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UITextBox"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.UITextBox = new TextBox(); this.UITextBox.Text = String.Empty; this._value = String.Empty; this.UITextBox.Location = new Point(32, 32); this._x = 0; this._y = 0; this.UITextBox.Width = 100; this._width = 100; this.ID = String.Empty; this._visible = true; this._enabled = true; this._readonly = false; this.UITextBox.KeyPress += this.UITextBoxKeyPress; this.UITextBox.TextChanged += this.UITextBoxTextChanged; this.UITextBox.MouseClick += this.UITextBoxMouseClick; parent.UIPanel.Controls.Add(this.UITextBox); }
public JSUIButton(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UIButton"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.UIButton = new Button(); this.UIButton.UseVisualStyleBackColor = true; this.UIButton.Width = 75; this.UIButton.Height = 25; this.UIButton.Text = String.Empty; this.UIButton.Location = new Point(32, 32); this._x = 0; this._y = 0; this._value = String.Empty; this._visible = true; this._enabled = true; this._width = 75; this._height = 25; this.ID = String.Empty; this.UIButton.MouseClick += this.UIButtonMouseClick; parent.UIPanel.Controls.Add(this.UIButton); }
public JSUIImage(ObjectInstance prototype, JSUI parent) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UIImage"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); this.DataPath = script.DataPath; } this.UIImage = new PictureBox(); this.UIImage.BackColor = Color.Transparent; this.UIImage.Width = 200; this.UIImage.Height = 200; this.UIImage.Location = new Point(32, 32); this.UIImage.SizeMode = PictureBoxSizeMode.Normal; this.ID = String.Empty; this._x = 0; this._y = 0; this._visible = true; this._width = 200; this._height = 200; this._resize = false; this._hand = false; this.UIImage.MouseClick += this.UIImageMouseClick; parent.UIPanel.Controls.Add(this.UIImage); }
public override void OnPluginLoaded() { Server.SendAnnounce("Jurassic plugin has been loaded!!"); if (JSScript.Load("autoload")) { JSScript.Kill("autoload"); } }
public void reloadRightData() { cboBindData.Clear(); foreach (var item in JSScript.getFileItems()) { cboBindData.Add(item); } }
public static String JS_DataPath(ScriptEngine eng) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { return(script.DataPath); } return(String.Empty); }
public void editScript(JSScriptItem dragItem) { var script = new JSScript(dragItem.Params[0]); leftBindData.Clear(); foreach (var item in script.Items) { leftBindData.Add(item); } txtName.Text = script.Name; txtRemarks.Text = script.Remarks; }
public static void C_Reset(ScriptEngine eng) { String name = eng.ScriptName; name = Path.GetFileNameWithoutExtension(name); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == name); if (script != null) { script.ResetScript(); } }
public static void JS_Browse(ScriptEngine eng) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { if (Directory.Exists(script.DataPath)) { try { Process.Start("explorer.exe", script.DataPath); } catch { } } } }
public JSTimerInstance(ObjectInstance prototype) : base(prototype) { this.PopulateFunctions(); this.ScriptName = this.Engine.ScriptName; this.StartTime = 0; JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.ScriptName); if (script != null) { this.IDENT = TimerList.NextIdent++; script.timer_idents.Add(this.IDENT); } }
private void BtnRun_Click(object sender, EventArgs e) { runTime = new JSRunTime(SetInfo); List <FileInfo> files = new List <FileInfo>(); files.Add(new FileInfo(JSONConfig.GetPath("base.js"))); files.AddRange(JSScript.getFiles()); runTime.injectJS(files); runTime.RegisterJsObject("runtime", jsi); if (cboListScript.SelectedItem is JSScriptItem item) { jsi.stop = false; runTime.CallFunction(item.Params[0]); } }
public static bool EventOnVoiceClipReceiving(ScriptEngine eng, object a) { if (a is UserDefinedFunction) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { script.EVENT_ONVOICECLIPRECEIVING = (UserDefinedFunction)a; return(true); } } return(false); }
public static bool EventOnUserListReceived(ScriptEngine eng, object a) { if (a is UserDefinedFunction) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { script.EVENT_ONUSERLISTRECEIVED = (UserDefinedFunction)a; return(true); } } return(false); }
public static bool EventOnConnecting(ScriptEngine eng, object a) { if (a is UserDefinedFunction) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { script.EVENT_ONCONNECTING = (UserDefinedFunction)a; return(true); } } return(false); }
public static bool EventOnLinkedClick(ScriptEngine eng, object a) { if (a is UserDefinedFunction) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { script.EVENT_ONLINKCLICKED = (UserDefinedFunction)a; return(true); } } return(false); }
public static bool EventOnUISelected(ScriptEngine eng, object a) { if (a is UserDefinedFunction) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { script.EVENT_ONUISELECTED = (UserDefinedFunction)a; return(true); } } return(false); }
public static bool EventOnScreenCallback(ScriptEngine eng, object a) { if (a is UserDefinedFunction) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { script.EVENT_ONSCREENCALLBACK = (UserDefinedFunction)a; return(true); } } return(false); }
public static bool EventOnUserWritingStatusChanged(ScriptEngine eng, object a) { if (a is UserDefinedFunction) { JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == eng.ScriptName); if (script != null) { script.EVENT_ONUSERWRITINGSTATUSCHANGED = (UserDefinedFunction)a; return(true); } } return(false); }
public JSUIRadioButton(ObjectInstance prototype, JSUI parent, String group) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["UIRadioButton"]).InstancePrototype) { this.PopulateFunctions(); JSScript script = ScriptManager.Scripts.Find(x => x.ScriptName == this.Engine.ScriptName); if (script != null) { script.Elements.Add(this); } this.UIRadioButton = new RadioButton(); this.UIRadioButton.BackColor = Color.Transparent; this.UIRadioButton.UseVisualStyleBackColor = true; this.UIRadioButton.AutoSize = true; this.UIRadioButton.Location = new Point(32, 32); this.ID = String.Empty; this._group = group; this._x = 0; this._y = 0; this.UIRadioButton.Text = String.Empty; this._value = String.Empty; this._visible = true; this._enabled = true; int count = 0; if (script != null) { foreach (ICustomUI ctrl in script.Elements) { if (!string.IsNullOrEmpty(ctrl.Group)) { if (ctrl.Group == group) { count++; } } } } this._checked = count == 1; this.UIRadioButton.Checked = count == 1; this.UIRadioButton.CheckedChanged += this.UIRadioButtonCheckedChanged; parent.UIPanel.Controls.Add(this.UIRadioButton); }
private void LabDelete_DragDrop(object sender, DragEventArgs e) { Label lab = sender as Label; int tag = Convert.ToInt32(lab?.Tag ?? "0"); BindingList <object> binding = listSource?.DataSource as BindingList <object>; JSScriptItem dragItem = (JSScriptItem)e.Data.GetData(typeof(JSScriptItem)); if (binding == null) { return; } switch (tag) { case 0: { if (listSource == listRight) { if (MessageBox.Show("确定要删除吗?", "删除脚本", MessageBoxButtons.OKCancel) == DialogResult.OK) { JSScript.deleteFile(dragItem.Params[0]); reloadRightData(); } } else { binding.RemoveAt(listSource.SelectedIndex); } } break; case 1: { if (dragItem.FunName == JSScriptItem.Script) { editScript(dragItem); return; } FrmEvent frmEvent = new FrmEvent(dragItem); if (frmEvent.ShowDialog() == DialogResult.OK) { binding[listSource.SelectedIndex] = frmEvent.getItem(); } } break; } }
public override bool OnTextCommand(IClient client, string cmd, string args) { if (client.Admin >= AdminLevel.Admin) { switch (cmd) { case "loadscript": JSScript.Load(args); break; case "killscript": JSScript.Kill(args); break; } } return(true); }