public static IFrameCommand CreateFrameCommandByCSSyncInfo(ref CSDT_GAMING_CSSYNCINFO msg) { if ((msg.bSyncType >= 0) && (msg.bSyncType < s_CommandCreator.Length)) { CreatorCSSyncDelegate delegate2 = s_CSSyncCommandCreator[msg.bSyncType]; object[] objArray1 = new object[] { msg.bSyncType }; DebugHelper.Assert(delegate2 != null, "Creator is null at index {0}", objArray1); return(delegate2(ref msg)); } object[] inParameters = new object[] { msg.bSyncType }; DebugHelper.Assert(false, "not register framec ommand creator {0}", inParameters); return(null); }
public override void Init() { FrameCommandFactory.PrepareRegisterCommand(); Assembly assembly = typeof(FrameSynchr).get_Assembly(); Type[] types = assembly.GetTypes(); int num = 0; while (types != null && num < types.Length) { Type type = types[num]; object[] customAttributes = type.GetCustomAttributes(typeof(FrameCommandClassAttribute), true); for (int i = 0; i < customAttributes.Length; i++) { FrameCommandClassAttribute frameCommandClassAttribute = customAttributes[i] as FrameCommandClassAttribute; if (frameCommandClassAttribute != null) { CreatorDelegate creator = this.GetCreator(type); if (creator != null) { FrameCommandFactory.RegisterCommandCreator(frameCommandClassAttribute.get_ID(), type, creator); } } } object[] customAttributes2 = type.GetCustomAttributes(typeof(FrameCSSYNCCommandClassAttribute), true); for (int j = 0; j < customAttributes2.Length; j++) { FrameCSSYNCCommandClassAttribute frameCSSYNCCommandClassAttribute = customAttributes2[j] as FrameCSSYNCCommandClassAttribute; if (frameCSSYNCCommandClassAttribute != null) { CreatorCSSyncDelegate cSSyncCreator = this.GetCSSyncCreator(type); if (cSSyncCreator != null) { FrameCommandFactory.RegisterCSSyncCommandCreator(frameCSSYNCCommandClassAttribute.get_ID(), type, cSSyncCreator); } } } object[] customAttributes3 = type.GetCustomAttributes(typeof(FrameSCSYNCCommandClassAttribute), true); for (int k = 0; k < customAttributes3.Length; k++) { FrameSCSYNCCommandClassAttribute frameSCSYNCCommandClassAttribute = customAttributes3[k] as FrameSCSYNCCommandClassAttribute; if (frameSCSYNCCommandClassAttribute != null) { FrameCommandFactory.RegisterSCSyncCommandCreator(frameSCSYNCCommandClassAttribute.get_ID(), type, null); } } num++; } this.ResetSynchr(); }
public static IFrameCommand CreateFrameCommandByCSSyncInfo(ref CSDT_GAMING_CSSYNCINFO msg) { if (msg.bSyncType >= 0 && (int)msg.bSyncType < FrameCommandFactory.s_CSSyncCommandCreator.Length) { CreatorCSSyncDelegate creatorCSSyncDelegate = FrameCommandFactory.s_CSSyncCommandCreator[(int)msg.bSyncType]; DebugHelper.Assert(creatorCSSyncDelegate != null, "Creator is null at index {0}", new object[] { msg.bSyncType }); return(creatorCSSyncDelegate(ref msg)); } DebugHelper.Assert(false, "not register framec ommand creator {0}", new object[] { msg.bSyncType }); return(null); }
public override void Init() { FrameCommandFactory.PrepareRegisterCommand(); System.Type[] types = typeof(FrameSynchr).Assembly.GetTypes(); for (int i = 0; (types != null) && (i < types.Length); i++) { System.Type inType = types[i]; object[] customAttributes = inType.GetCustomAttributes(typeof(FrameCommandClassAttribute), true); for (int j = 0; j < customAttributes.Length; j++) { FrameCommandClassAttribute attribute = customAttributes[j] as FrameCommandClassAttribute; if (attribute != null) { CreatorDelegate creator = this.GetCreator(inType); if (creator != null) { FrameCommandFactory.RegisterCommandCreator(attribute.ID, inType, creator); } } } object[] objArray2 = inType.GetCustomAttributes(typeof(FrameCSSYNCCommandClassAttribute), true); for (int k = 0; k < objArray2.Length; k++) { FrameCSSYNCCommandClassAttribute attribute2 = objArray2[k] as FrameCSSYNCCommandClassAttribute; if (attribute2 != null) { CreatorCSSyncDelegate cSSyncCreator = this.GetCSSyncCreator(inType); if (cSSyncCreator != null) { FrameCommandFactory.RegisterCSSyncCommandCreator(attribute2.ID, inType, cSSyncCreator); } } } } this.ResetSynchr(); }
public static void RegisterCSSyncCommandCreator(CSSYNC_TYPE_DEF CmdID, Type CmdType, CreatorCSSyncDelegate Creator) { FrameCommandFactory.s_CSSyncCommandCreator[CmdID] = Creator; FrameCommandFactory.s_CSSyncCommandTypeDef.Add(CmdType, CmdID); }
public static void RegisterCSSyncCommandCreator(CSSYNC_TYPE_DEF CmdID, System.Type CmdType, CreatorCSSyncDelegate Creator) { s_CSSyncCommandCreator[(int)CmdID] = Creator; s_CSSyncCommandTypeDef.Add(CmdType, CmdID); }