예제 #1
0
        internal static string GetStrings(byte[] bys)
        {
            if (bys == null)
            {
                return(null);
            }
            int i      = 0;
            int length = bys.Length;

            char[] Baotou = new char[length];

            unsafe
            {
                fixed(char *bytes = Baotou)
                {
                    while (i < length)
                    {
                        bytes[i] = CoreCode.CodeInt(bys[i]);
                        i++;
                    }
                }
            }

            //while (i < length)
            //{
            //    Baotou[i] = CoreCode.CodeInt(bys[i]);
            //    i++;
            //}

            //for (i = 0; i < length; i++)
            //{
            //    Baotou[i] = CoreCode.CodeInt(bys[i]);
            //}
            return(new string(Baotou));
        }
예제 #2
0
        internal static byte[] GetBytes(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return(null);
            }
            int i      = 0;
            int length = data.Length;

            byte[] Baotou = new byte[length];

            unsafe
            {
                fixed(byte *bytes = Baotou)
                {
                    while (i < length)
                    {
                        bytes[i] = CoreCode.CodeStr(data[i]);
                        i++;
                    }
                }
            }

            //for (i = 0; i < Baotou.Length; i++)
            //{
            //    Baotou[i] = CoreCode.CodeStr(data[i]);
            //}
            return(Baotou);
        }