Untitled
unknown
plain_text
3 years ago
2.1 kB
6
Indexable
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using vseUtilities; namespace Example_HistoryReader_Console { class Program { static void Main(string[] args) { // Set some variables for later usage string ipAddressOfVse = "192.168.0.1"; short portOfVse = 3321; string historyBaseFilePath = "D:\\VseHistory_" + ipAddressOfVse; string historyCsvFilePath = historyBaseFilePath + ".csv"; string historyXdatFilePath = historyBaseFilePath + ".xdat"; // Check general VSEUtility library validity (e.g. correct versions, valid library loading) var result = ICore.checkInstanceValidity(); if (!result.isOk()) { Console.WriteLine("Error " + result.text()); return; } // Uncomment the following lines to define a trace callback method which receives logging messages from VSEUtilities // ICore.instance().setTraceListener(Console.WriteLine); // ICore.instance().setTraceFormat("%L (%D %T): %M"); // Create an instance of IHistoryReader var historyReader = vseUtilities.IHistoryReader.create(); // Connect to the device, read the history and disconnect from the device if (!historyReader.read(ipAddressOfVse, portOfVse).isOk()) { Console.WriteLine("Error"); return; } // Store the history in a CSV file if (!historyReader.writeToCsvFile(historyCsvFilePath).isOk()) { Console.WriteLine("Error writing csv file"); return; } XdatParameters xdatParams = new XdatParameters("Xdat File", "", "", ""); if (!historyReader.writeToXdatFile(historyXdatFilePath, xdatParams).isOk()) { Console.WriteLine("Error writing xdat file"); return; } Console.WriteLine("Success"); } } }
Editor is loading...