/// <summary> /// Loads the drape color, opacity, and focus areas from a CinemaDrape configuration file. /// </summary> /// <param name="filePath">The location of the configuration file.</param> /// <param name="loadAreas">True to load the focus areas, false otherwise.</param> private void LoadLayout(string filePath, bool loadAreas) { VerySimpleIni iniFile = string.IsNullOrEmpty(filePath) ? new VerySimpleIni(Properties.Resources.StringDefaultSettingsFile, Application.ExecutablePath, Application.CompanyName, Application.ProductName, false) : new VerySimpleIni(filePath, true); if (iniFile.Load()) { FromString.IfHtmlColor(iniFile.GetValue(Properties.Resources.StringSettingsDrapeColor), this.SetDrapeColor, null); // Read the drape opacity as int (and support the legacy double format) string drapeOpacityStr = iniFile.GetValue(Properties.Resources.StringSettingsDrapeOpacity); FromString.IfInt( drapeOpacityStr, (value) => { this.SetDrapeOpacity(this.ConvertOpacity(value)); }, (error) => { FromString.IfDouble(drapeOpacityStr, this.SetDrapeOpacity, null); }); string peekOpacityStr = iniFile.GetValue(Properties.Resources.StringSettingsPeekOpacity); FromString.IfInt( peekOpacityStr, (value) => { this.peekOpacity = this.ConvertOpacity(value); }, (error) => { FromString.IfDouble(peekOpacityStr, (value) => { this.peekOpacity = value; }, null); }); this.hotKeyString = iniFile.GetValue(Properties.Resources.StringSettingsHotkey); FromString.IfBool(iniFile.GetValue(Properties.Resources.StringSettingsAutoRestoreAreas), value => { this.autoRestoreAreas = value; }, null); if (loadAreas || this.autoRestoreAreas) { this.DeleteAllFocusAreas(); string focusRectString; while (!string.IsNullOrEmpty(focusRectString = iniFile.GetValue(Properties.Resources.StringSettingsFocusArea))) { FromString.IfRectangle(focusRectString, this.AddNewFocusArea, null); } } FromString.IfBool(iniFile.GetValue(Properties.Resources.StringSettingsShowQuickStart), value => { this.quickStartForm.ShowAtStartupCheckBox.Checked = value; }, null); FromString.IfPoint(iniFile.GetValue(Properties.Resources.StringSettingsQuickStartLocation), value => { this.quickStartForm.Location = value; }, null); } }