mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 05:28:34 -05:00
Fix past gen qr imports
This commit is contained in:
@@ -96,7 +96,7 @@ internal static byte[] getQRData()
|
||||
if (data.Contains("could not find")) { Util.Alert("Reader could not find QR data in the image."); return null; }
|
||||
if (data.Contains("filetype not supported")) { Util.Alert("Input URL is not valid. Double check that it is an image (jpg/png).", address); return null; }
|
||||
// Quickly convert the json response to a data string
|
||||
const string cap = ",\"error\":null}]}]";
|
||||
const string cap = "\",\"error\":null}]}]";
|
||||
const string intro = "[{\"type\":\"qrcode\",\"symbol\":[{\"seq\":0,\"data\":\"";
|
||||
if (!data.StartsWith(intro))
|
||||
throw new Exception();
|
||||
@@ -115,7 +115,7 @@ internal static byte[] getQRData()
|
||||
return raw.ToList().Where((c, i) => i % 2 == 0).Skip(0x30).Take(0xE8).ToArray();
|
||||
}
|
||||
// All except G7
|
||||
pkstr = data.Substring(data.IndexOf("#", StringComparison.Ordinal) + 1); // Trim URL
|
||||
pkstr = pkstr.Substring(pkstr.IndexOf("#", StringComparison.Ordinal) + 1); // Trim URL
|
||||
pkstr = pkstr.Replace("\\", ""); // Rectify response
|
||||
|
||||
return Convert.FromBase64String(pkstr);
|
||||
|
||||
Reference in New Issue
Block a user