예제 #1
0
 public void CatInit()
 {
     CatReg.set_and_check();
     device = GetDevice();
     CatShortCut();
     CatStartUp();
 }
예제 #2
0
 private void wwanfill(int index, deviceJson device)
 {
     lb_wwan_hwid.Text     = device.wwan[index].hwid;
     lb_wwan_driver.Text   = device.wwan[index].driver;
     lb_wwan_modem.Text    = device.wwan[index].modem;
     lb_wwan_firmware.Text = device.wwan[index].firmware;
     lb_wwan_gnss.Text     = device.wwan[index].gnss;
     lb_wwan_ude.Text      = device.wwan[index].ude;
 }
예제 #3
0
        private void infoFillin()
        {
            deviceJson device = CatCore.device;

            if (device != null)
            {
                lb_bios.Text     = device.bios;
                lb_image.Text    = device.image;
                lb_platform.Text = device.platform;
                lb_os.Text       = device.os;
                if (device.wwan.Count() > 0)
                {
                    cb_wwan.Items.Clear();
                    cb_wwan.Items.AddRange(device.wwan.Select(x => x.name).ToArray());
                    cb_wwan.SelectedIndex = 0;
                    wwanfill(cb_wwan.SelectedIndex, device);
                }
                if (device.lan.Count() > 0)
                {
                    cb_lan.Items.Clear();
                    cb_lan.Items.AddRange(device.lan.Select(x => x.name).ToArray());
                    cb_lan.SelectedIndex = 0;
                    lanfill(cb_lan.SelectedIndex, device);
                }
                if (device.wlan.Count() > 0)
                {
                    cb_wlan.Items.Clear();
                    cb_wlan.Items.AddRange(device.wlan.Select(x => x.name).ToArray());
                    cb_wlan.SelectedIndex = 0;
                    wlanfill(cb_wlan.SelectedIndex, device);
                }
                if (device.bt.Count() > 0)
                {
                    cb_bt.Items.Clear();
                    cb_bt.Items.AddRange(device.bt.Select(x => x.name).ToArray());
                    cb_bt.SelectedIndex = 0;
                    btfill(cb_bt.SelectedIndex, device);
                }
                if (device.nfc.Count() > 0 && device.nfc.Select(x => x.name != "NA").FirstOrDefault())
                {
                    cb_proxi.Items.Clear();
                    cb_proxi.Items.AddRange(device.nfc.Select(x => x.name).ToArray());
                    cb_proxi.SelectedIndex = 0;
                    nfcfill(cb_proxi.SelectedIndex, device);
                }
                if (device.rfid.Count() > 0 && device.rfid.Select(x => x.name != "NA").FirstOrDefault())
                {
                    cb_proxi.Items.Clear();
                    cb_proxi.Items.AddRange(device.rfid.Select(x => x.name).ToArray());
                    cb_proxi.SelectedIndex = 0;
                    rfidfill(cb_proxi.SelectedIndex, device);
                }
            }
        }
예제 #4
0
 public static void deviceToJson(deviceJson devicejson, string path_save)
 {
     using (StreamWriter sw = new StreamWriter(path_save, false))
     {
         devicejson.stamp = DateTime.Now.ToString("O");
         var content = JsonConvert.SerializeObject(devicejson);
         sw.WriteLine(content);
         Console.WriteLine($"Output to {path_save}");
         sw.Close();
     }
 }
