public void SetSettings(System.Xml.XmlNode node) { System.Xml.XmlElement element = (System.Xml.XmlElement)node; BackgroundColor = SettingsHelper.ParseColor(element["BackgroundColor"]); BackgroundColor2 = SettingsHelper.ParseColor(element["BackgroundColor2"]); GraphColors.Clear(); // GraphColor and GraphColor2 were the old values used to store the GraphColors. If they exist, add their values to our new list of colors. var GraphColor = SettingsHelper.ParseColor(element["GraphColor"]); if (GraphColor != default(Color)) { GraphColors.Add(GraphColor); } var GraphColor2 = SettingsHelper.ParseColor(element["GraphColor2"]); if (GraphColor2 != default(Color)) { GraphColors.Add(GraphColor2); } // Regular parsing of GraphColors. We can't use a default Parser since it's a list and needs to be comma seperated. if (element[nameof(GraphColors)] != null) { var colorString = element[nameof(GraphColors)].InnerText; if (!string.IsNullOrWhiteSpace(colorString)) { GraphColors.AddRange(colorString.Split(',').Select(x => Color.FromArgb(int.Parse(x, NumberStyles.HexNumber)))); } } // The trigger that occurs when GraphGradientType is Plain fires too early. Redo it! cmbGraphGradientType_SelectedValueChanged(null, null); MinimumValue = SettingsHelper.ParseFloat(element["MinimumValue"]); MaximumValue = SettingsHelper.ParseFloat(element["MaximumValue"]); GraphWidth = SettingsHelper.ParseInt(element["GraphWidth"]); GraphHeight = SettingsHelper.ParseInt(element["GraphHeight"]);; HorizontalMargins = SettingsHelper.ParseInt(element["HorizontalMargins"]);; VerticalMargins = SettingsHelper.ParseInt(element["VerticalMargins"]);; GraphStyle = SettingsHelper.ParseEnum <GraphStyle>(element["GraphStyle"]); BackgroundGradient = SettingsHelper.ParseEnum <GradientType>(element["BackgroundGradient"]); GraphGradient = SettingsHelper.ParseEnum <GraphGradientType>(element["GraphGradient"]); GraphSillyColors = SettingsHelper.ParseBool(element["GraphSillyColors"]); ValueTextPosition = SettingsHelper.ParseEnum <Position>(element["ValueTextPosition"]); DescriptiveTextPosition = SettingsHelper.ParseEnum <Position>(element["DescriptiveTextPosition"]); LocalMax = SettingsHelper.ParseBool(element["LocalMax"]); ProcessName = SettingsHelper.ParseString(element["ProcessName"]); DescriptiveText = SettingsHelper.ParseString(element["DescriptiveText"]); var selectedGame = SettingsHelper.ParseString(element["SelectedGame"]); if (selectedGame != null) { var games = ComboBox_ListOfGames.DataSource as List <string>; if (games != null && games.Contains(selectedGame)) { ComboBox_ListOfGames.SelectedItem = selectedGame; var selectedOption = SettingsHelper.ParseString(element["SelectedGameOption"]); if (selectedOption != null) { var options = ComboBox_GameOption.DataSource as List <string>; if (options != null && options.Contains(selectedOption)) { ComboBox_GameOption.SelectedItem = selectedOption; } } } } txtModule.Text = SettingsHelper.ParseString(element["Module"]); txtBase.Text = SettingsHelper.ParseString(element["Base"]); txtOffsets.Text = SettingsHelper.ParseString(element["Offsets"]); ValueType = SettingsHelper.ParseEnum <MemoryType>(element["ValueType"]); DescriptiveTextColor = SettingsHelper.ParseColor(element["DescriptiveTextColor"]); DescriptiveTextFont = SettingsHelper.GetFontFromElement(element["DescriptiveTextFont"]); DescriptiveTextOverrideColor = SettingsHelper.ParseBool(element["DescriptiveTextOverrideColor"]); DescriptiveTextOverrideFont = SettingsHelper.ParseBool(element["DescriptiveTextOverrideFont"]); ValueTextColor = SettingsHelper.ParseColor(element["ValueTextColor"]); ValueTextFont = SettingsHelper.GetFontFromElement(element["ValueTextFont"]); ValueTextOverrideColor = SettingsHelper.ParseBool(element["ValueTextOverrideColor"]); ValueTextOverrideFont = SettingsHelper.ParseBool(element["ValueTextOverrideFont"]); ValueTextDecimals = SettingsHelper.ParseInt(element["ValueTextDecimals"]); UnitsConversionEnabled = SettingsHelper.ParseBool(element["UnitConversionEnabled"]); UnitsUsed = SettingsHelper.ParseEnum <Units>(element["UnitsUsed"]); MeterInGameUnits = CultureSafeFloatParse(SettingsHelper.ParseString(element["MeterInGameUnits"])); UpdatePointer(null, null); }
private void BackColorChangedEvent(object sender, EventArgs e) { GraphColors.Clear(); GraphColors.AddRange(GraphColorButtons.Select(b => b.BackColor)); }