using System; using System.Collections.Generic; using System.Text; using System.IO; using SimpleJson; using CommonLang; namespace Pomelo.DotNetClient { public static class EventTypes { private static HashMap pushTypeMap = new HashMap(); private static HashMap pushKeyMap = new HashMap(); private static HashMap requestTypeMap = new HashMap(); private static HashMap responseTypeMap = new HashMap(); private static HashMap responseKeyMap = new HashMap(); private static HashMap notifyTypeMap = new HashMap(); public static void RegistPushType(string key, Type value) { pushTypeMap.Add(key, value); pushKeyMap.Add(value, key); } public static void RegistRequestType(string key, Type request, Type response) { requestTypeMap.Add(request, key); responseTypeMap.Add(response, key); responseKeyMap.Add(key, response); } public static void RegistNotifyType(string key, Type notify) { notifyTypeMap.Add(notify, key); } public static Type GetPushType(string key) { return pushTypeMap.Get(key); } public static string GetPushKey(Type type) { return pushKeyMap.Get(type); } public static string GetRequestKey(Type type) { return requestTypeMap.Get(type); } public static string GetResponseKey(Type type) { return responseTypeMap.Get(type); } public static Type GetResponseType(string key) { return responseKeyMap.Get(key); } public static string GetNotifyKey(Type type) { return notifyTypeMap.Get(type); } public static IEnumerable PushTypes { get { return pushTypeMap.Values; } } public static IEnumerable RequestTypes { get { return requestTypeMap.Keys; } } public static IEnumerable ResponseTypes { get { return responseTypeMap.Keys; } } public static IEnumerable NotifyTypes { get { return notifyTypeMap.Keys; } } } }