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()); }
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."; }
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."; }
public string GetTextDump() { return(InternalCodeplug?.GetTextDump() ?? "" + ExternalCodeplug?.GetTextDump() ?? ""); }