public PreviewContainer(AxShockwaveFlashObjects.AxShockwaveFlash player)
 {
     this.player = player;
     InitializeComponent();
     previewOptions.Player = player;
     this.panel.Controls.Add(player);
 }
Ejemplo n.º 2
0
		void axFlash_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
		{
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.LoadXml(e.request);

			string commandName = xmlDocument.FirstChild.Attributes[0].Value;

			List<string> args = new List<string>();
			XmlNodeList nodes = xmlDocument.GetElementsByTagName("arguments");
			if (nodes.Count > 0)
			{
				XmlNodeList parameterNodes = nodes[0].ChildNodes;
				if (parameterNodes.Count > 0)
				{
					foreach (XmlNode node in parameterNodes)
					{
						args.Add(node.InnerText);
					}
				}
			}
			FlexCallbackCommand cmd = FlexCallbackCommandNames.GetCommand(commandName);
			if (cmd == FlexCallbackCommand.LoadComplete)
			{
				CallFlash(FlexCommand.Resize, new string[] { Width.ToString(), Height.ToString() });
				Resize += FlexControl_Resize;
			}
			if (FlashCallback != null)
			{
				FlashCallback(cmd, args);
			}
		}
Ejemplo n.º 3
0
 private void FlashMain_OnReadyStateChange(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_OnReadyStateChangeEvent e)
 {
     if (e.newState == 4 && ++FlashState4Count == 10) {
         LabelLoading.Visible = false;
         FlashState4Count = 0;
     }
 }
Ejemplo n.º 4
0
        private void FlashPlayer_OnReadyStateChange(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_OnReadyStateChangeEvent e)
        {
            // Loading=0, Uninitialized=1, Loaded=2, Interactive=3, Complete=4.
            if (this.FlashPlayer.Visible != false || e.newState != 4) return;

            this.FlashPlayer.Visible = true;
            this.LoadingFinished();
        }
Ejemplo n.º 5
0
 void axShockwaveFlash2_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
 {
     string text = e.request;
     if (text.Contains("FINISHEDMULTIBALL") ||
         text.Contains("FINISHEDBALLLOCK") ||
         text.Contains("FINISHEDJACKPOT"))
     {
         axShockwaveFlash2.Visible = false;
     }
     Console.WriteLine(text);
 }
Ejemplo n.º 6
0
        public ProcessInfo(AxShockwaveFlashObjects.AxShockwaveFlash Movie)
        {
            Sensors = new DigitalSensor[16];
            Actuators = new DigitalActuator[16];
            ProcessDescription = "SET DESCRIPTION";
            AutoMode = false;

            this.Movie = Movie;

            PopulateMovieDescription();
            PopulateDigitalSensors();
            PopulateDigitalActuators();
        }
Ejemplo n.º 7
0
        private void ViewPort_FlashCall(object sender, AxShockwaveFlashObjects._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;
                case "E_RightMouse":
                    contextMenuStrip1.Show(MousePosition);
                    break;
                case "sendLayer":
                    string path = appPath + @"assets\Levels\" + list[0].FirstChild.InnerText + @".csv";
                    if (File.Exists(path))
                    {
                        string v = list[0].LastChild.InnerText;
                        //using (StreamReader s = new StreamReader(path))
                        //{
                        //    var f = s.ReadToEnd();
                        //    if (v == f)
                        //    {

                        //    }
                        //}
                        using (StreamWriter s = new StreamWriter(path))
                        {
                            s.Write(v);
                        }
                    }
                    break;
            }
        }
Ejemplo n.º 8
0
        internal void Handle(object sender, AxShockwaveFlashObjects._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;
                case "Initialize":
                    string response;

                    container.Character = FileHandler.GetCharacterFromPath("SaveData/TestData2.txt");
                    break;
            }
        }
Ejemplo n.º 9
0
 private int FindIndexFromPlayer(AxShockwaveFlashObjects.AxShockwaveFlash player)
 {
     TabArtifacts t = null;
     foreach (TabArtifacts test in this.artifacts) {
         if (test.player == player) {
             t = test;
             break;
         }
     }
     return this.artifacts.IndexOf(t);
 }
