VAGSuite.ctrlAirmassResult.readIntdatafromfile C# (CSharp) Méthode

readIntdatafromfile() private méthode

private readIntdatafromfile ( string filename, int address, int length ) : int[]
filename string
address int
length int
Résultat int[]
        private int[] readIntdatafromfile(string filename, int address, int length)
        {
            int[] retval = new int[length / 2];
            try
            {
                FileStream fsi1 = File.OpenRead(filename);
                while (address > fsi1.Length) address -= (int)fsi1.Length;
                BinaryReader br1 = new BinaryReader(fsi1);
                fsi1.Position = address;
                string temp = string.Empty;
                int j = 0;
                for (int i = 0; i < length; i += 2)
                {
                    byte b1 = br1.ReadByte();
                    byte b2 = br1.ReadByte();
                    int value = Convert.ToInt32(b1) + Convert.ToInt32(b2) * 256; // LoHi
                    if (_ECUType.Contains("EDC16"))
                    {
                        value = Convert.ToInt32(b1) * 256 + Convert.ToInt32(b2); // HiLo
                    }
                    retval.SetValue(value, j++);
                }
                fsi1.Flush();
                br1.Close();
                fsi1.Close();
                fsi1.Dispose();
            }
            catch (Exception E)
            {
                Console.WriteLine(E.Message);
            }
            return retval;
        }