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."); } }
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."); } }
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); }
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); }