/// <summary> /// Private constructor ensures singleton purity. /// </summary> private LogReader() { fileSystemWatcher = new FileSystemWatcher(); fileSystemWatcher.Filter = "*.log"; fileSystemWatcher.NotifyFilter = NotifyFilters.LastWrite; fileSystemWatcher.Changed += new FileSystemEventHandler(MonitorLogDirectory); fileSystemWatcher.Created += new FileSystemEventHandler(MonitorLogDirectory); appSettings = new WaywardGamers.KParser.Properties.Settings(); }
/// <summary> /// Private constructor ensures singleton purity. /// </summary> private DatabaseManager() { Properties.Settings prefs = new WaywardGamers.KParser.Properties.Settings(); prefs.Reload(); string defaultPath = prefs.DefaultParseSaveDirectory; if (defaultPath == string.Empty) { defaultPath = System.Windows.Forms.Application.CommonAppDataPath; } defaultCopyDatabaseFilename = Path.Combine(defaultPath, prefs.DefaultUnnamedDBFileName); Version assemVersion = Assembly.GetExecutingAssembly().GetName().Version; assemblyVersionString = string.Format("{0}.{1}", assemVersion.Major, assemVersion.Minor); }
/// <summary> /// Inserts a couple required pieces of information into newly-created databases. /// </summary> private void InitializeNewDatabase() { Properties.Settings appSettings = new WaywardGamers.KParser.Properties.Settings(); string parsedCulture = appSettings.ParsingCulture; if (parsedCulture == null) { parsedCulture = string.Empty; } if ((parsedCulture != "fr-FR") && (parsedCulture != "de-DE") && (parsedCulture != "ja-JP")) { parsedCulture = string.Empty; } string parserVersionString = string.Format("{0}{1}", assemblyVersionString, parsedCulture); // Insert version information if (localDB.Version.Rows.Count == 0) { localDB.Version.AddVersionRow(databaseVersion, parserVersionString); } // Insert default battle row if (localDB.Battles.Rows.Count == 0) { localDB.Battles.AddBattlesRow(null, DateTime.Now.ToUniversalTime(), DateTime.Now.ToUniversalTime(), false, null, 0, 0, 0, 0, true); } UpdateDatabase(); // Make sure we're using the proper translated strings when we start parsing. Resources.ParsedStrings.Culture = new System.Globalization.CultureInfo(parsedCulture); DatabaseParseCulture = parsedCulture; // Reset the static string classes to get the properly translated // version of the resource strings. JobAbilities.Reset(); ParseExpressions.Reset(parsedCulture); }