Exemplo n.º 1
0
        public static void ProcessFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            XElement   xelement   = XElement.Parse(e.request);
            XAttribute xattribute = xelement.Attribute("name");
            string     a          = (xattribute != null) ? xattribute.Value : null;
            XElement   xelement2  = xelement.Element("arguments");
            string     text       = (xelement2 != null) ? xelement2.Value : null;

            if (!(a == "progress"))
            {
                if (!(a == "modifyServers"))
                {
                    return;
                }
                Root.Instance.Client.SetReturnValue("<string>" + Flash.ModifyServerList(text.Trim()) + "</string>");
                return;
            }
            else
            {
                Action <int> swfLoadProgress = Flash.SwfLoadProgress;
                if (swfLoadProgress == null)
                {
                    return;
                }
                swfLoadProgress(int.Parse(text));
                return;
            }
        }
 internal void RaiseOnFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
 {
     if ((this.FlashCall != null))
     {
         this.FlashCall(sender, e);
     }
 }
        /// <summary>
        /// Flashから呼び出し
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ExternalCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            var doc = new XmlDocument();

            doc.Load(new StringReader(e.request));
            var methodName = doc.SelectSingleNode("invoke").Attributes["name"].Value;
            var nodes      = doc.SelectSingleNode("invoke/arguments").ChildNodes;
            var args       = new List <string>();

            foreach (XmlElement arg in nodes)
            {
                args.Add(arg.InnerText);
            }

            switch (methodName)
            {
            case "OpenStateChange":
                openStateChange(flash, new EventArgs());
                break;

            case "Initialized":
                initialized(flash, new EventArgs());
                break;

            case "RequestBump":
                requestBump(flash, new EventArgs());
                break;

            case "OutputLog":
                outputLog(flash, args.FirstOrDefault());
                break;
            }
        }
