Esempio n. 1
0
        protected override void OnLinkClicked(LinkClickedEventArgs e)
        {
            base.OnLinkClicked(e);

            if (e.LinkText.StartsWith("\\\\arlnk://"))
            {
                DecryptedHashlink hashlink = Hashlink.DecodeHashlink(e.LinkText.Substring(10));

                if (hashlink != null)
                {
                    this.HashlinkClicked(hashlink, EventArgs.Empty);
                }
            }
            else if (e.LinkText.StartsWith("\\\\cb0t://script/?file="))
            {
                String str = e.LinkText.Substring(22);

                if (!String.IsNullOrEmpty(str))
                {
                    Scripting.ScriptManager.InstallScript(str);
                }
            }
            else if (e.LinkText.StartsWith("\\\\voice_clip_#"))
            {
                String vc_check  = e.LinkText.Substring(14);
                uint   vc_finder = 0;

                if (uint.TryParse(vc_check, out vc_finder))
                {
                    VoicePlayerItem vc = VoicePlayer.Records.Find(x => x.ShortCut == vc_finder);

                    if (vc != null)
                    {
                        vc.Auto = false;
                        VoicePlayer.QueueItem(vc);
                    }
                }
            }
            else
            {
                String check = e.LinkText.ToUpper();

                if (check.StartsWith("HTTP://") || check.StartsWith("HTTPS://") || check.StartsWith("WWW."))
                {
                    Scripting.JSOutboundTextItem cb = new Scripting.JSOutboundTextItem();
                    cb.Type     = Scripting.JSOutboundTextItemType.Link;
                    cb.Text     = e.LinkText;
                    cb.EndPoint = this.EndPoint;
                    Scripting.ScriptManager.PendingUIText.Enqueue(cb);
                }
            }
        }
Esempio n. 2
0
        private void toolStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem.Equals(this.toolStripButton2))
            {
                this.accuTextBox1.AppendText("\x00026");
                this.accuTextBox1.SelectionStart = this.accuTextBox1.Text.Length;
            }
            else if (e.ClickedItem.Equals(this.toolStripButton3))
            {
                this.accuTextBox1.AppendText("\x00029");
                this.accuTextBox1.SelectionStart = this.accuTextBox1.Text.Length;
            }
            else if (e.ClickedItem.Equals(this.toolStripButton4))
            {
                this.accuTextBox1.AppendText("\x00027");
                this.accuTextBox1.SelectionStart = this.accuTextBox1.Text.Length;
            }
            else if (e.ClickedItem.Equals(this.toolStripButton5))
            {
                SharedUI.CMenu.StartPosition = FormStartPosition.Manual;
                SharedUI.CMenu.Location      = new Point(MousePosition.X - 40, MousePosition.Y - 164);
                SharedUI.CMenu.SetCallback(this, false);
                SharedUI.CMenu.Show();
            }
            else if (e.ClickedItem.Equals(this.toolStripButton6))
            {
                SharedUI.CMenu.StartPosition = FormStartPosition.Manual;
                SharedUI.CMenu.Location      = new Point(MousePosition.X - 40, MousePosition.Y - 164);
                SharedUI.CMenu.SetCallback(this, true);
                SharedUI.CMenu.Show();
            }
            else if (e.ClickedItem.Equals(this.toolStripButton7))
            {
                SharedUI.EMenu.StartPosition = FormStartPosition.Manual;
                SharedUI.EMenu.Location      = new Point(MousePosition.X - 40, MousePosition.Y - 300);
                SharedUI.EMenu.SetCallback(this);
                SharedUI.EMenu.Show();
            }
            else if (e.ClickedItem.Equals(this.toolStripButton9))
            {
                this.WantScribble(null, EventArgs.Empty);
            }
            else if (e.ClickedItem.Equals(this.toolStripLabel1))
            {
                if (this.url_tag.StartsWith("\\\\arlnk://"))
                {
                    DecryptedHashlink hashlink = Hashlink.DecodeHashlink(this.url_tag.Substring(10));

                    if (hashlink != null)
                    {
                        this.HashlinkClicked(hashlink, EventArgs.Empty);
                    }
                }
                else if (this.url_tag.StartsWith("arlnk://"))
                {
                    DecryptedHashlink hashlink = Hashlink.DecodeHashlink(this.url_tag.Substring(8));

                    if (hashlink != null)
                    {
                        this.HashlinkClicked(hashlink, EventArgs.Empty);
                    }
                }
                else
                {
                    String check = this.url_tag.ToUpper();

                    if (check.StartsWith("HTTP://") || check.StartsWith("HTTPS://") || check.StartsWith("WWW."))
                    {
                        Scripting.JSOutboundTextItem cb = new Scripting.JSOutboundTextItem();
                        cb.Type     = Scripting.JSOutboundTextItemType.Link;
                        cb.Text     = this.url_tag;
                        cb.EndPoint = this.EndPoint;
                        Scripting.ScriptManager.PendingUIText.Enqueue(cb);
                    }
                }
            }
        }
