home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 136 / MOBICLIC136.ISO / pc / DATA / HOTE / libs / amfphp / amfphp.swf / scripts / __Packages / mx / remoting / debug / NetDebug.as < prev    next >
Text File  |  2011-07-20  |  5KB  |  179 lines

  1. class mx.remoting.debug.NetDebug extends Object
  2. {
  3.    static var version = "1.2.0.124";
  4.    function NetDebug()
  5.    {
  6.       var _loc1_ = this;
  7.       super();
  8.       _loc1_._ncs = new Array();
  9.       _loc1_._config = mx.remoting.debug.NetDebugConfig.getDefaultNetDebugConfig(false);
  10.       _loc1_._glc = new mx.remoting.debug.GlobalLocalConnection(false,_loc1_);
  11.       _loc1_._glc.sendCommand(new mx.remoting.debug.commands.GetConfig());
  12.       _loc1_._nextNewId = 0;
  13.       if(_global.System.onStatus == undefined)
  14.       {
  15.          _global.System.onStatus = mx.remoting.debug.NetDebug.globalOnStatus;
  16.       }
  17.       mx.remoting.NetServices.traceNetServices = mx.remoting.debug.NetDebug.traceNetServices;
  18.    }
  19.    function addNetConnection(nc)
  20.    {
  21.       this._ncs.push(nc);
  22.       return this._nextNewId++;
  23.    }
  24.    function requestNewConfig()
  25.    {
  26.       return this.sendCommand(new mx.remoting.debug.commands.GetConfig());
  27.    }
  28.    function removeNetConnection(nc)
  29.    {
  30.       var _loc2_ = this;
  31.       var _loc3_ = _loc2_._ncs.length;
  32.       var _loc1_ = 0;
  33.       while(_loc1_ < _loc3_)
  34.       {
  35.          if(nc == _loc2_._ncs[_loc1_])
  36.          {
  37.             _loc2_._ncs.splice(_loc1_,1);
  38.             break;
  39.          }
  40.          _loc1_ = _loc1_ + 1;
  41.       }
  42.    }
  43.    function sendDebugEvent(eventobj)
  44.    {
  45.       if(!this._glc.send(eventobj))
  46.       {
  47.          this._glc.send(new mx.remoting.debug.events.NetDebugFailedSendError(mx.remoting.debug.NetDebug.stripNCDEventToMinmal(eventobj)));
  48.          return false;
  49.       }
  50.       return true;
  51.    }
  52.    function sendCommand(commandobj)
  53.    {
  54.       return this._glc.sendCommand(commandobj);
  55.    }
  56.    function updateConfig(config)
  57.    {
  58.       var _loc2_ = this;
  59.       mx.utils.ObjectCopy.copyProperties(_loc2_._config,config);
  60.       var _loc3_ = _loc2_._ncs.length;
  61.       var _loc1_ = 0;
  62.       while(_loc1_ < _loc3_)
  63.       {
  64.          if(_loc2_._ncs[_loc1_] != null)
  65.          {
  66.             _loc2_._ncs[_loc1_].updateConfig(config);
  67.          }
  68.          _loc1_ = _loc1_ + 1;
  69.       }
  70.    }
  71.    function sendStatus(statusobj)
  72.    {
  73.       var _loc1_ = this;
  74.       if(_loc1_._config.m_debug && _loc1_._config.client.m_debug)
  75.       {
  76.          return _loc1_._glc.send(new mx.remoting.debug.events.NetDebugStatus(statusobj));
  77.       }
  78.    }
  79.    function onEvent(eventObj)
  80.    {
  81.       return this.sendDebugEvent(eventObj);
  82.    }
  83.    function onEventError(errorObj)
  84.    {
  85.       return this.sendDebugEvent(new mx.remoting.debug.events.NetDebugError(errorObj));
  86.    }
  87.    function onReceiveCommand(commandobj)
  88.    {
  89.       this[commandobj.command](commandobj.data);
  90.    }
  91.    function onReceiveError(errorobj)
  92.    {
  93.       this.sendDebugEvent(new mx.remoting.debug.events.NetDebugError(errorobj));
  94.    }
  95.    function getConfig()
  96.    {
  97.       return this._config;
  98.    }
  99.    static function getNetDebug()
  100.    {
  101.       return mx.remoting.debug.NetDebug.ndSingleton;
  102.    }
  103.    static function trace(obj)
  104.    {
  105.       mx.remoting.debug.NetDebug.getNetDebug()._trace(obj);
  106.    }
  107.    static function traceNetServices(who, severity, number, message)
  108.    {
  109.       mx.remoting.debug.NetDebug.getNetDebug()._traceNetServices(who,severity,number,message);
  110.    }
  111.    static function globalOnStatus(statusobj)
  112.    {
  113.       mx.remoting.debug.NetDebug.getNetDebug().sendStatus(statusobj);
  114.    }
  115.    static function initialize()
  116.    {
  117.       if(mx.remoting.debug.NetDebug.ndSingleton == null)
  118.       {
  119.          mx.remoting.debug.NetDebug.ndSingleton = new mx.remoting.debug.NetDebug();
  120.          mx.remoting.debug.ConnectionMixin.initialize();
  121.       }
  122.       return true;
  123.    }
  124.    static function stripNCDEventToMinmal(ev)
  125.    {
  126.       var _loc1_ = ev;
  127.       var _loc2_ = new Object();
  128.       if(_loc1_.eventType != null)
  129.       {
  130.          _loc2_.eventType = _loc1_.eventType;
  131.       }
  132.       if(_loc1_.source != null)
  133.       {
  134.          _loc2_.source = _loc1_.source;
  135.       }
  136.       if(_loc1_.movieUrl != null)
  137.       {
  138.          _loc2_.movieUrl = _loc1_.movieUrl;
  139.       }
  140.       if(_loc1_.date != null)
  141.       {
  142.          _loc2_.date = _loc1_.date;
  143.       }
  144.       if(_loc1_.time != null)
  145.       {
  146.          _loc2_.time = _loc1_.time;
  147.       }
  148.       if(_loc1_.protocol != null)
  149.       {
  150.          _loc2_.protocol = _loc1_.protocol;
  151.       }
  152.       if(_loc1_.debugId != null)
  153.       {
  154.          _loc2_.debugId = _loc1_.debugId;
  155.       }
  156.       return _loc2_;
  157.    }
  158.    function _traceNetServices(who, severity, number, message)
  159.    {
  160.       var _loc1_ = this;
  161.       if(_loc1_._config.m_debug && _loc1_._config.client.m_debug && _loc1_._config.client.trace)
  162.       {
  163.          if(_loc1_.sendDebugEvent(new mx.remoting.debug.events.NetDebugTraceNetServices(who,severity,number,message)))
  164.          {
  165.          }
  166.       }
  167.    }
  168.    function _trace(traceobj)
  169.    {
  170.       var _loc1_ = this;
  171.       if(_loc1_._config.m_debug && _loc1_._config.client.m_debug && _loc1_._config.client.trace)
  172.       {
  173.          if(_loc1_.sendDebugEvent(new mx.remoting.debug.events.NetDebugTrace(traceobj)))
  174.          {
  175.          }
  176.       }
  177.    }
  178. }
  179.