internal override BaseBaseProcessor GetInternalMsgProcessor(string msgType, string eventName) { switch (msgType.ToLower()) { case "event": return(GetBasicEventMsgProcessor(eventName)); case "text": return(SingleInstance <InternalWXChatProcessor <WXTextRecMsg> > .GetInstance(() => new InternalWXChatProcessor <WXTextRecMsg> { ProcessFunc = ProcessTextMsg })); case "image": return(SingleInstance <InternalWXChatProcessor <WXImageRecMsg> > .GetInstance(() => new InternalWXChatProcessor <WXImageRecMsg> { ProcessFunc = ProcessImageMsg })); case "voice": return(SingleInstance <InternalWXChatProcessor <WXVoiceRecMsg> > .GetInstance(() => new InternalWXChatProcessor <WXVoiceRecMsg> { ProcessFunc = ProcessVoiceMsg })); case "video": return(SingleInstance <InternalWXChatProcessor <WXVideoRecMsg> > .GetInstance(() => new InternalWXChatProcessor <WXVideoRecMsg> { ProcessFunc = ProcessVideoMsg })); case "shortvideo": return(SingleInstance <InternalWXChatProcessor <WXVideoRecMsg> > .GetInstance(() => new InternalWXChatProcessor <WXVideoRecMsg> { ProcessFunc = ProcessShortVideoMsg })); case "location": return(SingleInstance <InternalWXChatProcessor <WXLocationRecMsg> > .GetInstance(() => new InternalWXChatProcessor <WXLocationRecMsg> { ProcessFunc = ProcessLocationMsg })); case "link": return(SingleInstance <InternalWXChatProcessor <WXLinkRecMsg> > .GetInstance(() => new InternalWXChatProcessor <WXLinkRecMsg> { ProcessFunc = ProcessLinkMsg })); } return(null); }
private BaseBaseProcessor GetBasicEventMsgProcessor(string eventName) { switch (eventName.ToLower()) { case "subscribe": return(SingleInstance <InternalWXChatProcessor <WXSubScanRecEventMsg> > .GetInstance(() => new InternalWXChatProcessor <WXSubScanRecEventMsg> { ProcessFunc = ProcessSubscribeEventMsg })); case "unsubscribe": return(SingleInstance <InternalWXChatProcessor <WXSubScanRecEventMsg> > .GetInstance(() => new InternalWXChatProcessor <WXSubScanRecEventMsg> { ProcessFunc = ProcessUnsubscribeEventMsg })); case "scan": return(SingleInstance <InternalWXChatProcessor <WXSubScanRecEventMsg> > .GetInstance(() => new InternalWXChatProcessor <WXSubScanRecEventMsg> { ProcessFunc = ProcessScanEventMsg })); case "location": return(SingleInstance <InternalWXChatProcessor <WXLocationRecEventMsg> > .GetInstance(() => new InternalWXChatProcessor <WXLocationRecEventMsg> { ProcessFunc = ProcessLocationEventMsg })); case "click": return(SingleInstance <InternalWXChatProcessor <WXClickRecEventMsg> > .GetInstance(() => new InternalWXChatProcessor <WXClickRecEventMsg> { ProcessFunc = ProcessClickEventMsg })); case "view": return(SingleInstance <InternalWXChatProcessor <WXViewRecEventMsg> > .GetInstance(() => new InternalWXChatProcessor <WXViewRecEventMsg> { ProcessFunc = ProcessViewEventMsg })); } return(null); }
public void TestMethod1() { SingleInstance p = SingleInstance.GetInstance(); Assert.IsNotNull(p); SingleInstance p1 = SingleInstance.GetInstance(); Assert.IsNotNull(p1); SingleInstance p2 = SingleInstance.GetInstance(); Assert.IsNotNull(p2); SingleInstance p3 = SingleInstance.GetInstance(); Assert.IsNotNull(p3); //结果 //新的实例 //原来的实例 //原来的实例 //原来的实例 }