Example #1
0
        private string GetHWID(string complete_id)
        {
            string   hwid;
            Encoding encoding = Encoding.GetEncoding("Windows-1252");
            int      baudRate = Comm.GetSerialPort().BaudRate;

            if (complete_id.IndexOf("HW:") != -1)
            {
                LoadingIDFW = false;
                hwid        = complete_id.Substring(complete_id.IndexOf("HW:") + 3, 4);
                string swid = complete_id.Substring(complete_id.IndexOf("SW:") + 3, 4);
                if (((swid == "ffff" && baudRate == 115200) || hwid == "30ff") || hwid == "3000")
                {
                    Loader loader;
                    LoadingIDFW = true;
                    if ((hwid == "30ff" || swid == "ffff") && LoadedFW == FwLoadedNames.BOOTLOADER)
                    {
                        LoadedFW = FwLoadedNames.ID_FW;
                        loader   = new Loader(Comm, "ID-FW.s19", "hidden");
                    }
                    else if (hwid == "30ff" && LoadedFW == FwLoadedNames.ID_FW)
                    {
                        LoadedFW = FwLoadedNames.Plutino;
                        loader   = new Loader(Comm, "ID-FW-Plutino.s19", "hidden");
                    }
                    hwid = "";
                    Comm.Close();
                    Comm.FindAnyHw();
                    LoadingIDFW = false;
                }
                return(hwid);
            }
            hwid = complete_id.Substring(complete_id.IndexOf(" with ID ") + " with ID ".Length, 2);
            return(string.Format("{0:x4}", (encoding.GetBytes(hwid.Substring(0, 1))[0] << 8) | encoding.GetBytes(hwid.Substring(1, 1))[0]));
        }
Example #2
0
 private void Initial_Load(object sender, EventArgs e)
 {
     LoadedFW = FwLoadedNames.BOOTLOADER;
     //! CheckForUpdates();
     Comm.FindAnyHw();
 }