Exemplo n.º 1
0
        public static T GetRawData <T>(this RawDataWrapper <T> source) where T : class
        {
            Type type = typeof(RawDataWrapper <T>);

            return(type.GetProperty("RawData", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(source) as T);
        }
Exemplo n.º 2
0
 public static T GetRawData <T>(this RawDataWrapper <T> data)
 {
     return(data.GetField <T>("RawData"));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 用指定的消息来源和原始数据初始化<see cref="MessageObject{T}"/>类的新实例。
 /// </summary>
 /// <param name="source">消息源</param>
 /// <param name="message">消息数据</param>
 /// <remarks>
 /// <see cref="SourceType"/>属性默认会赋值为<paramref name="message"/>的类型名,
 /// 所使用的包装器为<see cref="RawDataWrapper{T}"/>
 /// </remarks>
 public MessageObject(object source, T message)
 {
     Source     = source;
     SourceType = typeof(T).Name;
     Content    = new RawDataWrapper <T>(message);
 }