예제 #5
0
 public static bool catinfoEnroll(deviceJson device)
 {
     try
     {
         cat_server.CAT_info currentinfo = new cat_server.CAT_info();
         deviceRefresh(ref currentinfo, device);
         using (cat_server.lab_server lab_server = new cat_server.lab_server())
         {
             if (CatReg.connect)
             {
                 var serverinfo = (from _uut in lab_server.CAT_info where _uut.SN == device.sn select _uut).FirstOrDefault();
                 if (serverinfo == null)
                 {
                     currentinfo.STATUS                  = CatStatus.uutStatus.STANDBY.ToString();
                     currentinfo.CurrentTask             = CatStatus.taskName.NO_TASK.ToString();
                     currentinfo.LastUsedTime            = DateTime.Now;
                     lab_server.Entry(currentinfo).State = System.Data.Entity.EntityState.Added;
                 }
                 else
                 {
                     lab_server.Entry(serverinfo).State = System.Data.Entity.EntityState.Modified;
                     currentinfo.STATUS       = CatReg.status.ToString();
                     currentinfo.CurrentTask  = CatReg.task_name;
                     currentinfo.LastUsedTime = DateTime.Now;
                     currentinfoCompare(ref serverinfo, currentinfo);
                 }
                 lab_server.SaveChanges();
             }
         }
         Console.WriteLine("enroll finish");
         return(true);
     }
     catch (DbEntityValidationException ex)
     {
         var entityError      = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage);
         var getFullMessage   = string.Join("; ", entityError);
         var exceptionMessage = string.Concat(ex.Message, "errors are: ", getFullMessage);
         //NLog
         Log(exceptionMessage);
         Console.WriteLine(exceptionMessage);
     }
     catch (Exception e)
     {
         Log(e.ToString());
         Console.WriteLine(e.ToString());
     }
     return(false);
 }
예제 #6
0
        public static deviceJson deviceToClass(string path)
        {
            deviceJson jsnObj = null;

            if (File.Exists(path) && path.Contains(".json"))
            {
                StreamReader srd   = new StreamReader(path);
                var          deSer = srd.ReadToEnd();
                jsnObj = JsonConvert.DeserializeObject <deviceJson>(deSer);
            }
            else
            {
                Console.WriteLine("Can't find file or file error");
            }
            return(jsnObj);
        }
예제 #7
0
 private static void deviceRefresh(ref cat_server.CAT_info currentinfo, deviceJson device)
 {
     currentinfo.SN            = device.sn;
     currentinfo.BIOS          = device.bios;
     currentinfo.OS            = device.os;
     currentinfo.Image         = device.image;
     currentinfo.Platform      = device.platform;
     currentinfo.WWAN_Driver   = device.wwan[0].driver;
     currentinfo.WWAN_Firmware = device.wwan[0].firmware;
     currentinfo.WWAN_Modem    = device.wwan[0].modem;
     currentinfo.WWAN_Module   = device.wwan[0].hwid;
     currentinfo.WLAN_Driver   = device.wlan[0].driver;
     currentinfo.WLAN_Module   = device.wlan[0].hwid;
     currentinfo.NIC_Driver    = device.lan[0].driver;
     currentinfo.NIC_Module    = device.lan[0].hwid;
     currentinfo.BT_Driver     = device.bt[0].driver;
     currentinfo.BT_Module     = device.bt[0].hwid;
     currentinfo.NFC_Driver    = device.nfc[0].driver;
     currentinfo.NFC_Module    = device.nfc[0].hwid;
     currentinfo.RFID_Driver   = device.rfid[0].driver;
     currentinfo.RFID_Module   = device.rfid[0].hwid;
     currentinfo.GNSS_Driver   = device.wwan[0].gnss;
 }
예제 #8
0
 private void btfill(int index, deviceJson device)
 {
     lb_bt_hwid.Text   = device.bt[index].hwid;
     lb_bt_driver.Text = device.bt[index].driver;
 }
예제 #9
0
 private void lanfill(int index, deviceJson device)
 {
     lb_lan_hwid.Text   = device.lan[index].hwid;
     lb_lan_driver.Text = device.lan[index].driver;
 }
예제 #10
0
 private void rfidfill(int index, deviceJson device)
 {
     lb_proxi_hwid.Text   = device.rfid[index].hwid;
     lb_proxi_driver.Text = device.rfid[index].driver;
 }
예제 #11
0
 private void nfcfill(int index, deviceJson device)
 {
     lb_proxi_hwid.Text   = device.nfc[index].hwid;
     lb_proxi_driver.Text = device.nfc[index].driver;
 }
예제 #12
0
 public static void enroll(deviceJson device)
 {
 }