What is the best way to replace some bytes in a byte array??
For instance i have bytesFromServer = listener.Receive(ref groupEP); and i can do Bit
Something i pieced together... Going to test it soon. Credits from How do you convert Byte Array to Hexadecimal String, and vice versa?
public byte[] ReplaceBytes(byte[] src, string replace, string replacewith)
{
string hex = BitConverter.ToString(src);
hex = hex.Replace("-", "");
hex = hex.Replace(replace, replacewith);
int NumberChars = hex.Length;
byte[] bytes = new byte[NumberChars / 2];
for (int i = 0; i < NumberChars; i += 2)
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
return bytes;
}