Esempio n. 3
0
        public static void EventCycle(ulong time)
        {
            JSTimers.ServiceTimers(time);

            if (PendingTerminators.Pending)
            {
                IPEndPoint ep = null;

                while (PendingTerminators.TryDequeue(out ep))
                {
                    ClearUsers(ep);
                    ScriptEvents.OnRoomClosed(ep);

                    foreach (JSScript script in Scripts)
                    {
                        script.Rooms.RemoveAll(x => x.EndPoint.Equals(ep));
                    }
                }
            }

            if (PendingUIText.Pending)
            {
                JSOutboundTextItem item = null;

                while (PendingUIText.TryDequeue(out item))
                {
                    Room r = RoomPool.Rooms.Find(x => x.EndPoint.Equals(item.EndPoint));

                    if (r != null)
                    {
                        if (item.Type == JSOutboundTextItemType.Command)
                        {
                            String str = ScriptEvents.OnCommandSending(r, item.Text);

                            if (!String.IsNullOrEmpty(str))
                            {
                                r.SendCommand(str);
                            }
                        }
                        else if (item.Type == JSOutboundTextItemType.Public)
                        {
                            String str = ScriptEvents.OnTextSending(r, item.Text);

                            if (!String.IsNullOrEmpty(str))
                            {
                                r.SendText(str);
                            }
                        }
                        else if (item.Type == JSOutboundTextItemType.Emote)
                        {
                            String str = ScriptEvents.OnEmoteSending(r, item.Text);

                            if (!String.IsNullOrEmpty(str))
                            {
                                r.SendEmote(str);
                            }
                        }
                        else if (item.Type == JSOutboundTextItemType.Private)
                        {
                            String str = ScriptEvents.OnPmSending(r, item.Name, item.Text);

                            if (!String.IsNullOrEmpty(str))
                            {
                                r.SendPM(item.Name, str);
                            }
                        }
                        else if (item.Type == JSOutboundTextItemType.Link)
                        {
                            if (ScriptEvents.OnLinkClicked(r, item.Text))
                            {
                                try
                                {
                                    Process.Start(item.Text);
                                }
                                catch { }
                            }
                        }
                        else if (item.Type == JSOutboundTextItemType.ChatScreenCallback)
                        {
                            ScriptEvents.OnScreenCallback(r, item.Name, item.Text);
                        }
                    }
                }
            }

            if (PendingUIEvents.Pending)
            {
                JSUIEventItem item = null;

                while (PendingUIEvents.TryDequeue(out item))
                {
                    if (item.EventType == JSUIEventType.KeyPressed)
                    {
                        item.Element.KeyPressCallback((int)item.Arg);
                    }
                    else if (item.EventType == JSUIEventType.ValueChanged)
                    {
                        item.Element.ValueChangedCallback();
                    }
                    else if (item.EventType == JSUIEventType.Click)
                    {
                        item.Element.ClickCallback();
                    }
                    else if (item.EventType == JSUIEventType.Select)
                    {
                        item.Element.SelectCallback();
                    }
                    else if (item.EventType == JSUIEventType.ItemDoubleClick)
                    {
                        item.Element.ItemDoubleClickCallback();
                    }
                    else if (item.EventType == JSUIEventType.SelectedItemChanged)
                    {
                        item.Element.SelectedItemChangedCallback();
                    }
                    else if (item.EventType == JSUIEventType.UISelected)
                    {
                        ScriptEvents.OnUISelected((String)item.Arg);
                    }
                    else if (item.EventType == JSUIEventType.RoomOpened)
                    {
                        ScriptEvents.OnRoomOpened((IPEndPoint)item.Arg);
                    }
                    else if (item.EventType == JSUIEventType.RoomClosed)
                    {
                        ScriptEvents.OnRoomClosed((IPEndPoint)item.Arg);
                    }
                }
            }

            if (PendingPopupCallbacks.Pending)
            {
                JSUIPopupCallback item = null;

                while (PendingPopupCallbacks.TryDequeue(out item))
                {
                    JSScript script = Scripts.Find(x => x.ScriptName == item.Callback.Engine.ScriptName);

                    if (script != null)
                    {
                        Objects.JSRoom room = script.Rooms.Find(x => x.EndPoint.Equals(item.Room));

                        if (room != null)
                        {
                            try { item.Callback.Call(script.JS.Global, room); }
                            catch (Jurassic.JavaScriptException je)
                            {
                                ScriptManager.ErrorHandler(script.ScriptName, je.LineNumber, je.Message);
                            }
                        }