Exemplo n.º 1
0
		private static void LoadConfigFileSettings(SettingsStorage settings)
		{
			settings.MaxAbsoluteScalePower = Settings.Default.MaxAbsoluteScalePower;
			settings.ExportValuesSeparator = Settings.Default.ExportValuesSeparator;
			settings.RecentFilesCount = Settings.Default.RecentFilesCount;
			settings.Language = GetLanguage(Settings.Default.Language);
		}
Exemplo n.º 2
0
		public void SaveSettings(SettingsStorage newSettings)
		{
			SaveConfigFileSettings(newSettings);
			SaveRegistrySettings(CurrentSettings, newSettings);

			currentSettings = newSettings;
		}
Exemplo n.º 3
0
		private static void SaveConfigFileSettings(SettingsStorage settings)
		{
			Settings.Default.MaxAbsoluteScalePower = settings.MaxAbsoluteScalePower;
			Settings.Default.ExportValuesSeparator = settings.ExportValuesSeparator;
			Settings.Default.RecentFilesCount = settings.RecentFilesCount;
			Settings.Default.Language = settings.Language.Type;
			Settings.Default.Save();
		}
Exemplo n.º 4
0
		public void LoadSettings()
		{
			var settings = new SettingsStorage();
			LoadConfigFileSettings(settings);
			LoadRegistrySettings(settings);

			currentSettings = settings;
		}
Exemplo n.º 5
0
		private static void LoadRegistrySettings(SettingsStorage settings)
		{
			foreach (var extension in PredefinedData.SupportedExtensions)
			{
				var fileAssociation = new FileAssociation(extension);
				if (fileAssociation.Exists)
				{
					settings.AddRegisteredExtension(extension);
				}
			}
		}
Exemplo n.º 6
0
		private static void SaveRegistrySettings(SettingsStorage oldSettings, SettingsStorage newSettings)
		{
			var oldRegisteredExtensions = new List<string>(oldSettings.RegisteredExtensions);
			foreach (var extension in newSettings.RegisteredExtensions)
			{
				if (!oldRegisteredExtensions.Contains(extension))
				{
					RegisterExtension(extension);
				}
			}

			var newRegisteredExtensions = new List<string>(newSettings.RegisteredExtensions);
			foreach (var extension in oldSettings.RegisteredExtensions)
			{
				if (!newRegisteredExtensions.Contains(extension))
				{
					UnregisterExtension(extension);
				}
			}
		}
Exemplo n.º 7
0
		public InitializationDto(SettingsStorage settings, IEnumerable<RecentFileDto> recentFiles)
		{
			Settings = settings;
			RecentFiles = recentFiles;
		}
Exemplo n.º 8
0
		private static SettingsDto GetSettingsDto(SettingsStorage storage)
		{
			return new SettingsDto(
				storage.MaxAbsoluteScalePower, storage.ExportValuesSeparator,
				storage.RecentFilesCount, storage.RegisteredExtensions, storage.Language);
		}