private static object ProcessCmd(CmdModel model) { object obj = null; try { switch (model.ModuleType) { // case ModuleTypeEnum.OnceData: // return OnceDataStorage.Instance(model).ExecCmd(model); // break; // case ModuleTypeEnum.HeartBeatData: // return HeartBeatDataStorage.Instance().ExecCmd(model); // break; // case ModuleTypeEnum.SystemData: // obj = SystemDataStorage.GetSystemInfo(); // break; default: break; } } catch (Exception ex) { LogHelper.Error(ex); } return(obj); }
public static OnceDataStorage Instance(CmdModel cmd) { OnceDataStorage obj = null; switch (cmd.CounterType) { case CounterTypeEnum.Nil: break; case CounterTypeEnum.Business: obj = new BizCounter(); break; case CounterTypeEnum.Custom: obj = new CoustomCounter(); break; case CounterTypeEnum.Error: obj = new ErrorCounter(); break; default: throw new Exception("not found this CounterType"); break; } obj.Cmd = cmd; return(obj); }
public void TimeFormat() { Assert.AreEqual(1, CmdModel.ParseSeconds("0:1")); Assert.AreEqual(1, CmdModel.ParseSeconds("00:01")); Assert.AreEqual(1, CmdModel.ParseSeconds("00:00:01")); Assert.AreEqual(5141, CmdModel.ParseSeconds("01:25:41")); Assert.AreEqual(1541, CmdModel.ParseSeconds("25:41")); }
public CmdViewModel() { cmd = CmdModel.GetCmd(); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register <byte[]>(this, "TC2IMCS00", Refresh); }
public void InvalidInteger() { Assert.Throws <FormatException>(() => CmdModel.ParseSeconds("a:b:c:d")); }
public void Invalid() { Assert.Throws <FormatException>(() => CmdModel.ParseSeconds("a")); Assert.Throws <FormatException>(() => CmdModel.ParseSeconds("b")); Assert.Throws <FormatException>(() => CmdModel.ParseSeconds("0:0:0:0")); }
public void Integer() { Assert.AreEqual(1, CmdModel.ParseSeconds("1")); Assert.AreEqual(0, CmdModel.ParseSeconds("0")); Assert.AreEqual(1000, CmdModel.ParseSeconds("1000")); }