public QRLinkWindow(PedroFileDownload fileData)
        {

            InitializeComponent();
            //PayloadGenerator.Url url2 = new PayloadGenerator.Url("www.google.es");
            PayloadGenerator.Url url = new PayloadGenerator.Url(fileData.Url + @"/index.html");
            //PayloadGenerator.WiFi wifiPayload = new PayloadGenerator.WiFi("MyWiFi-SSID", "MyWiFi-Pass", PayloadGenerator.WiFi.Authentication.WPA);
            QRCodeGenerator.ECCLevel  eccLevel= QRCodeGenerator.ECCLevel.L;
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            //QRCodeData qrCodeData = qrGenerator.CreateQrCode(@fileData.Url+@"\index.html", eccLevel);
            QRCodeData qrCodeData = qrGenerator.CreateQrCode(url.ToString(), eccLevel);
            QRCode qrCode = new QRCode(qrCodeData);
            Bitmap qrCodeBitmap = qrCode.GetGraphic(20, "#000000", "#ffffff");

            ImageSource qrImageSource =ConvertBitmapToBitmapImage(qrCodeBitmap);
            imgQrCode.Source = qrImageSource;
        }
Esempio n. 2
0
 public void ModifyHtml(PedroFileDownload pfd)
 {
     XmlDocument doc = new XmlDocument();
     doc.Load(pfd.Path +  @"\index.html");
     String xPathSentence = "/html/body/a[@id='btnDownloadId']";
     XmlNode htmlRoot = doc.DocumentElement;
     XmlNode button = doc.ChildNodes[0]["body"]["a"];
     if (button != null)
     {
         XmlAttribute href = doc.CreateAttribute("href");
         XmlAttribute download = doc.CreateAttribute("download");
         href.Value = @"http://" + pfd.Url + @"/" + pfd.Filename;
         download.Value = pfd.Filename;
         button.Attributes.Append(href);
         button.Attributes.Append(download);
     }
     doc.Save(pfd.Path + @"/index.html");
     
 }
Esempio n. 3
0
 public PedroFileDownload CreateLink(String file, String filename)
 {
     PedroFileDownload data;
     nTmpFloder++;
     Directory.CreateDirectory(floderPath + @"\tmp" + nTmpFloder);
     File.Copy(file, floderPath + @"\tmp" + nTmpFloder + @"\" + filename);
     File.Copy(INDEXHTMLPATH, floderPath + @"\tmp" + nTmpFloder + @"\index.html");
     String uri = netTool.getLocalWlanAdress() + ":" + this._port + @"/tmp" + nTmpFloder;
     data = new PedroFileDownload(floderPath + @"\tmp" + nTmpFloder, filename, uri);
     ModifyHtml(data);
     return data;
 }