public bool UpdateRegistryEntries(string tokenFilePath) { try { try { DeleteFile(Settings.TokenOldFilePath); } catch { } string path = string.Format(@"SOFTWARE\{0}\{1}", Settings.CompanyPath, Settings.Product); using (var registryKey = new Registry()) { if (registryKey.Open(RegistryKeyType.CurrentUser, path, true)) { registryKey.SetValue("DataPath", Settings.GoogleDriveData); registryKey.SetValue("CachePath", Settings.LocalGoogleDriveData); registryKey.SetValue("TokenFilePath", tokenFilePath); } } return true; } catch (Exception exception) { Log.Error(exception, false); return false; } }
public string GetRegistryEntryTokenFilePath() { try { string path = string.Format(@"SOFTWARE\{0}\{1}", Settings.CompanyPath, Settings.Product); object value = null; using (var registryKey = new Registry()) { if (registryKey.Open(RegistryKeyType.CurrentUser, path, true)) { value = registryKey.GetValue("TokenFilePath"); } } if (value == null) { return null; } return value.ToString(); } catch (Exception exception) { Log.Error(exception, false); return null; } }