public ProtocolStatusChangeEventArgs(Protocol protocol, StatusMode newStatus) { this.newStatus = newStatus; this.protocol = protocol; }
/// <summary> /// Get the event information from a <see cref="DBEVENTINFO"/> struct. /// </summary> /// <param name="dbEventInfo">[REF] <see cref="DBEVENTINFO"/> struct.</param> /// <param name="mirandaHandle">Event handle (the blob buffer will be populated if not null).</param> /// <param name="blobBuffer">Buffer to use for blob marshaling.</param> /// <param name="type">[OUT] Event type.</param> /// <param name="flags">[OUT] Event flags.</param> /// <param name="data">[OUT] Event data.</param> /// <param name="owningModule">[OUT] Event related module.</param> /// <param name="timestamp">[OUT] Event timestamp.</param> private static void GetEventInfo(ref DBEVENTINFO dbEventInfo, IntPtr eventHandle, InteropBuffer blobBuffer, out DatabaseEventType type, out DatabaseEventProperties flags, out string data, out Protocol owningModule, out DateTime timestamp) { MirandaContext context = MirandaContext.Current; unsafe { // If the event handle is set, we probably want to populate the blob buffer... if (eventHandle != IntPtr.Zero) PopulateBlobBuffer(ref dbEventInfo, eventHandle); type = (DatabaseEventType)dbEventInfo.EventType; flags = (DatabaseEventProperties)dbEventInfo.Flags; data = GetEventData(ref dbEventInfo); } owningModule = GetEventModule(ref dbEventInfo); GetEventTimestamp(ref dbEventInfo, blobBuffer, out timestamp); }
public static IntPtr LoadProtocolIcon(Protocol protocol, StatusMode status) { return LoadProtocolIcon((protocol != null ? protocol.Name : null), status); }
/// <summary> /// Gets the event information based on its handle. /// </summary> /// <param name="eventHandle">Event handle.</param> /// <param name="type">[OUT] Event type.</param> /// <param name="flags">[OUT] Event flags.</param> /// <param name="data">[OUT] Event data.</param> /// <param name="owningModule">[OUT] Event related module.</param> /// <param name="timestamp">[OUT] Event timestamp.</param> public static void FromHandle(IntPtr eventHandle, out DatabaseEventType type, out DatabaseEventProperties flags, out string data, out Protocol owningModule, out DateTime timestamp) { InteropBuffer buffer = null; try { unsafe { DBEVENTINFO dbEventInfo; PrepareDbEventInfo(eventHandle, out dbEventInfo, out buffer); GetEventInfo(ref dbEventInfo, eventHandle, buffer, out type, out flags, out data, out owningModule, out timestamp); } } catch (MirandaException) { throw; } catch (Exception e) { throw new InvalidOperationException(TextResources.ExceptionMsg_CannotFinishMarshaling, e); } finally { if (buffer != null) { buffer.Unlock(); InteropBufferPool.ReleaseBuffer(buffer); } } }
private unsafe void PopulateNetworkProtocols() { try { int count; PROTOCOLDESCRIPTOR** pointerArrayPtr; int result = CallServiceUnsafe(MirandaServices.MS_PROTO_ENUMPROTOCOLS, &count, &pointerArrayPtr); if (result != 0) throw new MirandaException(String.Format(TextResources.ExceptionMsg_Formatable2_MirandaServiceReturnedFailure, MirandaServices.MS_PROTO_ENUMPROTOCOLS, result.ToString())); ProtocolDictionary protocols = new ProtocolDictionary(count); for (int i = 0; i < count; i++) { // *(ptr_to_array_of_ptrs + i * sizeof(PROTOCOLDESCRIPTOR)) = *ptr_to_ptr = *ptr = data PROTOCOLDESCRIPTOR nativeDescriptor = **(((PROTOCOLDESCRIPTOR**)pointerArrayPtr) + i); Protocol protocol = new Protocol(ref nativeDescriptor); protocols.Add(protocol.Name, protocol); } this.protocols = protocols; } catch (Exception) { this.protocols = new ProtocolDictionary(0); } }