static void Main() { // Set SimpleLog properties SimpleLog.SetLogFile(logDir: ".\\Log", prefix: "SQS-Log_", writeText: true); // Close identical apps CloseIdenticalApps(); // Upgrade settings if needed if (Properties.Settings.Default.UpgradeSettings) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpgradeSettings = false; Properties.Settings.Default.Save(); Properties.Settings.Default.Reload(); } // Display update notification DisplayUpdateNotification(); // Add methods to events Application.ApplicationExit += Application_ApplicationExit; // Check for available updates SquirrelHandler.CheckForUpdatesAsync(); // Start Application Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; mainForm = new MainForm(); Application.Run(mainForm); }
private static void Main(string[] args) { SimpleLog.SetLogFile(".\\Log", "Log_"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm(args)); }
public void AddFile(string fileName) { var file = Path.GetFileName(fileName); SimpleLog.SetLogFile(logDir: logFolder, prefix: file + "_", writeText: false, check: false); document.Root.Add(new XElement(File, new XAttribute(Name, file), new XAttribute(FullPath, new Uri(SimpleLog.FileName).AbsoluteUri))); }
/// <summary> /// Configure the Logger /// </summary> public void Configure() { lock (LockObject) { if (!_configured) { SimpleLog.SetLogFile(logDir: ".//Log", prefix: "SolodexLog_", writeText: true); _configured = true; } } }
/// <summary> /// Sets an enviroment location to store Assembly Log Files /// </summary> private static void InitLogFile() { try { SimpleLog.SetLogFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + Constants.General.NameSpace + "\\" + ChampionName); } catch { Console.WriteLine("Unable to create log file"); } }
public LoginForm() { InitializeComponent(); SimpleLog.SetLogFile(".\\Log", "MyLog_"); //Form this.Text = string.Empty; this.ControlBox = false; this.DoubleBuffered = true; this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea; }
static void Handler(Exception ex) { try { MessageBox.Show("Ha ocurrido un error, favor de verificar el log file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exe) { throw exe; } finally { string[] s = { "\\bin" }; string path = Application.StartupPath.Split(s, StringSplitOptions.None)[0]; SimpleLog.SetLogFile(logDir: ".\\Log", prefix: "MyLog_", writeText: false); SimpleLog.Error(string.Format("Mensaje: {0} Inner Exception Mensaje: {1}", ex.Message, ex.InnerException?.Message ?? "")); } }
static void Main() { // Starts SimpleLog & Debug Console output. if (Properties.Settings.Default.logDir == "") { Properties.Settings.Default.logDir = Directory.GetCurrentDirectory().ToString(); Properties.Settings.Default.Save(); } SimpleLog.SetLogFile(Properties.Settings.Default.logDir + "\\Log", "Anti-cheat-Log_"); SimpleLog.StartLogging(); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = false; // Takes all Persistant settings from Settings.settings and sets them to Global Variables //ResetSettings(); InitSettings(); // Initializes Threads for GUI & Background process. Thread guithread = new Thread(new ThreadStart(WindowGui)); Thread checkthread = new Thread(new ThreadStart(BGProc)); Globals.guiThread = guithread; guithread.IsBackground = false; // Start thread processes that handle Main.cs GUI and the background handler SimpleLog.Info("Starting threads: 'guithread' and 'checkthread'."); // Writes 'info' level message to log bool exception = false; try { guithread.Start(); checkthread.Start(); } catch (Exception ex) { exception = true; SimpleLog.Log(ex); // Write exception with all inner exceptions to log } if (!exception) { SimpleLog.Info("Succsessfully started threads: 'guithread' and 'checkthread'."); } }
public static void Main(string[] args) { SimpleLog.SetLogFile("logs", writeText: true); // read necessary data var isConfigReaded = FileHandler.ReadConfig(Settings.ConfigFileName, out List <Settings> settings); if (!isConfigReaded) { var msg = "Error while reading config file. See log file for details."; Console.WriteLine(msg); SimpleLog.Log(msg); } else { foreach (var setting in settings) { try { ParseLeague(setting); } catch (Exception e) { Console.WriteLine(e); SimpleLog.Log(e); } } } Console.WriteLine("Finished! Press l to view logs, c to close all excel instances or any other key to exit."); var key = Console.ReadKey(); if (key.KeyChar == 'l' || key.KeyChar == 'L') { SimpleLog.ShowLogFile(); } if (key.KeyChar == 'c' || key.KeyChar == 'C') { foreach (var s in settings) { s?.Excel?.CloseFile(); } } SimpleLog.StopLogging(); }
public void EnableLogger() { SimpleLog.SetLogFile(Folders.Logs, Folders.LogsFolder.LogFilenamePrefix); }
/// <summary> /// Connect to SQL Server and fill in the GUI to provide options for the check /// </summary> public bool Connect() { Databases.Clear(); ConnectionStringBuilder.ConnectTimeout = 10; using (var cn = new SqlConnection(ConnectionStringBuilder.ConnectionString)) { try { cn.Open(); } catch (SqlException) { MessageBox.Show(App.Localized["msgErrorNotConnected"], App.Localized["msgNotConnected"], MessageBoxButton.OK, MessageBoxImage.Error); return(false); } var qry = $"SELECT Name, compatibility_level FROM sys.databases WHERE database_id > 4 ORDER BY name OPTION (RECOMPILE); {_infos.Query}"; using (var cmd = new SqlCommand(qry, cn)) { SqlDataReader rd; try { rd = cmd.ExecuteReader(); } catch (SqlException e) { var msg = $"{App.Localized["msgSqlErrorInQuery"]} ({qry}).\n{App.Localized["msgError"]} {e.Number} : {e.Message}"; MessageBox.Show(msg, App.Localized["msgSqlError"], MessageBoxButton.OK, MessageBoxImage.Error); SimpleLog.Error(msg); return(false); } while (rd.Read()) { Databases.Add(new SqlServer.Database() { Checked = false, Name = rd.GetString(0), CompatibilityLevel = (SqlServer.DatabaseCompatibilityLevel)rd.GetByte(1) // danger ! TryParse ?? }); } rd.NextResult(); _infos.Set(rd); _statsCleared = _infos.StartTime; rd.Close(); ServerInfos = $"SQL Server version {_infos.ProductVersion}, Edition {_infos.Edition}"; OnPropertyChanged("ServerInfos"); } cn.Close(); // OutputPath OutputPath = $@"{_outputRoot}{ConnectionStringBuilder.DataSource.Replace("\\", ".")}\"; Directory.CreateDirectory(OutputPath); // we need to change the output path of the manager _ce.OutputPath = OutputPath; SimpleLog.SetLogFile(logDir: OutputPath, check: false); SimpleLog.Info(_infos.ToString()); OnPropertyChanged("Databases"); // status StatusText = $"{App.Localized["msgConnectedTo"]} {ConnectionStringBuilder.DataSource} ({_infos.MachineName}), SQL Server {_infos.ProductVersion} {_infos.Edition}"; OnPropertyChanged("StatusText"); IsConnected = true; return(true); } }
/// <summary> /// Initialisiert den Logger /// </summary> public static void SetupLogger() { SimpleLog.SetLogFile(logDir: "SSS-Log", writeText: true, check: false); }
public Main() { InitializeComponent(); SimpleLog.SetLogFile(logDir: LogDirectoryFolder, writeText: true, check: false); }