private void DoUiTestsSetup(string[] settings) { if (!UnitTestSetup) { if (settings.Contains("-uiTesting")) { UiTestSetup = true; foreach (var argument in settings) { if (argument.Contains("-programPath")) { _programSettingsPath = argument.Substring(13, (argument.Length - 13)).Replace("%20", " "); try { FileModification.CreateFolderIfNotExists(_programSettingsPath); } catch (Exception e) { Messages.CreateMessageBox(_programSettingsPath + "=" + e.Message, "Error", true); } FileModification.HostFileLocation = _programSettingsPath + "\\hosts"; } } } } }
private void SaveUserConfiguration(CurrentUserConfiguration userConfiguration) { var jsonConfiguration = JsonConvert.SerializeObject(userConfiguration); string encryptedConfiguration = EncryptingHelper.Encrypt(jsonConfiguration, _configurationPassword); FileModification.CreateFolderIfNotExists($"{_programSettingsPath}\\.backOnTrack"); FileModification.WriteFile(GetProxyUserConfigurationPath(), encryptedConfiguration); }
public void SetCurrentConfigurationToDefault() { if (!FileModification.FileExists(ConfigurationPath)) { FileModification.CreateFolderIfNotExists(ConfigurationPath.Replace("\\config.settings", "")); } CreateNewConfiguration(); CopyCurrentConfigurationToTempConfig(); }
public void SaveCurrentConfiguration() { CopyTempConfigurationToCurrentConfig(); if (!FileModification.FileExists(ConfigurationPath)) { FileModification.CreateFolderIfNotExists(ConfigurationPath.Replace("\\config.settings", "")); } SaveConfiguration(Configuration); CopyCurrentConfigurationToTempConfig(); }
public void SetCurrentConfigurationFromConfig() { if (FileModification.FileExists(ConfigurationPath)) { string configurationContent = FileModification.ReadFile(ConfigurationPath); if (configurationContent == "") { CreateNewConfiguration(); } else { Configuration = JsonConvert.DeserializeObject <CurrentProgramConfiguration>(configurationContent); } } else { FileModification.CreateFolderIfNotExists(ConfigurationPath.Replace("\\config.settings", "")); CreateNewConfiguration(); } CopyCurrentConfigurationToTempConfig(); }