Ejemplo n.º 10
0
 private void axFlash_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
 {
 }
Ejemplo n.º 11
0
        private void axShockwaveFlash2_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)
        {
            switch(e.command)
            {
                case "BtnOk":
                {
            //					ShareMyCamera(Info.getInstance().ServerIP,Info.getInstance().ConferenceID,nUniqueID.ToString());
                    NetworkManager.getInstance().profile.videoID = nUniqueID;
                    ClientUI.getInstance().sendProfileMessage();

                    break;
                }
            }
        }
Ejemplo n.º 12
0
 private void flashBackground_FlashCallBack(object sender,
     AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
 {
     string text = e.request;
     if (text.Contains("ANIMATIONCOMPLETED"))
     {
         if (OnAnimationCompleted != null)
             OnAnimationCompleted(new DisplayEventArgs(flashBackground.Tag, "ANIMATIONCOMPLETED"));
     }
     if (text.StartsWith("<invoke name=\"API"))
         _log.Warn("Background API Definition: " + text);
     else
         _log.Debug("Flash Background Callback: " + e.request);
 }
Ejemplo n.º 13
0
        private string callFlashString(AxShockwaveFlashObjects.AxShockwaveFlash flash,
            string method, params object[] vals)
        {
            string response = string.Empty;

            StringBuilder sb = new StringBuilder();
            try
            {
                foreach (var param in vals)
                {
                    sb.AppendFormat("<string>{0}</string>", param);
                }

                _log.DebugFormat("Calling method: {0}[{1}]", method, sb.ToString());
                lock (_lock)
                {
                    response = flash.CallFunction(string.Format(METHODSTRING, method, sb.ToString()));
                }
                if (response != "<undefined/>") //void
                    _log.DebugFormat("Response from method: {0}[{1}] = {2}", method, sb.ToString(), response);
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Error Calling method {0} [{1}] on flash {2}. {3}",
                    method, sb, flash.Name, ex.ToString());
            }
            return response;
        }
Ejemplo n.º 14
0
        private string callFlashEmpty(AxShockwaveFlashObjects.AxShockwaveFlash flash,
            string method)
        {
            string response = string.Empty;

            try
            {
                _log.DebugFormat("Calling method: {0}", method);
                lock (_lock)
                {
                    response = flash.CallFunction(string.Format(METHODEMPTY, method));
                }
                if (response != "<undefined/>") //void
                    _log.DebugFormat("Response from method: {0} = {1}", method, response);
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Error Calling method {0} on flash {1}. {2}",
                    method, flash.Name, ex.ToString());
            }
            return response;
        }
