Esempio n. 1
0
 public Codeplug(byte[] codeplugBytes)
 {
     OriginalBytes = codeplugBytes;
     InternalCodeplug.Deserialize(codeplugBytes, 0);
     try
     {
         ExternalCodeplug.Deserialize(codeplugBytes, InternalCodeplug.ExternalCodeplugVector);
     }
     catch (Exception e)
     {
         Status = "Error unpacking external codeplug\r\n" + e.ToString();
         return;
     }
     Status = "Codeplug successfully unpacked.";
 }
Esempio n. 2
0
        public Codeplug(string path)
        {
            var codeplugBytes = File.ReadAllBytes(path);

            OriginalBytes = codeplugBytes;
            InternalCodeplug.Deserialize(codeplugBytes, 0);

            try
            {
                Model = Common.GetModel(InternalCodeplug.Model);

                //466AWA2860_2020-05-28_10-11-17_R08.73_08051d0b020ad8e2ffffffffffffffff.bin
                var fileParts = Path.GetFileNameWithoutExtension(path).Split('_');
                if (fileParts.Length == 5)
                {
                    Firmware    = Common.GetFirmware(decimal.Parse(fileParts[3].Replace("R", "")));
                    FactoryCode = Common.ConvertFromHexString(fileParts[4]);
                    AuthCode.Calculate(this);
                }
            }
            catch (Exception)
            {
            }

            try
            {
                ExternalCodeplug.Deserialize(codeplugBytes, InternalCodeplug.ExternalCodeplugVector);
            }
            catch (Exception e)
            {
                Status = "Error unpacking external codeplug\r\n" + e.ToString();
                return;
            }

            Status = "Codeplug successfully unpacked.";
        }