entity.MetaFuncs.MEStringsSelector.replaceCode C# (CSharp) Method

replaceCode() private static method

private static replaceCode ( byte bytes, byte code, string decode ) : byte[]
bytes byte
code byte
decode string
return byte[]
        private static byte[] replaceCode(byte[] bytes, byte[] code, string decode)
        {
            List<byte> bs = new List<byte>(bytes);
            int change = 0;
            for (int i = 0; i < bytes.Length; i++)
                for (int ii = 0; ii < code.Length; ii++)
                {
                    if (bytes[i + ii] != code[ii])
                        break;
                    // Found
                    if (ii == code.Length - 1)
                    {
                        bs.RemoveRange(i - change, code.Length);
                        bs.InsertRange(i - change, System.Text.Encoding.ASCII.GetBytes(decode));
                        change += (code.Length - System.Text.Encoding.ASCII.GetBytes(decode).Length);
                    }
                }

            return (bs.ToArray());
        }