CollectEvent(object sender, CollectorEventArgs e) { // cast the sender object to the SnoopCollector we are expecting Collector snoopCollector = sender as Collector; if (snoopCollector == null) { Debug.Assert(false); // why did someone else send us the message? return; } Autodesk.AutoCAD.Runtime.RXObject rxObj = e.ObjToSnoop as Autodesk.AutoCAD.Runtime.RXObject; if (rxObj != null) { Stream(snoopCollector.Data(), rxObj); return; } }
Stream(ArrayList data, Autodesk.AutoCAD.Runtime.RXObject rxObj) { data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.AutoCAD.Runtime.RXObject))); data.Add(new Snoop.Data.Class("Class", rxObj.GetType())); data.Add(new Snoop.Data.String("Rx class name", MgdDbg.Utils.AcadUi.ObjToRxClassStr(rxObj))); // branch to all types we are concerned with AcDb.Database db = rxObj as AcDb.Database; if (db != null) { Stream(data, db); return; } AcDb.HostApplicationServices hAppSrvs = rxObj as AcDb.HostApplicationServices; if (hAppSrvs != null) { Stream(data, hAppSrvs); return; } AcRx.DynamicLinker dLinker = rxObj as AcRx.DynamicLinker; if (dLinker != null) { Stream(data, dLinker); return; } AcRx.Dictionary dict = rxObj as AcRx.Dictionary; if (dict != null) { Stream(data, dict); return; } AcRx.RXClass rxClass = rxObj as AcRx.RXClass; if (rxClass != null) { Stream(data, rxClass); return; } }