Exemplo n.º 4
0
        private void FlashMovieFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            try
            {
                XmlTextReader reader = new XmlTextReader(new StringReader(e.request));
                reader.WhitespaceHandling = WhitespaceHandling.Significant;
                reader.MoveToContent();

                if (reader.Name == "invoke" && reader.GetAttribute("name") == "trace")
                {
                    reader.Read();
                    if (reader.Name == "arguments")
                    {
                        reader.Read();
                        if (reader.Name == "string")
                        {
                            reader.Read();
                            TraceManager.Add(reader.Value, 1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ShowError(ex);
            }
        }
Exemplo n.º 5
0
        private void player_Call(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(e.request);
            XmlAttributeCollection attributes = xmlDocument.FirstChild.Attributes;
            string      innerText             = attributes.Item(0).InnerText;
            XmlNodeList elementsByTagName     = xmlDocument.GetElementsByTagName("arguments");
            string      a;

            if ((a = innerText) != null)
            {
                if (!(a == "sendText"))
                {
                    if (!(a == "Some_Other_Command"))
                    {
                        return;
                    }
                }
                else if (elementsByTagName[0].InnerText == "ChangeText" && this.isGenerate)
                {
                    this.StopCount++;
                    if (this.StopCount == this.PageCount)
                    {
                        this.Event(AnimationEventType.Stop);
                    }
                }
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Handles the FlashCall event
 /// </summary>
 private void FlashMovieFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
 {
     try
     {
         XmlTextReader reader = new XmlTextReader(new StringReader(e.request));
         reader.WhitespaceHandling = WhitespaceHandling.Significant;
         reader.MoveToContent();
         if (reader.Name == "invoke" && reader.GetAttribute("name") == "trace")
         {
             reader.Read();
             if (reader.Name == "arguments")
             {
                 reader.Read();
                 if (reader.Name == "string")
                 {
                     reader.Read();
                     Int32  state   = 1;
                     String message = reader.Value;
                     if (message.Length > 2 && message[1] == ':' && Char.IsDigit(message[0]))
                     {
                         if (int.TryParse(message[0].ToString(), out state))
                         {
                             message = message.Substring(2);
                         }
                     }
                     TraceManager.Add(message, state);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
        /// <summary>
        /// Called when Flash Player raises the FlashCallEvent (when an External Interface call
        /// is made by ActionScript)
        /// </summary>
        /// <param name="sender">The object raising the event</param>
        /// <param name="e">The arguments for the event</param>
        private void _flashControl_FlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            ExternalInterfaceCall          functionCall = ExternalInterfaceSerializer.DecodeInvoke(e.request);
            ExternalInterfaceCallEventArgs eventArgs    = new ExternalInterfaceCallEventArgs(functionCall);
            object response = OnExternalInterfaceCall(eventArgs);

            _flashControl.SetReturnValue(ExternalInterfaceSerializer.EncodeResult(response));
        }
 /// <summary>
 /// Called when Flash Player raises the FlashCallEvent (when an External Interface call
 /// is made by ActionScript)
 /// </summary>
 /// <param name="sender">The object raising the event</param>
 /// <param name="e">The arguments for the event</param>
 private void _flashControl_FlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
 {
     try
     {
         ExternalInterfaceCall          functionCall = ExternalInterfaceSerializer.DecodeInvoke(e.request);
         ExternalInterfaceCallEventArgs eventArgs    = new ExternalInterfaceCallEventArgs(functionCall);
         object response = OnExternalInterfaceCall(eventArgs);
         _flashControl.SetReturnValue(ExternalInterfaceSerializer.EncodeResult(response));
     }
     catch (Exception ex)
     {
         Logger.DEBUG_TRACE("_flashControl_FlashCall Exception:" + ex.Message + "\n");
     }
 }
Exemplo n.º 9
0
        private void FlashEvent(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            XmlDocument document = new XmlDocument();

            document.LoadXml(e.request);
            XmlAttributeCollection attributes = document.FirstChild.Attributes;
            String      command = attributes.Item(0).InnerText;
            XmlNodeList list    = document.GetElementsByTagName("arguments");

            switch (command)
            {
            case "ConnectionSuccess":
                bool isMuted = (list[0].InnerText == "true");
                AvPlayer.ChatInitialized(isMuted);
                break;

            case "ConnectionFailed":
                //ChatClient.Write(ClientWindow, ChatMessageTypeE.Error, ClientWindow, Msg.GetMsg(MsgE.InfoNoAvService),0);
                AvPlayer.StopChat(true);
                break;

            case "PlayStreamFailed":
                AvPlayer.StopChat(true);
                break;

            case "OnUnmuted":
                this.Hide();
                break;

            case "OnError":
                switch (list[0].InnerText)
                {
                case "2126":
                    //MessageBox.Show("Could not connect to server.");
                    break;

                default:
                    //MessageBox.Show("Error:" + list[0].InnerText);
                    break;
                }
                break;

            default:
                //MessageBox.Show("Event" + command);
                break;
            }
        }
Exemplo n.º 10
0
        public static void ProcessFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            XElement req      = XElement.Parse(e.request);
            string   function = req.Attribute("name")?.Value;
            string   arg      = req.Element("arguments")?.Value;

            switch (function)
            {
            case "progress":
                SwfLoadProgress?.Invoke(int.Parse(arg));
                break;

            case "modifyServers":
                MainForm.Instance.Client.SetReturnValue("<string>" + ModifyServerList(arg.Trim()) + "</string>");
                break;
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Handles the recieving of method calls from the .swf object.
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event Arguments</param>
        private void EngineView_FlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            Console.WriteLine(e.request);

            //Get the request
            XmlDocument xmlRequest = new XmlDocument();

            xmlRequest.LoadXml(e.request);

            //Get the name of the message
            string messageName = xmlRequest.FirstChild.Attributes[0].InnerText;

            switch (messageName)
            {
            case "Done Loading": OnVideoLoaded(EventArgs.Empty); break;

            default: Console.WriteLine("Unrecognized message: {0}", messageName); break;
            }
        }
Exemplo n.º 12
0
        /**
         * Reciving message from flash
         * */
        private void player_FlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            // message is in xml format so we need to parse it
            XmlDocument document = new XmlDocument();

            document.LoadXml(e.request);
            // get attributes to see which command flash is trying to call
            XmlAttributeCollection attributes = document.FirstChild.Attributes;
            String command = attributes.Item(0).InnerText;
            // get parameters
            XmlNodeList list = document.GetElementsByTagName("arguments");

            // Interpret command
            switch (command)
            {
            case "sendText": resultTxt.Text = list[0].InnerText; break;

            case "Some_Other_Command": break;
            }
        }
Exemplo n.º 13
0
        public void OnFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent foEvent)
        {
            //Log.Info("OnFlashCall reached with value request:{0},Object:{1}", foEvent.request, sender);
            XmlDocument document = new XmlDocument();

            document.LoadXml(foEvent.request);
            Log.Debug("FLV event {0}", foEvent.request);
            // Get all the arguments
            XmlNodeList list   = document.GetElementsByTagName("invoke");
            String      lsName = list[0].Attributes["name"].Value;

            list = document.GetElementsByTagName("arguments");
            String     lsState = list[0].FirstChild.InnerText;
            GUIMessage msg     = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAY_ITEM, 0, 0, 0, 0, 0, null);

            if (lsName.Equals("onYouTubePlayerReady"))
            {
                FlvControl.Visible = true;
                Log.Debug("Player is loaded playing id:{0}", VideoId);
                FlvControl.Player.CallFunction("<invoke name=\"loadVideoById\"><arguments><string>" + VideoId + "</string></arguments></invoke>");
            }
        }
        public virtual void FlashCall(string request)
        {
            _IShockwaveFlashEvents_FlashCallEvent flashcallEvent = new _IShockwaveFlashEvents_FlashCallEvent(request);

            this.parent.RaiseOnFlashCall(this.parent, flashcallEvent);
        }
 public virtual void FlashCall(string request) {
     _IShockwaveFlashEvents_FlashCallEvent flashcallEvent = new _IShockwaveFlashEvents_FlashCallEvent(request);
     this.parent.RaiseOnFlashCall(this.parent, flashcallEvent);
 }
 internal void RaiseOnFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e) {
     if ((this.FlashCall != null)) {
         this.FlashCall(sender, e);
     }
 }