VAGSuite.EDC15P6FileParser.CheckCodeBlock C# (CSharp) Méthode

CheckCodeBlock() private méthode

private CheckCodeBlock ( int offset, byte allBytes, SymbolCollection newSymbols, List newCodeBlocks ) : int
offset int
allBytes byte
newSymbols SymbolCollection
newCodeBlocks List
Résultat int
        private int CheckCodeBlock(int offset, byte[] allBytes, SymbolCollection newSymbols, List<CodeBlock> newCodeBlocks)
        {
            int codeBlockID = 0;
            try
            {
                int extraoffset = 0x0c00;
                int endOfTable = Convert.ToInt32(allBytes[offset + extraoffset]) + Convert.ToInt32(allBytes[offset + extraoffset + 1]) * 256 + offset;
                int codeBlockAddress = endOfTable + 44;// Convert.ToInt32(allBytes[offset + extraoffset + 2]) + Convert.ToInt32(allBytes[offset + extraoffset + 3]) * 256 + offset;
                if (endOfTable == offset + 0xC3C3) return 0;
                codeBlockID = Convert.ToInt32(allBytes[codeBlockAddress]) + Convert.ToInt32(allBytes[codeBlockAddress + 1]) * 256;

                foreach (CodeBlock cb in newCodeBlocks)
                {
                    if (cb.StartAddress <= codeBlockAddress && cb.EndAddress >= codeBlockAddress)
                    {
                        cb.CodeID = codeBlockID;
                        cb.AddressID = codeBlockAddress;
                    }
                }
            }
            catch (Exception)
            {
            }
            return codeBlockID;
        }