예제 #1
0
파일: Form1.cs 프로젝트: hermitdash/CDNX
        private void dlBut_Click(object sender, EventArgs e)
        {
            StatusWrite("Starting...");

            //Sanitize GUI inputs
            outText.Text = "";
            string version = "";

            if (!Utils.IsValidTid(tidText.Text))
            {
                WriteLine("Invalid TID!");
                return;
            }
            if (!Utils.IsValidVersion(verText.Text))
            {
                WriteLine("Invalid version!");
                return;
            }

            //Check if appropriate settings are set
            if (
                INIFile.Read("keys", "kekseed") == string.Empty ||
                INIFile.Read("keys", "keyseed") == string.Empty ||
                INIFile.Read("keys", "akaeksrc") == string.Empty ||
                INIFile.Read("keys", "okaeksrc") == string.Empty ||
                INIFile.Read("keys", "skaeksrc") == string.Empty ||
                INIFile.Read("keys", "headkey") == string.Empty
                )
            {
                MessageBox.Show("Please fill in all seeds!");
                return;
            }

            //if version string was in decimal format, convert
            if (Regex.Match(verText.Text, @"[0-9]\.[0-9]\.[0-9]\.[0-9]*").Success)
            {
                var v = verText.Text.Split('.');
                version = ((Convert.ToUInt32(v[0]) << 26) | (Convert.ToUInt32(v[1]) << 20) | (Convert.ToUInt32(v[2]) << 16) | Convert.ToUInt32(v[3])).ToString();
            }
            else
            {
                version = verText.Text;
            }

            new Thread(new ThreadStart(() => { downloadContent(tidText.Text, version); })).Start();
        }
예제 #2
0
파일: Keys.cs 프로젝트: hermitdash/CDNX
        private void saveKeysBut_Click(object sender, EventArgs e)
        {
            int i = 0;

            foreach (var txt in mkTxts)
            {
                INIFile.Write("keys", "MK" + i.ToString("D2"), txt.Text);
                i++;
            }
            INIFile.Write("keys", "keyseed", keySrcTxt.Text);
            INIFile.Write("keys", "kekseed", kekSrcTxt.Text);
            INIFile.Write("keys", "akaeksrc", akaekTxt.Text);
            INIFile.Write("keys", "okaeksrc", okaekTxt.Text);
            INIFile.Write("keys", "skaeksrc", skaekTxt.Text);
            INIFile.Write("keys", "headkey", headKeyText.Text);
            Close();
        }
예제 #3
0
 public static string GetCdnUrl()
 {
     return(string.Format(Properties.Resources.CDNUrl, INIFile.Read("settings", "eid")));
 }
예제 #4
0
파일: HTTP.cs 프로젝트: hermitdash/CDNX
        public static WebResponse Request(string method, string url)
        {
            X509Certificate2 cert    = new X509Certificate2(INIFile.Read("settings", "cert"), "switch");
            HttpWebRequest   request = (HttpWebRequest)WebRequest.Create(url);

            request.ClientCertificates.Add(cert);
            request.UserAgent = string.Format("NintendoSDK Firmware/{0} (platform:NX; did:{1}; eid:{2})", INIFile.Read("settings", "firmver"), INIFile.Read("settings", "did"), INIFile.Read("settings", "eid"));
            request.Method    = method;
            ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
            if (((HttpWebResponse)request.GetResponse()).StatusCode != HttpStatusCode.OK)
            {
                System.Console.WriteLine("http error"); return(null);
            }
            return(request.GetResponse());
        }