mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-05 21:17:14 -05:00
parent
70b5832dff
commit
80e2d55999
|
|
@ -964,19 +964,23 @@ private void ClickQR(object sender, EventArgs e)
|
|||
{
|
||||
if (ModifierKeys == Keys.Alt)
|
||||
{
|
||||
if (Clipboard.ContainsText())
|
||||
ClickShowdownImportPKM(sender, e);
|
||||
else
|
||||
ImportQRToTabs();
|
||||
string url = Clipboard.GetText();
|
||||
if (!string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
if (!url.StartsWith("http") || url.Contains('\n'))
|
||||
ClickShowdownImportPKM(sender, e);
|
||||
else
|
||||
ImportQRToTabs(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
ExportQRFromTabs();
|
||||
ExportQRFromTabs();
|
||||
}
|
||||
|
||||
private void ImportQRToTabs()
|
||||
private void ImportQRToTabs(string url)
|
||||
{
|
||||
// Fetch data from QR code...
|
||||
byte[] ekx = QR.GetQRData();
|
||||
byte[] ekx = QR.GetQRData(url);
|
||||
if (ekx == null)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -80,12 +80,9 @@ private void PB_QR_Click(object sender, EventArgs e)
|
|||
private const string QR6PathBad = "null/#"; // prefix to prevent URL from loading
|
||||
private const string QR6Path = @"http://lunarcookies.github.io/b1s1.html#";
|
||||
|
||||
internal static byte[] GetQRData()
|
||||
internal static byte[] GetQRData(string address)
|
||||
{
|
||||
// Fetch data from QR code...
|
||||
string address;
|
||||
try { address = Clipboard.GetText(); }
|
||||
catch { WinFormsUtil.Alert("No text (url) in clipboard."); return null; }
|
||||
try { if (address.Length < 4 || address.Substring(0, 3) != "htt") { WinFormsUtil.Alert("Clipboard text is not a valid URL:", address); return null; } }
|
||||
catch { WinFormsUtil.Alert("Clipboard text is not a valid URL:", address); return null; }
|
||||
string webURL = "http://api.qrserver.com/v1/read-qr-code/?fileurl=" + HttpUtility.UrlEncode(address);
|
||||
|
|
|
|||
|
|
@ -296,9 +296,15 @@ private bool IsSpecialWonderCard(MysteryGift g)
|
|||
private void ClickQR(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys == Keys.Alt)
|
||||
ImportQRToView();
|
||||
else
|
||||
ExportQRFromView();
|
||||
{
|
||||
string url = Clipboard.GetText();
|
||||
if (!string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
ImportQRToView(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ExportQRFromView();
|
||||
}
|
||||
private void ExportQRFromView()
|
||||
{
|
||||
|
|
@ -322,9 +328,9 @@ private void ExportQRFromView()
|
|||
|
||||
new QR(qr, PB_Preview.Image, null, desc + "PKHeX Wonder Card @ ProjectPokemon.org").ShowDialog();
|
||||
}
|
||||
private void ImportQRToView()
|
||||
private void ImportQRToView(string url)
|
||||
{
|
||||
byte[] data = QR.GetQRData();
|
||||
byte[] data = QR.GetQRData(url);
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user