Exemple #1
0
		/// <summary> Extracts information out of the SWF/SWD in order to populate
		/// function line number tables in SourceFile variabels.
		/// </summary>
		public virtual void  parseSwfSwd(DManager manager)
		{
			m_manager = manager;
			
			// suck in the swf/swd into action lists and then walk the lists
			// looking for LineRecords
			m_container = new LineFunctionContainer(m_swf, m_swd);
			m_container.combForLineRecords(this);
			
			// we are done, sucess or no
			setPopulated();
			
			// log event that we have complete done
			manager.addEvent(new FunctionMetaDataAvailableEvent());
			m_manager = null;
		}
		public static PlayerSession createFromSocket(System.Net.Sockets.TcpClient s)
		{
			DProtocol proto = DProtocol.createFromSocket(s);
			
			// let the manager hear incoming messages
			DManager manager = new DManager();
			manager.attach(proto);
			
			PlayerSession session = new PlayerSession(s, proto, manager);
			return session;
		}
        /// <summary> Destroys all objects related to the connection
		/// including the process that was tied to this
		/// session via SessionManager.launch(), if it
		/// exists.
		/// </summary>
		public virtual void  terminate()
		{
			bool playerWillTerminateItself = false;
			
			// unbind first
			try
			{
				// Tell player to end session.  Note that this is just a hint, and will often
				// do nothing.  For example, the Flash player running in a browser will
				// currently never terminate when you tell it to, but the AIR player will
				// terminate.
				playerWillTerminateItself = unbind(true);
			}
			catch (Exception)
			{
			}
			
			if (!playerWillTerminateItself)
			{
#if false
				//UPGRADE_TODO: Method 'java.lang.System.getProperty' was converted to 'System.Environment.GetEnvironmentVariable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangSystemgetProperty_javalangString'"
				if (Environment.GetEnvironmentVariable("OS").ToLower().StartsWith("mac os x"))
				//$NON-NLS-1$ //$NON-NLS-2$
				{
					// In certain situations, AppleScript can hang for about two minutes (bug 193086).  Since all we're
					// trying to do here is close the browser window, we do the work in a separate thread.  If that
					// thread hangs for two minutes, no harm done.
					IThreadRunnable r = new AnonymousClassRunnable(this);
					new SupportClass.ThreadClass(new System.Threading.ThreadStart(r.Run), "Terminate Mac debug target").Start(); //$NON-NLS-1$
				}
#endif
				// if we have a process pop it
				if (m_process != null)
				{
					try
					{
						m_process.Kill();
					}
					catch (Exception)
					{
					}
				}
			}
			
			// now clear it all
			m_protocol = null;
			m_socket = null;
			m_manager = null;
			m_process = null;
			m_isConnected = false;
			m_isHalted = false;
		}
		private const String FLASH_PREFIX = "$flash_"; //$NON-NLS-1$
		
		internal PlayerSession(System.Net.Sockets.TcpClient s, DProtocol proto, DManager manager)
		{
			m_isConnected = false;
			m_isHalted = false;
			m_socket = s;
			m_protocol = proto;
			m_manager = manager;
			m_prefs = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
			m_incoming = false;
			m_debugMsgOn = false;
			m_debugMsgSize = 16;
			m_debugMsgFileOn = false;
			m_debugMsgFileSize = 128;
			m_watchTransactionTag = 1; // number that is sent for each watch transaction that occurs
		}