1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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<string, Type> pushTypeMap = new HashMap<string, Type>();
- private static HashMap<Type, string> pushKeyMap = new HashMap<Type, string>();
- private static HashMap<Type, string> requestTypeMap = new HashMap<Type, string>();
- private static HashMap<Type, string> responseTypeMap = new HashMap<Type, string>();
- private static HashMap<string, Type> responseKeyMap = new HashMap<string, Type>();
- private static HashMap<Type, string> notifyTypeMap = new HashMap<Type, string>();
- 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<Type> PushTypes { get { return pushTypeMap.Values; } }
- public static IEnumerable<Type> RequestTypes { get { return requestTypeMap.Keys; } }
- public static IEnumerable<Type> ResponseTypes { get { return responseTypeMap.Keys; } }
- public static IEnumerable<Type> NotifyTypes { get { return notifyTypeMap.Keys; } }
- }
- }
|