/// <summary> /// Read bytes as a hex string /// </summary> /// <param name="startPosition"></param> /// <param name="size"></param> /// <param name="seperator"></param> /// <returns></returns> public static string ReadInHex(int startPosition, int size = 1, string seperator = "") { ChangePos(ref startPosition); string output = ""; for (int i = 0; i < size; i++) { output += DecHexCalc.decToHex(allofROM[startPosition + i]) + seperator; } return(output); }
/// <summary> /// Read as hex with delimeter. /// </summary> /// <param name="pos"></param> /// <param name="delim">Optional ref value of the index the delimeter is</param> /// <param name="length"></param> /// <param name="seperator">Optional seperator</param> /// <returns></returns> public static string ReadWithDelimAsHex(int pos, int delim, ref int length, string seperator = "") { ChangePos(ref pos); List <byte> b = ReadWithDelim(pos, delim); string output = ""; foreach (byte bb in b) { output += DecHexCalc.decToHex(bb) + seperator; } length = b.Count; return(output); }
public static string ToHexString(List <int> s, string sep = "", int length = 2) { string str = ""; int i = 0; foreach (int ss in s) { str += DecHexCalc.decToHex(ss, length: 4); if (i++ != s.Count - 1) { str += sep; } } return(str); }