Пример #1
0
        public static IDrmProcessor Get(BookFormat format, PrivateKeyScheme scheme)
        {
            if (scheme == PrivateKeyScheme.None)
            {
                return(PassThrough.Value);
            }

            switch (format)
            {
            case BookFormat.EPub:
                switch (scheme)
                {
                case PrivateKeyScheme.Adept:
                    return(AdeptEPub.Value);

                case PrivateKeyScheme.Kobo:
                case PrivateKeyScheme.KoboNone:
                    return(KoboEPub.Value);

                default:
                    throw new NotSupportedException("Unsupported combination of book format and DRM scheme.");
                }

            case BookFormat.EReader:
                switch (scheme)
                {
                default:
                    throw new NotSupportedException("Unsupported combination of book format and DRM scheme.");
                }

            default:
                throw new NotSupportedException("Unsupported book format.");
            }
        }
Пример #2
0
        public static IDrmProcessor Get(BookFormat format, PrivateKeyScheme scheme)
        {
            if (scheme == PrivateKeyScheme.None)
                return PassThrough.Value;

            switch (format)
            {
                case BookFormat.EPub:
                    switch (scheme)
                    {
                        case PrivateKeyScheme.Adept:
                            return AdeptEPub.Value;
                        case PrivateKeyScheme.Kobo:
                        case PrivateKeyScheme.KoboNone:
                            return KoboEPub.Value;
                        default:
                            throw new NotSupportedException("Unsupported combination of book format and DRM scheme.");
                    }
                case BookFormat.EReader:
                    switch (scheme)
                    {
                        default:
                            throw new NotSupportedException("Unsupported combination of book format and DRM scheme.");
                    }
                default:
                    throw new NotSupportedException("Unsupported book format.");
            }
        }
Пример #3
0
 internal static void PrintResult(PrivateKeyScheme drm)
 {
     string result = drm.ToString();
     ConsoleColor? color;
     switch (drm)
     {
         case PrivateKeyScheme.None:
         case PrivateKeyScheme.KoboNone:
             color = null;
             break;
         case PrivateKeyScheme.Adept:
         case PrivateKeyScheme.Kobo:
             color = ConsoleColor.Green;
             break;
         default:
             color = ConsoleColor.Red;
             break;
     }
     PrintResult(result, 50, color);
 }
Пример #4
0
        internal static void PrintResult(PrivateKeyScheme drm)
        {
            string       result = drm.ToString();
            ConsoleColor?color;

            switch (drm)
            {
            case PrivateKeyScheme.None:
            case PrivateKeyScheme.KoboNone:
                color = null;
                break;

            case PrivateKeyScheme.Adept:
            case PrivateKeyScheme.Kobo:
                color = ConsoleColor.Green;
                break;

            default:
                color = ConsoleColor.Red;
                break;
            }
            PrintResult(result, 50, color);
        }