Share via


Reading WPC logs in C#

Here is a conversion of the WPCEvents.h file that is used with the vista SDK to get the parts of the various crimson events converted into c#.  I have written about this file before and how the parts are connected together and how all the numbers work.  This is useful if you want to write c# code to read/write WPC events.

It uses a set of enums to encompass all the values, the values are copied directly from the c++ headers.

 

using System;
using System.Collections.Generic;
using System.Text;

namespace WebCplHost
{
    /// <summary>
    /// The enums for the specific event ids.
    /// </summary>
    public enum WPCEvents
    {
        SettingChangeEvent = 1,
        GameStartEvent = 2,
        UrlVisitEvent = 3,
        EmailReceivedEvent = 4,
        EmailSentEvent = 5,
        MediaPlaybackEvent = 6,
        IMInvitationEvent = 7,
        IMJoinEvent = 8,
        IMLeaveEvent = 9,
        FileDownloadEvent = 10,
        IMFeatureEvent = 11,
        CustomEvent = 13,
        EmailContactEvent = 14,
        IMContactEvent = 15,
        AppBlockedEvent = 16,
        AppOverrideEvent = 17,
        WebOverrideEvent = 18
    }

    /// <summary>
    /// The indexes into the user settings for the setting chane event.
    /// </summary>
    public enum WPC_ARGS_SETTINGSCHANGEEVENT
    {
        CLASS = 0,
        SETTING,
        OWNER,
        OLDVAL,
        NEWVAL,
        REASON,
        OPTIONAL
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the AppBlockedEvent.
    /// </summary>
    public enum WPC_ARGS_SAFERAPPBLOCKED
    {
        TIMESTAMP = 0,
        USERID,
        PATH,
        RULEID
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the EmailReceivedEvent.
    /// </summary>
    public enum WPC_ARGS_EMAILRECEIEVEDEVENT
    {
        SENDER = 0,
        APPNAME,
        APPVERSION,
        SUBJECT,
        REASON,
        RECIPCOUNT,
        RECIPIENT,
        ATTACHCOUNT,
        ATTACHMENTNAME,
        RECEIVEDTIME,
        EMAILACCOUNT
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the EmailSentEvent.
    /// </summary>
    public enum WPC_ARGS_EMAILSENTEVENT
    {
        SENDER = 0,
        APPNAME,
        APPVERSION,
        SUBJECT,
        REASON,
        RECIPCOUNT,
        RECIPIENT,
        ATTACHCOUNT,
        ATTACHMENTNAME,
        EMAILACCOUNT
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the EmailContactEvent.
    /// </summary>
    public enum WPC_ARGS_EMAILCONTACTEVENT
    {
        APPNAME = 0,
        APPVERSION,
        OLDNAME,
        OLDID,
        NEWNAME,
        NEWID,
        REASON,
        EMAILACCOUNT
    }

    /// <summary>
    /// This is the values to use for the MEDIATYPE field in the
    /// WPC_ARGS_MEDIAPLAYBACKEVENT.
    /// </summary>
    public enum WPC_MEDIA_TYPE
    {
        OTHER = 0,
        DVD,
        RECORDED_TV,
        AUDIO_FILE,
        CD_AUDIO,
        VIDEO_FILE,
        PICTURE_FILE,
        MAX
    }

