public bool Login(string url, string user = "******", string pass = "******")
        {
            try
            {
                if (!url.EndsWith("/"))
                {
                    url += "/";
                }

                ConnectResult st = RestJSON.Send <ConnectResult>(URL = url.ToLower(), new ConnectRequest()
                {
                    Login    = user,
                    Password = pass
                });

                if (st.Session == null)
                {
                    Status = "Erro ao Conetar: " + st.Status ?? "?";
                    return(false);
                }

                Session = st.Session;
                Status  = "Equipamento Conectado";
                return(true);
            }
            catch (Exception ex)
            {
                Status = ex.Message;
                return(false);
            }
        }
 public string MergeTemplate(string[] templates, out string info)
 {
     info = "?";
     try
     {
         if (Session == null || templates == null || templates.Length != 3)
         {
             return(null);
         }
         else
         {
             if (URL.StartsWith("https://"))
             {
                 // iDClass
                 TemplateMergeResult tmr = RestJSON.Send <TemplateMergeResult>(URL, new TemplateMergeRequest()
                 {
                     Session   = this.Session,
                     Templates = new string[] { templates[0], templates[1], templates[2] }
                 });
                 info = tmr.Status ?? "OK";
                 return(tmr.Template);
             }
             else
             {
                 List <byte> btRequest = new List <byte>();
                 byte[]      bt1       = Convert.FromBase64String(templates[0]);
                 btRequest.AddRange(bt1);
                 byte[] bt2 = Convert.FromBase64String(templates[1]);
                 btRequest.AddRange(bt2);
                 byte[] bt3 = Convert.FromBase64String(templates[2]);
                 btRequest.AddRange(bt3);
                 StatusResult st = RestJSON.Send <StatusResult>(URL + "template_match.fcgi?session=" + Session + "&size0=" + bt1.Length + "&size1=" + bt2.Length + "&size2=" + bt3.Length, btRequest.ToArray());
                 info = st.Status ?? "OK";
                 return(null);
             }
         }
     }
     catch (Exception ex)
     {
         Status = info = ex.Message;
         return(null);
     }
 }
 public string ExtractTemplate(Bitmap digital, out int quality)
 {
     try
     {
         quality = -1;
         if (Session == null || digital == null)
         {
             return(null);
         }
         else
         {
             TemplateResult tr = RestJSON.Send <TemplateResult>(URL + "template_extract.fcgi?session=" + Session + "&width=" + digital.Width + "&height=" + digital.Height, RestJSON.GetBytes(digital));
             quality = tr.Qualidate;
             return(tr.Template);
         }
     }
     catch (Exception ex)
     {
         quality = -2;
         Status  = ex.Message;
         return(null);
     }
 }