public void SetVizTechLog() { try { var filename = Resources.viz_tech_log; using (var sr = new StreamReader(filename)) { while (!sr.EndOfStream) { var line = sr.ReadLine(); var split = Regex.Split(line, "ERROR"); VizTechLogs.Add(new VizTechLog(split[0], split[1])); } } } catch (Exception ex) { var box = new WpfMessageBoxService(); box.ShowMessage(ex.Message, "Exception Caught"); } }
public void DoSoftwareUpdate(object o, RoutedEventArgs e) { if (FilesToUpdate.Count > 0) { FilesToUpdate.Clear(); FileCount = 0; } if (CanChangeToUsbDrive()) { // we can look for update.ini if (File.Exists(_updateIni)) { LogText += "\r\n\r\nStarting Update.."; RaisePropertyChangedEvent("LogText"); System.Threading.Thread.Sleep(500); string[] foldersSection = null; string[] filesSection = null; var quit = new bool[2] { false, false }; BoLib.setFileAction(); quit[0] = ReadIniSection(out foldersSection, "Folders"); quit[1] = ReadIniSection(out filesSection, "Files"); BoLib.clearFileAction(); if (quit[0] || quit[1]) return; foreach (var str in filesSection) { var ret = GetImagePathString(str); FilesToUpdate.Add(new FileImpl(str, ret, true)); if (DoCopyFile(str)) FileCount++; } foreach (var str in foldersSection) { var ret = GetImagePathString(str); FilesToUpdate.Add(new FileImpl(str, ret, false)); //new Microsoft.VisualBasic.Devices.Computer().FileSystem.CopyDirectory(@"e:\1111", @"d:\1111_VB", true); DoCopyDirectory(str, 0); } // Move old files back. // Read rollback.ini. // That copy works nicely. Odd that there isnt a C# version. // Move old files back. _updateSuccess = (_filesNotCopied.Count > 0) ? false : true; HasUpdateFinished = true; RaisePropertyChangedEvent("HasUpdateFinished"); RaisePropertyChangedEvent("UpdateFiles"); CleanUp(); AutomaticSave(); if (_filesNotCopied.Count > 0) { string errorMessage = ""; foreach (var f in _filesNotCopied) { errorMessage += @f + "\r\n"; } WpfMessageBoxService msg = new WpfMessageBoxService(); msg.ShowMessage(errorMessage, "Update Error"); _filesNotCopied.Clear(); } } } }
public void SetCashlessLibLog() { try { var filename = Resources.cashless_log; using (var fs = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var bs = new BufferedStream(fs)) using (var sr = new StreamReader(bs)) { while (!sr.EndOfStream) { var line = sr.ReadLine(); CashLess.Add(new CashlessLibLog(line)); } } } catch (Exception ex) { var box = new WpfMessageBoxService(); box.ShowMessage(ex.Message, "Exception Caught"); } }