/// <summary> /// Returns null if we get an event we're not interested in, or an unparseable event (e.g. for an object type we don't know about). /// </summary> private static ObjectChange ProcessEvent(string class_, string operation, string opaqueRef, object snapshot, bool marshall) { switch (class_.ToLowerInvariant()) { case "session": case "event": case "vtpm": case "user": case "secret": // We don't track events on these objects return(null); default: Type typ = Marshalling.GetXenAPIType(class_); if (typ == null) { log.DebugFormat("Unknown {0} event for class {1}.", operation, class_); return(null); } switch (operation) { case "add": case "mod": var marshalled = marshall ? Marshalling.convertStruct(typ, (Hashtable)snapshot) : snapshot; return(new ObjectChange(typ, opaqueRef, marshalled)); case "del": return(new ObjectChange(typ, opaqueRef, null)); default: log.DebugFormat("Unknown event operation {0} for opaque ref {1}", operation, opaqueRef); return(null); } } }
/// <summary> /// Returns null if we get an event we're not interested in, or an unparseable event (e.g. for an object type we don't know about). /// </summary> /// <param name="proxyEvent"></param> /// <returns></returns> private static ObjectChange ProcessEvent(Proxy_Event proxyEvent) { switch (proxyEvent.class_.ToLowerInvariant()) { case "session": case "event": case "vtpm": case "user": case "secret": // We don't track events on these objects return(null); default: Type typ = Marshalling.GetXenAPIType(proxyEvent.class_); if (typ == null) { log.DebugFormat("Unknown {0} event for class {1}.", proxyEvent.operation, proxyEvent.class_); return(null); } switch (proxyEvent.operation) { case "add": case "mod": return(new ObjectChange(typ, proxyEvent.opaqueRef, Marshalling.convertStruct(typ, (Hashtable)proxyEvent.snapshot))); case "del": return(new ObjectChange(typ, proxyEvent.opaqueRef, null)); default: log.DebugFormat("Unknown event operation {0} for opaque ref {1}", proxyEvent.operation, proxyEvent.opaqueRef); return(null); } } }