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

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

            switch (bitDepth)
            {
            case TgaBitDepthUIChoices.AutoDetect:
                bitDepths.Add(SavableBitDepths.Rgb24);
                bitDepths.Add(SavableBitDepths.Rgba32);
                break;

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

            case TgaBitDepthUIChoices.Bpp32:
                bitDepths.Add(SavableBitDepths.Rgba32);
                break;

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

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

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

            case TgaBitDepthUIChoices.Bpp32:
                set.Add(InternalFileType.SavableBitDepths.Rgba32);
                return(set);

            case TgaBitDepthUIChoices.Bpp24:
                set.Add(InternalFileType.SavableBitDepths.Rgb24);
                return(set);
            }
            throw ExceptionUtil.InvalidEnumArgumentException <TgaBitDepthUIChoices>(choices, "bitDepth");
        }