private HexAddressData[] GetAddressAndData() { List <HexAddressData> retAddressData=new List<HexAddressData>(); string [] strList = File.ReadAllLines(FileName); foreach(string x in strList) { string temp=x.Trim(); if(temp.Substring(7,2)=="00") { HexAddressData hexAddData=new HexAddressData(); // Extract Address hexAddData.Address=Convert.ToUInt32(temp.Substring(3,4),16); // Extract Data List<byte> dataBytes= new List<byte>(); temp=temp.Substring(9); temp=temp.Substring(0,temp.Length-2); int ctr=0; while(ctr < temp.Length) { dataBytes.Add(Convert.ToByte(temp.Substring(ctr,2),16)); ctr+=2; } hexAddData.Data=dataBytes.ToArray(); retAddressData.Add(hexAddData); } } return retAddressData.ToArray(); }
private HexAddressData [] GetAddressAndData() { List <HexAddressData> retAddressData=new List<HexAddressData>(); string [] strList = File.ReadAllLines(FileName); foreach(string x in strList) { string temp=x.Trim(); if(temp.Substring(7,2)=="00") { HexAddressData hexAddData=new HexAddressData(); // Extract Address hexAddData.Address=Convert.ToUInt32(temp.Substring(3,4),16); // Extract Data List<byte> dataBytes= new List<byte>(); temp=temp.Substring(9); temp=temp.Substring(0,temp.Length-2); int ctr=0; while(ctr < temp.Length) { dataBytes.Add(Convert.ToByte(temp.Substring(ctr,2),16)); ctr+=2; } hexAddData.Data=dataBytes.ToArray(); retAddressData.Add(hexAddData); } } return retAddressData.ToArray(); }
public Dictionary<uint,byte[]> GetAddressAndDataDictionary(HexAddressData[] myHexAddDataArray) { Dictionary<uint,byte[]> myDictionary=new Dictionary<uint,byte[]>(); foreach(HexAddressData x in myHexAddDataArray) { myDictionary.Add(x.Address,x.Data); } return myDictionary; }
public bool CheckIfConsecutiveByteExist(HexAddressData [] hexAddData,byte Data,int listCount, int offset) { for(int ctr=offset;ctr<(offset+listCount);ctr++) { foreach(byte x in hexAddData[ctr].Data) { if(x!=Data) return false; } } return true; }