//[DisableCors] public string Post([FromBody] Teste img) { try { ////QRCoder.QRCodeData s = new QRCoder.QRCodeData(); //QRCoder.QRCodeData s = new QRCoder.QRCodeData(Convert.FromBase64String(img.img),QRCoder.QRCodeData.Compression.Uncompressed); //var b=s.GetRawData(QRCoder.QRCodeData.Compression.Uncompressed); //var tes = Genesis.QRCodeLib.QRDecoder.ByteArrayToStr(b); //Genesis.QRCodeLib.QRDecoder q = new Genesis.QRCodeLib.QRDecoder(); //var matrix = q.ImageDecoder(img.img.Base64StringToBitmap()); //var text = Genesis.QRCodeLib.QRDecoder.QRCodeResult(matrix); var model = new ValidaPcModel() { ComputerName = "Windows NT 10.0", Date = DateTime.Now, //IP = ip, Id = Guid.NewGuid(), }; var text = Newtonsoft.Json.JsonConvert.SerializeObject(model); return(text); } catch (Exception ex) { return(ex.ToString()); } }
// GET: api/Validate public ValidaPcModel Get() { var ua = Request.Headers.GetValues("User-Agent").ToString(); var match = Regex.Match(ua, @"(.*?) \((?'plataforma'.*?)\) "); var ip = "";//Request..HttpContext.Connection.RemoteIpAddress.to var model = new ValidaPcModel() { ComputerName = match.Groups["plataforma"].Value.Split(';')[0], Date = DateTime.Now, IP = ip, Id = Guid.NewGuid(), }; keys[model.Id] = ""; return(model); }