示例#1
0
        internal override Set <SavableBitDepths> CreateAllowedBitDepthListFromToken(PropertyBasedSaveConfigToken token)
        {
            BmpBitDepthUIChoices bitDepth = (BmpBitDepthUIChoices)token.GetProperty <StaticListChoiceProperty>(PropertyNames.BitDepth).Value;

            Set <SavableBitDepths> bitDepths = new Set <SavableBitDepths>();

            switch (bitDepth)
            {
            case BmpBitDepthUIChoices.AutoDetect:
                bitDepths.Add(SavableBitDepths.Rgb24);
                bitDepths.Add(SavableBitDepths.Rgb8);
                break;

            case BmpBitDepthUIChoices.Bpp24:
                bitDepths.Add(SavableBitDepths.Rgb24);
                break;

            case BmpBitDepthUIChoices.Bpp8:
                bitDepths.Add(SavableBitDepths.Rgb8);
                break;

            default:
                throw new InvalidEnumArgumentException("bitDepth", (int)bitDepth, typeof(BmpBitDepthUIChoices));
            }

            return(bitDepths);
        }
示例#2
0
        internal override HashSet <InternalFileType.SavableBitDepths> CreateAllowedBitDepthListFromToken(PropertyBasedSaveConfigToken token)
        {
            BmpBitDepthUIChoices choices = (BmpBitDepthUIChoices)token.GetProperty <StaticListChoiceProperty>(PropertyNames.BitDepth).Value;
            HashSet <InternalFileType.SavableBitDepths> set = new HashSet <InternalFileType.SavableBitDepths>();

            switch (choices)
            {
            case BmpBitDepthUIChoices.AutoDetect:
                set.Add(InternalFileType.SavableBitDepths.Rgb24);
                set.Add(InternalFileType.SavableBitDepths.Rgb8);
                return(set);

            case BmpBitDepthUIChoices.Bpp24:
                set.Add(InternalFileType.SavableBitDepths.Rgb24);
                return(set);

            case BmpBitDepthUIChoices.Bpp8:
                set.Add(InternalFileType.SavableBitDepths.Rgb8);
                return(set);
            }
            throw ExceptionUtil.InvalidEnumArgumentException <BmpBitDepthUIChoices>(choices, "bitDepth");
        }