示例#1
0
 public byte[] Serialize()
 {
     byte[] bytes = new byte[0x8200]; //Total Size of Internal and External EEPROMS.
     InternalCodeplug.Serialize(bytes, 0);
     ExternalCodeplug.Serialize(bytes, InternalCodeplug.ExternalCodeplugVector);
     return(bytes.Take(InternalCodeplug.ExternalCodeplugVector + ExternalCodeplug.ExternalCodeplugSize).ToArray());
 }
示例#2
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.";
 }
示例#3
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.";
        }
示例#4
0
 public string GetTextDump()
 {
     return(InternalCodeplug?.GetTextDump() ?? "" + ExternalCodeplug?.GetTextDump() ?? "");
 }