    /// <summary>
    /// This is the values to use for the EXPLICIT field in the
    /// WPC_ARGS_MEDIAPLAYBACKEVENT.
    /// </summary>
    public enum WPC_MEDIA_EXPLICIT_TYPE
    {
        FALSE = 0,
        TRUE,
        UNKNOWN
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the MediaPlaybackEvent.
    /// </summary>
    public enum WPC_ARGS_MEDIAPLAYBACKEVENT
    {
        APPNAME = 0,
        APPVERSION,
        MEDIATYPE,
        PATH,
        TITLE,
        PML,
        ALBUM,
        EXPLICIT,
        REASON
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the MediaDownloadEvent.
    /// </summary>
    public enum WPC_ARGS_MEDIADOWNLOADEVENT
    {
        APPNAME = 0,
        APPVERSION,
        MEDIATYPE,
        PATH,
        TITLE,
        PML,
        ALBUM,
        EXPLICIT,
        REASON
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the IMInvitationEvent.
    /// </summary>
    public enum WPC_ARGS_CONVERSATIONINITEVENT
    {
        APPNAME = 0,
        APPVERSION,
        ACCOUNTNAME,
        CONVID,
        REQUESTINGIP,
        SENDER,
        REASON,
        RECIPCOUNT,
        RECIPIENT
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the IMJoinEvent.
    /// </summary>
    public enum WPC_ARGS_CONVERSATIONJOINEVENT
    {
        APPNAME = 0,
        APPVERSION,
        ACCOUNTNAME,
        CONVID,
        JOININGIP,
        JOININGUSER,
        REASON,
        MEMBERCOUNT,
        MEMBER,
        SENDER
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the IMLeaveEvent.
    /// </summary>
    public enum WPC_ARGS_CONVERSATIONLEAVEEVENT
    {
        APPNAME = 0,
        APPVERSION,
        ACCOUNTNAME,
        CONVID,
        LEAVINGIP,
        LEAVINGUSER,
        REASON,
        MEMBERCOUNT,
        MEMBER,
        FLAGS
    }

    /// <summary>
    /// This is the flags to use in the MEDIA_TYPE setction of the WPC_ARGS_IMFEATUREEVENT
    /// when reading it out of the crimson logs.
    /// </summary>
    public enum WPCFLAG_IM_FEATURE : uint
    {
        NONE = 0x00,
        VIDEO = 0x01,
        AUDIO = 0x02,
        GAME = 0x04,
        SMS = 0x08,
        FILESWAP = 0x10,
        URLSWAP = 0x20,
        SENDING = 0x80000000, // Top bit means sending or receiving.
        ALL = 0xFFFFFFFF
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the IMFeatureEvent.
    /// </summary>
    public enum WPC_ARGS_IMFEATUREEVENT
    {
        APPNAME = 0,
        APPVERSION,
        ACCOUNTNAME,
        CONVID,
        MEDIATYPE,
        REASON,
        RECIPCOUNT,
        RECIPIENT,
        SENDER,
        SENDERIP,
        DATA
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the IMContactEvent.
    /// </summary>
    public enum WPC_ARGS_IMCONTACTEVENT
    {
        APPNAME = 0,
        APPVERSION,
        ACCOUNTNAME,
        OLDNAME,
        OLDID,
        NEWNAME,
        NEWID,
        REASON
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the GameStartEvent.
    /// </summary>
    public enum WPC_ARGS_GAMESTARTEVENT
    {
        APPID = 0,
        INSTANCEID,
        APPVERSION,
        PATH,
        RATING,
        RATINGSYSTEM,
        REASON,
        DESCCOUNT,
        DESCRIPTOR,
        PID
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the FileDownloadEvent.
    /// </summary>
    public enum WPC_ARGS_FILEDOWNLOADEVENT
    {
        URL = 0,
        APPNAME,
        VERSION,
        BLOCKED,
        PATH,
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the UrlVisitEvent.
    /// </summary>
    public enum WPC_ARGS_URLVISITEVENT
    {
        URL = 0,
        APPNAME,
        VERSION,
        REASON,
        RATINGSYSTEMID,
        CATCOUNT,
        CATEGORY
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the CustomEvent.
    /// </summary>
    public enum WPC_ARGS_CUSTOMEVENT
    {
        PUBLISHER = 0,
        APPNAME,
        APPVERSION,
        EVENT,
        VALUE1,
        VALUE2,
        VALUE3,
        BLOCKED,
        REASON
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the WebOverrideEvent.
    /// </summary>
    public enum WPC_ARGS_WEBOVERRIDEEVENT
    {
        USERID = 0,
        URL,
        REASON
    }

    /// <summary>
    /// The indexes into the user settings part of crimson for the AppOverrideEvent.
    /// </summary>
    public enum WPC_ARGS_APPOVERRIDEEVENT
    {
        USERID = 0,
        PATH,
        REASON
    }
}