public static List <EELData.System> Systems; // Make available Application wide #endregion #region Ctor public Main() { InitializeComponent(); //LogRichText("Initializing...", Color.DarkGreen); if (!File.Exists("eel.db")) { InitializeDb(); } BindStaticControls(); RefreshScannedObjectsList(); GetSettings(); if (_settings == null) { _settings = new Settings { Commander = "The Mule", LogPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Frontier_Developments\\Products\\elite-dangerous-64\\Logs" }; } RefreshSettings(); GetLogPath(); if (!string.IsNullOrWhiteSpace(_dataPath)) { LogWatcher.Path = _dataPath; LogWatcher.EnableRaisingEvents = true; } RefreshExpeditionDropDown(); //PopulateSystemGrid(); PopulateObjectTypes(); GetDistanceTravelled(); _logFileHandler = new LogFileHandler(_currentExpedition); LoadSystems(); }
public static void AddFile(Action <LogFileHandler> handlerDelegate) { var handler = new LogFileHandler(); handlerDelegate(handler); Handlers.Add(handler); }
public void Init(string prefix, bool doConsolePrint, bool doFilePrint) { this.doConsolePrint = doConsolePrint; this.doFilePrint = doFilePrint; this.prefix = prefix; if (doFilePrint) { handler = new LogFileHandler(); handler.InitNewLogFile(key, prefix); } }
public void Init(string prefix, bool formPrint, bool filePrint) { doFormPrint = formPrint; doFilePrint = filePrint; this.prefix = prefix; if (filePrint) { handler = new LogFileHandler(); handler.InitNewLogFile("ProtoSendTool", prefix); } }
public IDisposable BeginScopeImpl(object state) { if (_logfileHandler == null || _logfileHandler.Disposed) { var folder = Path.Combine(_artifactsFolder, _name); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } _logfileHandler = new LogFileHandler(Path.Combine(folder, "result.json")); } return(_logfileHandler); }
void readResult(LogFileHandler handler, ListBox target) { target.Invoke(new Action(() => { target.Items.Clear(); })); for (int i = 0; i < handler.resultCount; i++) { target.Invoke(new Action(() => { UrlItem item = new UrlItem(handler.UrlResults[i, 0], handler.UrlResults[i, 1]); target.Items.Add(item); })); } }
public void LogFileHandlerInitialTest() { File.Delete(@"C:\Temp\MasterLog\MasterLog.log"); MasterLogWriter mlw = new MasterLogWriter(); mlw.masterLogLocation = @"C:\Temp\MasterLog\MasterLog.log"; LogFileHandler lfh = new LogFileHandler(mlw, @"C:\Temp\logs\app.log", @"{0:yyyy-MM-dd HH:mm:ss.fff}, C:\Temp\xml\log.xml, {1}, {2}"); System.Threading.Thread.Sleep(1000); var txt = File.ReadAllText(@"C:\Temp\MasterLog\MasterLog.log"); string[] lines = txt.Split('\n'); Console.WriteLine("Number of lines in mock file: {0}", lines.Length); Assert.IsTrue(lines.Length > 0); string[] fields = lines[0].Split(','); //Assert.AreEqual("Item no:aa1 Description:inventory purchase Cost: $230 Paid: Yes Due Date: 12/08/2019 Notes: Paid via credit card", fields[3].Trim()); foreach (string line in lines) { Console.WriteLine(line); } }
private void MainForm_Load(object sender, EventArgs e) { string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string historyPath = Path.Combine(appdata, "FilteredEdgeBrowser", "history.log.txt"); if (!File.Exists(historyPath)) { Directory.CreateDirectory(Path.GetDirectoryName(historyPath)); } string bookmarkPath = Path.Combine(appdata, "FilteredEdgeBrowser", "bookmark.log.txt"); if (!File.Exists(bookmarkPath)) { Directory.CreateDirectory(Path.GetDirectoryName(bookmarkPath)); } historyLog = new LogFileHandler(historyPath); bookmarkLog = new LogFileHandler(bookmarkPath); httpPolicy.reloadPolicy(FilteredEdgeBrowser.Properties.Settings.Default.WebPolicyPath); timePolicy.reloadPolicy(FilteredEdgeBrowser.Properties.Settings.Default.TimePolicyPath); }
private void BrowserForm_Load(object sender, EventArgs e) { if (System.Diagnostics.Debugger.IsAttached) { isDebug = true; } // Init download window: DownloadManager.Instance.Show(); DownloadManager.Instance.Hide(); string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string historyPath = Path.Combine(appdata, "FilteredChromeBrowser", "history.log.txt"); if (!File.Exists(historyPath)) { Directory.CreateDirectory(Path.GetDirectoryName(historyPath)); File.AppendAllText(historyPath, ""); } string bookmarkPath = Path.Combine(appdata, "FilteredChromeBrowser", "bookmark.log.txt"); if (!File.Exists(bookmarkPath)) { Directory.CreateDirectory(Path.GetDirectoryName(bookmarkPath)); File.AppendAllText(bookmarkPath, ""); } historyLog = new LogFileHandler(historyPath); bookmarkLog = new LogFileHandler(bookmarkPath); string xpathPolicyPath = CefSharp.WinForms.Example.Properties.Settings.Default.xpathPolicyPath; xpathPolicy.loadAllRules(xpathPolicyPath); if (isDebug) { httpPolicy.proxyMode = HTTPProtocolFilter.WorkingMode.MAPPING; timePolicy.clearAllTo(true); devtoolToolStripMenuItem.Enabled = true; MessageBox.Show("In debug mode! Filtering is off!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { string httpPolicyPath = CefSharp.WinForms.Example.Properties.Settings.Default.httpPolicyPath; string timePolicyPath = CefSharp.WinForms.Example.Properties.Settings.Default.timePolicyPath; if (!File.Exists(httpPolicyPath)) { MessageBox.Show("Can't open http policy\n" + httpPolicyPath); Process.GetCurrentProcess().Kill(); } else if (!File.Exists(timePolicyPath)) { MessageBox.Show("Can't open time policy\n" + timePolicyPath); Process.GetCurrentProcess().Kill(); } httpPolicy.reloadPolicy(File.ReadAllText(httpPolicyPath)); timePolicy.reloadPolicy(File.ReadAllText(timePolicyPath)); } string saveFolderPath = CefSharp.WinForms.Example.Properties.Settings.Default.saveFolder; if (!Directory.Exists(saveFolderPath)) { MessageBox.Show("Can't access save folder\n" + saveFolderPath); Process.GetCurrentProcess().Kill(); } var bitness = Environment.Is64BitProcess ? "x64" : "x86"; Text += " - " + bitness; // Read bypass secret from file: AddSecretHandler.BypassSecret = CefSharp.WinForms.Example.Properties.Settings.Default.bypassSecret; }