예제 #1
0
            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;
                }
            }
예제 #2
0
            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;
                }
            }