示例#1
0
        public void CreateEcuVariants(BinaryReader reader, CTFLanguage language)
        {
            ECUVariants.Clear();
            byte[] ecuVariantPool = ReadVariantPool(reader);

            using (BinaryReader poolReader = new BinaryReader(new MemoryStream(ecuVariantPool)))
            {
                for (int ecuVariantIndex = 0; ecuVariantIndex < EcuVariant_EntryCount; ecuVariantIndex++)
                {
                    poolReader.BaseStream.Seek(ecuVariantIndex * EcuVariant_EntrySize, SeekOrigin.Begin);

                    int    entryOffset         = poolReader.ReadInt32();
                    int    entrySize           = poolReader.ReadInt32();
                    ushort poolEntryAttributes = poolReader.ReadUInt16();
                    long   variantBlockAddress = entryOffset + EcuVariant_BlockOffset;

                    ECUVariant variant = new ECUVariant(reader, this, language, variantBlockAddress, entrySize);
                    ECUVariants.Add(variant);
                    // Console.WriteLine($"Variant Entry @ 0x{entryOffset:X} with size 0x{entrySize:X} and CRC {poolEntryAttributes:X8}, abs addr {variantBlockAddress:X8}");

#if DEBUG
                    int resultLimit = 1999;
                    if (ecuVariantIndex >= resultLimit)
                    {
                        Console.WriteLine($"Breaking prematurely to create only {resultLimit} variant(s) (debug)");
                        break;
                    }
#endif
                }
            }
        }
示例#2
0
 /*
  * public string GetDescription()
  * {
  *  return Language.GetString(Description_CTF);
  * }
  */
 public static DTC FindDTCById(string id, ECUVariant variant)
 {
     foreach (DTC dtc in variant.DTCs)
     {
         if (dtc.Qualifier.EndsWith(id))
         {
             return(dtc);
         }
     }
     return(null);
 }