private static Color ParseColor(PluginConfiguration config, DefaultColor color) { string configValue = config.GetValue(color.ConfigurationName(), Colors.ToString(color.DefaultValue())); return(Colors.Parse(configValue, color.DefaultValue())); }
/// <summary> /// Gets the value for this color, as specified in the configuration file. /// </summary> /// <param name="defaultColor"></param> /// <returns></returns> public static Color Value(this DefaultColor defaultColor) { switch (defaultColor) { case DefaultColor.Off: return(defaultColor.DefaultValue()); case DefaultColor.ToggleLED: return(Configuration.toggleLEDColor); case DefaultColor.HighResource: return(Configuration.highResourceColor); case DefaultColor.MediumResource: return(Configuration.mediumResourceColor); case DefaultColor.LowResource: return(Configuration.lowResourceColor); case DefaultColor.ReactionWheelNormal: return(Configuration.reactionWheelNormalColor); case DefaultColor.ReactionWheelPilotOnly: return(Configuration.reactionWheelPilotOnlyColor); case DefaultColor.ReactionWheelSASOnly: return(Configuration.reactionWheelSasOnlyColor); case DefaultColor.DockingCrossfeedOn: return(Configuration.dockingCrossfeedOnColor); case DefaultColor.DockingCrossfeedOff: return(Configuration.dockingCrossfeedOffColor); case DefaultColor.CrewPilot: return(Configuration.crewPilotColor); case DefaultColor.CrewEngineer: return(Configuration.crewEngineerColor); case DefaultColor.CrewScientist: return(Configuration.crewScientistColor); case DefaultColor.CrewTourist: return(Configuration.crewTouristColor); case DefaultColor.ResourceLFO: return(Configuration.lfoColor); case DefaultColor.ResourceLiquidFuel: return(Configuration.liquidFuelColor); case DefaultColor.ResourceOxidizer: return(Configuration.oxidizerColor); case DefaultColor.ResourceMonopropellant: return(Configuration.monopropellantColor); case DefaultColor.HighScience: return(Configuration.highScienceColor); case DefaultColor.MediumScience: return(Configuration.mediumScienceColor); case DefaultColor.LowScience: return(Configuration.lowScienceColor); case DefaultColor.Warning: return(Configuration.warningColor); case DefaultColor.Unknown: return(Configuration.unknownColor); default: return(defaultColor.DefaultValue()); } }