public void OnMsg(AppStoreMsg msg) { if (netFail) { return; } try { switch (msg.Command) { case AppStoreQuery.RemoveCmd: packageFolder.Remove(msg.AppRef); break; case AppStoreQuery.SyncCmd: using (TimedLock.Lock(syncLock)) { this.forceSync = true; this.primaryPollTime = SysTime.Now; } break; default: throw SessionException.Create("Unexpected AppStore command [{0}].", msg.Command); } } catch (Exception e) { SysLog.LogException(e); } }
public void AppStoreMsgs_Msg() { EnhancedStream es = new EnhancedMemoryStream(); AppStoreMsg msgIn, msgOut; msgOut = new AppStoreMsg(AppStoreMsg.GetPrimaryCmd, AppRef.Parse("appref://myapps/theapp.zip?version=1.2.3.4")); Msg.Save(es, msgOut); es.Position = 0; msgIn = (AppStoreMsg)Msg.Load(es); Assert.IsNotNull(msgIn); Assert.AreEqual(AppStoreMsg.GetPrimaryCmd, msgIn.Command); Assert.AreEqual(AppRef.Parse("appref://myapps/theapp.zip?version=1.2.3.4"), msgIn.AppRef); }