Ejemplo n.º 15
0
 private void YTplayer_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
 {
     try
     {
         if (e.request.Contains("onYouTubePlayerReady") ||
             e.request.Contains("YTStateChange") ||
             e.request.Contains("YTError"))
         {
             Console.Write("YTplayer_FlashCall: raw: " + e.request.ToString() + "\r\n");
             // 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");
             List<string> listS = new List<string>();
             foreach (XmlNode l in list)
             {
                 listS.Add(l.InnerText);
             }
             Console.Write("YTplayer_FlashCall: \"" + command.ToString() + "(" + string.Join(",", listS) + ")\r\n");
             // Interpret command
             switch (command)
             {
                 case "onYouTubePlayerReady": YTready(listS[0]); break;
                 case "YTStateChange": YTStateChange(listS[0]); break;
                 case "YTError": YTStateError(listS[0]); break;
                 default: Console.Write("YTplayer_FlashCall: (unknownCommand: " + command + ")\r\n"); break;
             }
         }
         else
         {
             e.request = "";
         }
         /*if (e.request.Contains("ads"))
         {
             Console.Write("YTplayer_FlashCall: raw: " + e.request.ToString() + "\r\n");
         }*/
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Ejemplo n.º 16
0
 private void axShockwaveFlash1_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)
 {
 }
Ejemplo n.º 17
0
 void axShockwaveFlash1_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
 {
     Console.WriteLine(e.request);
 }
Ejemplo n.º 18
0
        private void player_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
        {
            AxShockwaveFlashObjects.AxShockwaveFlash player = sender as AxShockwaveFlashObjects.AxShockwaveFlash;
            int paneIndex = FindIndexFromPlayer(player);

            XmlDocument document = new XmlDocument();
            document.LoadXml(e.request);
            XmlAttributeCollection attributes = document.FirstChild.Attributes;
            String command = attributes.Item(0).InnerText;
            XmlNodeList list = document.GetElementsByTagName("arguments");
            string resourceId = null;
            string resourcePath = null;
            switch (command) {
                case "callbacksReady":
                        UpdatePreview(paneIndex);
                    break;

                case "getBitmapData":
                        resourceId = list[0].InnerText;
                        resourcePath = this.applicationDescriptor.ResolveResource(resourceId);
                        //pluginMain.ConsoleLog("Bitmap '" + resourceId + "' resolved to: " + resourcePath);
                        if (resourceId != null) {
                            List<int> ints = new List<int>();
                            Bitmap bmp = new Bitmap(resourcePath);
                            for (int y = 0; y < bmp.Height; y++) {
                                for (int x = 0; x < bmp.Width; x++) {
                                    Color pixel = bmp.GetPixel(x, y);
                                    ints.Add(pixel.ToArgb());
                                }
                            }

                            List<byte> bytes = new List<byte>();
                            foreach (int i in ints) {
                                bytes.AddRange(BitConverter.GetBytes(i));
                            }

                            String base64 = Convert.ToBase64String(bytes.ToArray());
                            string xmlReturnValue = "<string>" + bmp.Width + "|" + bmp.Height + "|" + base64 + "</string>";
                            player.SetReturnValue(xmlReturnValue);
                        }
                    break;

                case "getText":
                    resourceId = list[0].InnerText;
                    resourcePath = this.applicationDescriptor.ResolveResource(resourceId);
                    if (resourceId != null) {
                        string fileContents = File.ReadAllText(resourcePath);
                        string xmlReturnValue = "<string>" + fileContents + "</string>";
                        player.SetReturnValue(xmlReturnValue);
                    }
                    break;

                case "getBytes":
                    resourceId = list[0].InnerText;
                    resourcePath = this.applicationDescriptor.ResolveResource(resourceId);
                    if (resourceId != null) {
                        Byte[] fileContents = File.ReadAllBytes(resourcePath);
                        String base64 = Convert.ToBase64String(fileContents);
                        string xmlReturnValue = "<string>" + base64 + "</string>";
                        player.SetReturnValue(xmlReturnValue);
                    }
                    break;

                case "trace":
                    string message = list[0].InnerText;
                    pluginMain.ConsoleLog(message);
                    break;
            }
        }
Ejemplo n.º 19
0
 public FlashHelper(string flashPath,AxShockwaveFlashObjects.AxShockwaveFlash flashContainer)
 {
     container=flashContainer;
     container.Movie = flashPath;
 }
Ejemplo n.º 20
0
 //向as发送请求
 private void axShockwaveFlash1_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
 {
     //没有任何代码也可以;
 }
Ejemplo n.º 21
0
 private void flashForeground_FlashCallBack(object sender,
     AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
 {
     string text = e.request;
     if (text.Contains("FINISHEDMULTIBALL") ||
         text.Contains("FINISHEDBALLLOCK") ||
         text.Contains("FINISHEDJACKPOT") ||
         text.Contains("ANIMATIONCOMPLETED"))
     {
         lock (_lock)
         {
             if (InvokeRequired)
                 return;
             flashForeground.Visible = false;
             flashForeground.Stop(); //foreground is used for cutscenes and may have sounds that don't stop.
         }
         if (OnAnimationCompleted != null)
             OnAnimationCompleted(new DisplayEventArgs(flashForeground.Tag, "ANIMATIONCOMPLETED"));
     }
     else if (text.Contains("@spellfinished="))
     {
         _cardsLeftToTurn--;
         if (_cardsLeftToTurn <= 0 && flashForeground.Movie.Equals(_showLetterSwfFile))
         {
             lock (_lock)
             {
                 if (InvokeRequired)
                     return;
                 flashForeground.Visible = false;
             }
             if (OnAnimationCompleted != null)
                 OnAnimationCompleted(new DisplayEventArgs(flashForeground.Tag, "ANIMATIONCOMPLETED"));
         }
     }
     if (text.StartsWith("<invoke name=\"API")) //DEBUG
         _log.Warn("Foreground API Definition: " + text);
     else
         _log.Debug("Flash Foreground Callback: " + text);
 }
Ejemplo n.º 22
0
 private void FlashMain_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)
 {
     MessageBox.Show(e.ToString());
 }
Ejemplo n.º 23
0
 private void axShockwaveFlash1_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)
 {
     switch (e.command)
     {
         case "click":
             {
                 showEarth();
             }
             break;
         case "close":
             //Application.Exit();
             break;
         default:
             break;
     }
 }
