mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-26 18:15:43 -05:00
QR handling for multiple QR codes in same img
This commit is contained in:
@@ -1567,8 +1567,11 @@ private void clickQR(object sender, EventArgs e)
|
||||
System.Net.HttpWebResponse httpWebReponse = (System.Net.HttpWebResponse)httpWebRequest.GetResponse();
|
||||
var reader = new StreamReader(httpWebReponse.GetResponseStream());
|
||||
string data = reader.ReadToEnd();
|
||||
string pkstr = data.Substring(data.IndexOf("#") + 1).Replace("\",\"error\":null}]}]", "");
|
||||
pkstr = pkstr.Replace("\\", "");
|
||||
// Quickly convert the json response to a data string
|
||||
string pkstr = data.Substring(data.IndexOf("#") + 1); // Trim intro
|
||||
pkstr = pkstr.Substring(0, pkstr.IndexOf("\",\"error\":null}]}]")); // Trim outro
|
||||
if (pkstr.Contains("nQR-Code:")) pkstr = pkstr.Substring(0, pkstr.IndexOf("nQR-Code:")); // Remove multiple QR codes in same image
|
||||
pkstr = pkstr.Replace("\\", ""); // Rectify response
|
||||
|
||||
byte[] ekx;
|
||||
try { ekx = Convert.FromBase64String(pkstr); }
|
||||
@@ -1582,11 +1585,7 @@ private void clickQR(object sender, EventArgs e)
|
||||
else Util.Alert("Invalid checksum in QR data.");
|
||||
} catch { Util.Alert("Error loading decrypted data"); }
|
||||
}
|
||||
catch // (Exception e)
|
||||
{
|
||||
Util.Alert("Unable to connect to the internet to decode QR code.");
|
||||
}
|
||||
return;
|
||||
catch { Util.Alert("Unable to connect to the internet to decode QR code."); }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user