コード例 #1
0
ファイル: IniFileExtension.cs プロジェクト: WildGenie/actools
        public static Color GetColor(this IniFileSection section, [LocalizationRequired(false)] string key, Color defaultValue, double defaultMultipler, out double multipler)
        {
            var strings = section.GetStrings(key);
            var result  = strings.Select(x => FlexibleParser.ParseInt(x, 0).ClampToByte()).ToArray();

            if (strings.Length != 4)
            {
                multipler = 1d;
                return(defaultValue);
            }

            multipler = FlexibleParser.ParseDouble(strings[3], 1d);
            return(Color.FromRgb(result[0], result[1], result[2]));
        }
コード例 #2
0
        public static Color GetColor(this IniFileSection section, [LocalizationRequired(false)] string key, Color defaultValue)
        {
            var result = section.GetStrings(key).Select(x => FlexibleParser.ParseInt(x, 0).ClampToByte()).ToArray();

            return(result.Length == 3 ? Color.FromRgb(result[0], result[1], result[2]) : defaultValue);
        }