示例#1
0
        private static void DecryptEsd(DecryptOptions options)
        {
            if (string.IsNullOrEmpty(options.CustomKey))
            {
                CryptoKey.LoadKeysFromXml();
            }
            else
            {
                try
                {
                    CryptoKey.UseCustomKey(options.CustomKey);
                }
                catch (FormatException)
                {
                    Console.WriteLine("The key you have specified is not valid. Loading the keys from the XML file instead...");
                    CryptoKey.LoadKeysFromXml();
                }
            }

            foreach (string file in options.EsdFiles)
            {
                if (File.Exists(file))
                {
                    try
                    {
                        using (WimFile wf = new WimFile(file))
                        {
                            wf.DecryptEsd();
                        }
                    }
                    catch (NoValidCryptoKeyException)
                    {
                        Console.WriteLine($"We could not find the correct CryptoKey for \"{file}\".");
                    }
                    catch (UnencryptedImageException)
                    {
                        Console.WriteLine($"You are trying to decrypt \"{file}\", but it is already decrypted.");
                    }
                }
                else
                {
                    Console.WriteLine($"The file \"{file}\" does not exist.");
                }
            }
        }
示例#2
0
 public CliOptions()
 {
     DecryptVerb = new DecryptOptions();
     UpdateVerb  = new UpdateOptions();
 }