Ejemplo n.º 24
0
 private void flash_OnReadyStateChange(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_OnReadyStateChangeEvent e)
 {
     if (e.newState == 4)
     {
         ReadMeta();
     }
 }
Ejemplo n.º 25
0
 private void FlashMain_OnProgress(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_OnProgressEvent e)
 {
     MessageBox.Show(e.ToString());
 }
Ejemplo n.º 26
0
        void axShockwaveFlash1_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
        {
            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 attLast = document.LastChild.InnerXml.ToString();

            //方法名
            String command = attributes.Item(0).InnerText;
            //参数
            string[] deal = DealParameters(attLast);
            //get parameters
            XmlNodeList list = document.GetElementsByTagName("arguments");
            this.Invoke(new DeleFlashCall(DealFlashCall), new object[] {command,deal[0]});
        }
Ejemplo n.º 27
0
 private void axShockwaveFlash1_OnReadyStateChange(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_OnReadyStateChangeEvent e)
 {
 }
Ejemplo n.º 28
0
 private void flsh_player_OnReadyStateChange(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_OnReadyStateChangeEvent e)
 {
     //notIcon.ShowBalloonTip(1000, "Cargando emisora flash...", e.newState.ToString(), ToolTipIcon.Info);
 }
Ejemplo n.º 29
0
        void flash_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
        {
            //var flash = (ExAxShockwaveFlash)sender;
            //Console.WriteLine(sender);
            //Console.WriteLine(e.request);

            //Console.WriteLine("**********************");

            InvokeInfo InvokeInfo;
            try
            {
                //Console.WriteLine("Input:{0}", e.request);
                InvokeInfo = UnserializeInvoke(e.request);
            }
            catch (XmlException)
            {
                return;
            }
            catch (Exception Exception)
            {
                Console.WriteLine(Exception);
                return;
            }
            Func<dynamic, dynamic> Callback;
            try
            {
                Callback = Callbacks[InvokeInfo.Name];
            }
            catch (Exception Exception)
            {
                if (InvokeInfo.Name.Substring(0, 8) == "function")
                {
                    return;
                }
                Console.WriteLine("Calling undefined callback '{0}'", InvokeInfo.Name);
                Console.WriteLine(Exception);
                return;
            }

            dynamic ReturnValue;

            try
            {
                ReturnValue = Callback(InvokeInfo.Params);
            }
            catch (Exception Exception)
            {
                Console.WriteLine("Error on Callback: " + Exception);
                return;
            }

            try
            {
                var ResultStringXml = SerializeObject(ReturnValue);
                //Console.WriteLine("Result('{0}') :: {1}", ReturnValue, ResultStringXml);
                SetReturnValue(ResultStringXml);
            }
            catch (Exception Exception)
            {
                Console.WriteLine("Result('{0}')", ReturnValue);
                Console.WriteLine("Error setting result: " + Exception);
                return;
            }
        }
Ejemplo n.º 30
0
 public ConnWeb(AxShockwaveFlashObjects.AxShockwaveFlash IntrovertIMApp)
 {
     proxy = new ExternalInterfaceProxy(IntrovertIMApp);
     proxy.ExternalInterfaceCall += new ExternalInterfaceCallEventHandler(proxy_ExternalInterfaceCall);
 }