public EshopUtil(TitleDatabase db, X509Certificate2 certificate) { titleDatabase = db; webClient = new WebClient(); certWebClient = new CertificateWebClient(certificate); // client setup ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback += delegate { return(true); }; // TODO SetupWebClient(webClient); SetupWebClient(certWebClient); }
private static async Task DoUpdate(bool titlesWiiU, bool updatesWiiU, bool dlcsWiiU, bool titles3DS, bool updates3DS, bool dlcs3DS) { string keyBagPassword = File.ReadAllLines("ctr-common-1.pass")[0].Trim(); ProgressManager progress = new ProgressManager(); progress.SetTitle("Downloading title metadata ..."); TitleDatabase db = new TitleDatabase(); db.ReadAllDatabaseFiles(); EshopUtil eshopUtil = new EshopUtil(db, "ctr-common-1.p12", keyBagPassword); eshopUtil.SetProgressManager(progress); // Games if (titlesWiiU) { db.AddTitles(await eshopUtil.GetAllTitles(2)); } if (titles3DS) { db.AddTitles(await eshopUtil.GetAllTitles(1)); } // Updates if (updatesWiiU) { db.AddTitles(await eshopUtil.GetAllWiiUUpdates(wiiuUpdateListVersion)); } if (updates3DS) { db.AddTitles(await eshopUtil.GetAll3DSUpdates()); } // DLCs if (dlcsWiiU) { db.AddTitles(await eshopUtil.GetAllDLCsForTitles(db.GetTitleSet(DatabaseJsonType.Games).Titles)); } if (dlcs3DS) { db.AddTitles(await eshopUtil.GetAllDLCsForTitles(db.GetTitleSet(DatabaseJsonType.Games3DS).Titles)); } db.WriteAllDatabaseFiles(); wiiuUpdateListVersion = eshopUtil.NewestWiiUUpdateListVersion; eshopUtil.Dispose(); }
public EshopUtil(TitleDatabase db, string sslKeyBagPath, string keyBagPassword) : this(db, new X509Certificate2(sslKeyBagPath, keyBagPassword)) { }