private static void LoadUuid(IDatabaseSettingDao dao) { string uuid = dao.GetUuid(); if (string.IsNullOrEmpty(uuid)) { UuidGenerator g = Guid.NewGuid(); uuid = g.ToString().Replace("-", ""); dao.SetUuid(uuid); } RuntimeSettings.Uuid = uuid; ExceptionReporter.Uuid = uuid; Logger.InfoFormat("Your user id is {0}, use this for any bug reports", RuntimeSettings.Uuid); }
private static string GetUuid() { using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey(@"Software\EvilSoft\GrimDamage")) { string uuid = (string)registryKey?.GetValue("uuid"); if (!string.IsNullOrEmpty(uuid)) { return(uuid); } UuidGenerator g = Guid.NewGuid(); uuid = g.ToString().Replace("-", ""); registryKey?.SetValue("uuid", uuid); return(uuid); } }