private void button1_Click(object sender, EventArgs e) { StringBuilder s = new StringBuilder(); string path = @"D:\temp\2016-10-10 Kelso files\LOGDATA.LiveView.160921115454.20161010153847"; if (Directory.Exists(path) == false) { return; } var dirInfo = new DirectoryInfo(path); var fiFiles = dirInfo.GetFiles().OrderBy(f => f.LastWriteTime).ToArray(); foreach (var fiFile in fiFiles) { var arrBytes = File.ReadAllBytes(fiFile.FullName); var lv = new KeyConductorSDK.V2.LiveViewEventArgs("160101010101", Protocol.ReturnValues.OK, 0, arrBytes); for (int i = lv.Slots.Count - 1; i >= 0; i--) { if (lv.Slots[i].Position == 51) { //s.AppendLine(string.Format("{0} - {1} - {2}")) s.AppendLine(fiFile.Name + " ::: " + lv.Slots[i].ToString()); i = -1; break; } } } textBox1.Text = s.ToString(); }
void _client_OnGetLiveView(object sender, KeyConductorSDK.V2.LiveViewEventArgs e) { // GetLiveView performance (firmware 2.16RC7): // 24 slots = 1,2 sec // 108 slots = 2 sec // 180 slots ~= 3 sec // Parsing of slots in LVEventArgs is 1 ms if (e.ResultCode == Protocol.ReturnValues.OK) { AddLog("Result GetLiveView at " + DateTime.Now.ToString("HH:mm:ss:fff")); string filename = "GetFileResult." + e.Filename.ToString(); if (filename.EndsWith("KCL")) { filename += ".kcl"; } if (filename.EndsWith("V3")) { filename += ".v3"; } if (File.Exists(filename)) { File.Delete(filename); } File.WriteAllBytes(filename, e.GetContents()); AddLog("File saved as " + filename); AddLog(e.ToString()); AddLog(e.SlotsToString()); AddLog("Result GetLiveView done printing at " + DateTime.Now.ToString("HH:mm:ss:fff")); } }
private void LoadLiveViewFile() { if (File.Exists(txtFilename.Text) == false) { } else { Properties.Settings.Default.PreviousLogFile = txtFilename.Text; Properties.Settings.Default.Save(); var arrBytes = File.ReadAllBytes(txtFilename.Text); if (txtFilename.Text.ToUpper().EndsWith(".V3")) { var lv = new KeyConductorSDK.V3.LiveViewEventArgs("160101010101", Protocol.ReturnValues.OK, 0, arrBytes); textBox1.Text = lv.ToString() + "\r\n" + lv.SlotsToString(); } else { var lv = new KeyConductorSDK.V2.LiveViewEventArgs("160101010101", Protocol.ReturnValues.OK, 0, arrBytes); textBox1.Text = lv.ToString() + "\r\n" + lv.SlotsToString(); } } }