private static void TestReadSyncTime() { ConnectionParameters para = new ConnectionParameters(); para.LinkAddress = 1; para.SizeOfCA = 2; LinkControlDown lc = new LinkControlDown(); lc.FCB = false; lc.FCV = true; lc.FuncCode = LinkFunctionCodeDown.UserData; T102Frame frame = new T102Frame(lc, para); ASDU asdu = new ASDU(CauseOfTransmission.SYNC_TIME, false, false, 1, RecordAddress.Default, false); SyncTime st = new SyncTime(new CP56Time2b(new DateTime(2007, 8, 18, 6, 21, 1, 520))); asdu.AddInformationObject(st); asdu.Encode(frame, para); frame.PrepareToSend(); byte[] aa = frame.GetBuffer(); int length = aa[1]; byte linkControl = aa[4]; int linkAddr = aa[5] + aa[6] * 0x100; //解析 ASDU na = new ASDU(para, aa, length + 4 + 2); InformationObject io = na.GetElement(0); }
public override void Run() { //PreConvert(ScFilename); //PreConvert(TcFilename); // 将ass中所有 {\fs24\an8} 置换为 Style:an8 // "PopSub注释..." 去掉 // 非 an8 的 Dialog,去除所有逗号和句号 //return; SyncTime sync = new SyncTime(); sync.Filename1 = ScFilename; sync.Filename2 = TcFilename; sync.Run(); }
private async void SyncTimeCommandAction() { await Task.Run(() => { var dt = SyncTime.GetBJTime(); if (DateTime.Now.ToString("yyyy-MM-dd HH:mm") == dt.ToString("yyyy-MM-dd HH:mm")) { return; } SyncTime.SetSystemTime(dt); SimpleMessenger.Default.Publish(new GeneralMessage() { Signal = GeneralMessage.Types.ShowBallon, Title = "Time Synced.", Content = DateTime.Now.ToString() }); }); }
private async void HandleMainViewMessage(NotifyIconViewMessage msg) { switch (msg.Signal) { case NotifyIconViewMessage.Signals.SyncTime: await Task.Run(() => { bool synced = false; try { var dt = SyncTime.GetBJTime(); synced = SyncTime.SetSystemTime(dt); } catch { } finally { if (synced) { if (msg.Parameter?.ToString() != "Slient") { SimpleMessenger.Default.Publish(new GeneralMessage() { Signal = GeneralMessage.Types.ShowBallon, Title = "Time Synced.", Content = DateTime.Now.ToString() }); } } } }); break; default: break; } }