private Logger() { LogPath = EnvironmentUtil.GetAppDataPath("Log.txt"); // We delete the log if it gets too big try { var maxLogSize = 1024 * 1024 * 10; // 10 MB if (File.Exists(LogPath) && new FileInfo(LogPath).Length > maxLogSize) { File.Delete(LogPath); } } catch (Exception) { } }
public static void SetStartupApp(bool startup) { try { using (var registryKey = Registry.CurrentUser.OpenSubKey(startUpKey, true)) { if (startup) { var currentPath = EnvironmentUtil.GetCurrentAppPath(); registryKey.SetValue(appKey, currentPath); } else { registryKey.DeleteValue(appKey); } } } catch (Exception ex) { Logger.Current.Error("Could change the startup state of the widget.", ex); throw; } }