private void InitializeSettingsFromFile(Properties.Settings fileSettings) { if (fileSettings.Created) { try { _settings.AddFontFamily(fileSettings.FontFamily); _settings.FontSize = fileSettings.FontSize; _settings.Color = fileSettings.Color; _settings.BackgroundColor = fileSettings.BackgroundColor; _settings.BackgroundColorOpacity = fileSettings.BackgroundColorOpacity; _settings.EnableDemoKeys(fileSettings.DemoKeys); if (fileSettings.StartupPoint) { _settings.StartupPoint = new StartupLocationModel(fileSettings.x, fileSettings.y); } _settings.Width = fileSettings.Width; _settings.Height = fileSettings.Height; _settings.EnableResize(fileSettings.CanResize); _settings.WindowFixing(fileSettings.FixWindow); RTSSHandler.RTSSPath = fileSettings.RTSSPath; _isRtssEnabled = fileSettings.RTSSEnabled; _isMouseEnabled = fileSettings.MouseEnabled; _settings.KeysAlignment = fileSettings.KeysAlignment; if (!fileSettings.FirstLaunchStatistic) { SendStatistic(); } } catch (Exception) { // Ignored } } else { SendStatistic(); } }
private void SaveSettingsToFile(Properties.Settings fileSettings) { try { fileSettings.FontFamily = _settings.FontFamily.Source; fileSettings.FontSize = _settings.FontSize; fileSettings.Color = _settings.Color; fileSettings.BackgroundColor = _settings.BackgroundColor; fileSettings.BackgroundColorOpacity = _settings.BackgroundColorOpacity; fileSettings.DemoKeys = !string.IsNullOrEmpty(_settings.DemoKeys); if (_settings.StartupPoint != null) { fileSettings.x = _settings.StartupPoint.Left; fileSettings.y = _settings.StartupPoint.Top; fileSettings.StartupPoint = true; } else { fileSettings.x = 0; fileSettings.y = 0; fileSettings.StartupPoint = false; } fileSettings.Width = _settings.Width; fileSettings.Height = _settings.Height; fileSettings.CanResize = _settings.CanResize; fileSettings.FixWindow = _settings.FixWindow; fileSettings.RTSSEnabled = _isRtssEnabled; fileSettings.RTSSPath = RTSSHandler.RTSSPath; fileSettings.MouseEnabled = _isMouseEnabled; fileSettings.KeysAlignment = _settings.KeysAlignment; fileSettings.Created = true; } catch (Exception) { // Ignored } fileSettings.Save(); }