예제 #1
0
        public static Image GenerateQRCode7(PK7 pk7, int box = 0, int slot = 0, int num_copies = 1)
        {
            byte[] data = QR7.GenerateQRData(pk7, box, slot, num_copies);
            var    msg  = QRMessageUtil.GetMessage(data);

            return(GenerateQRCode(msg, ppm: 4));
        }
예제 #2
0
파일: QR.cs 프로젝트: Rocci1212/PKHeX
 // QR7 Utility
 public static Image GenerateQRCode7(PK7 pk7, int box = 0, int slot = 0, int num_copies = 1)
 {
     byte[] data = QR7.GenerateQRData(pk7, box, slot, num_copies);
     using (var generator = new QRCodeGenerator())
         using (var qr_data = generator.CreateQRCode(data))
             using (var qr_code = new QRCode(qr_data))
                 return(qr_code.GetGraphic(4));
 }
예제 #3
0
    /// <summary>
    /// Gets a QR Message from the input <see cref="PKM"/> data.
    /// </summary>
    /// <param name="pk">Pokémon to encode</param>
    /// <returns>QR Message</returns>
    public static string GetMessage(PKM pk)
    {
        if (pk is PK7 pk7)
        {
            byte[] payload = QR7.GenerateQRData(pk7);
            return(GetMessage(payload));
        }

        var server = GetExploitURLPrefixPKM(pk.Format);
        var data   = pk.EncryptedBoxData;

        return(GetMessageBase64(data, server));
    }
예제 #4
0
        public static string GetQRMessage(PKM pkm)
        {
            if (pkm is PK7 pk7)
            {
                byte[] payload = QR7.GenerateQRData(pk7);
                return(string.Concat(payload.Select(z => (char)z)));
            }

            var    server = GetQRServer(pkm.Format);
            var    data   = pkm.EncryptedBoxData;
            string qrdata = Convert.ToBase64String(data);

            return(server + qrdata);
        }
예제 #5
0
파일: QR.cs 프로젝트: mikemow/PKHeX
        private void updateBoxSlotCopies(object sender, EventArgs e)
        {
            if (pkm == null || pkm.Format != 7)
            {
                throw new ArgumentException("Can't update QR7 if pkm isn't a PK7!");
            }
            var box    = (int)NUD_Box.Value - 1;
            var slot   = (int)NUD_Slot.Value - 1;
            var copies = (int)NUD_Copies.Value;
            var new_qr = QR7.GenerateQRCode7((PK7)pkm, box, slot, copies);

            qr = new_qr;
            SuspendLayout();
            extraText = $" (Box {box+1}, Slot {slot+1}, {copies} cop{(copies > 1 ? "ies" : "y")})";
            RefreshImage();
            ResumeLayout();
        }
예제 #6
0
 // QR7 Utility
 public static Image GenerateQRCode7(PK7 pk7, int box = 0, int slot = 0, int num_copies = 1)
 {
     byte[] data = QR7.GenerateQRData(pk7, box, slot, num_copies);
     return(GenerateQRCode(data, ppm: 4));
 }