Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            long _off  = long.Parse(textBox6.Text.Trim());
            long _size = long.Parse(textBox7.Text.Trim());

            byte[] data = dex.GetBytes(_off, _size);
            textBox5.Text = Byter.ToHexStr(data);
        }
Exemple #2
0
        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            string hexStr = (sender as TextBox).Text.Trim().Replace(" ", "");

            byte[] data = Byter.HexToBytes(hexStr); // 解析16进制数据为byte

            Byter byter = new Byter(data);          // 数据转码

            textBox4.Text = checkBox1.Checked ? byter.ToString() : byter.ToString2();
        }
Exemple #3
0
        /// <summary>
        /// 获取Field对应数据的所有Byter解析信息
        /// </summary>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        public string GetField_ByterStr(string fieldName)
        {
            byte[] data  = GetFieldBytes(fieldName); // 获取field对应数据
            Byter  byter = new Byter(data);          // 对数据进行解析

            if (fieldName.StartsWith("@Ex_"))
            {
                return(byter.ToString2());
            }
            return(byter.ToString());
        }
Exemple #4
0
        public string Test(string filedName)
        {
            byte[] data  = GetFieldBytes(filedName);
            Byter  byter = new Byter(data);

            //byte[] B = new byte[] { 0x02, 0xB0 };
            //string B_Str = Byter.ToHexStr(B);
            //string LEB128_B_Str = Byter.To_LEB128_HexStr(B);
            //long L = Byter.To_LEB128_Long(B);

            return(byter.ToString());
        }
Exemple #5
0
        /// <summary>
        /// 载入所有StringId数据。
        /// string_ids_off指向字符串索引信息表起始地址,每个索引项4个字节;
        /// 索引项中存储字符串的起始地址,直接读取
        /// </summary>
        private void LoadStringIds()
        {
            long off   = GetField_Long("string_ids_off");   // string_ids信息的起始地址
            long count = GetField_Long("string_ids_size");  // string_id 数目

            for (int i = 0; i < count; i++)
            {
                byte[] data        = GetBytes(off + i * 4, 4); // 获取对应string的偏移地址
                long   StringIndex = Byter.To_Long(data);

                string str = GetString(StringIndex + 1);    // 从string对应的偏移地址开始读取字符串
                stringList.Add(str);
            }
        }
Exemple #6
0
        /// <summary>
        /// 从position位置获取字符串
        /// </summary>
        /// <param name="position">起始位置</param>
        /// <returns></returns>
        public string GetString(long position)
        {
            FileIn.Seek(position, SeekOrigin.Begin);         // 定位流至数据块处
            int B = 0;

            List <byte> tmp = new List <byte>();

            while ((B = FileIn.ReadByte()) != 0)            // 一直读取到0
            {
                tmp.Add((byte)B);
            }

            string Str = Byter.ToStr_UTF8(tmp.ToArray());

            return(Str);
        }
Exemple #7
0
 /// <summary>
 /// 获取Field表示的数值
 /// </summary>
 /// <param name="fieldName"></param>
 /// <returns></returns>
 public long GetField_Long(string fieldName)
 {
     byte[] data = GetFieldBytes(fieldName);
     return(Byter.To_Long(data));
 }
Exemple #8
0
 /// <summary>
 /// 获取Field的LEB128字符串形式值
 /// </summary>
 /// <param name="fieldName"></param>
 /// <returns></returns>
 public string GetField_Str_LEB128(string fieldName)
 {
     byte[] data = GetFieldBytes(fieldName);
     return(Byter.To_LEB128_Str(data));
 }
Exemple #9
0
 /// <summary>
 /// 获取Field的字符串形式值
 /// </summary>
 /// <param name="fieldName"></param>
 /// <returns></returns>
 public string GetField_Str(string fieldName)
 {
     byte[] data = GetFieldBytes(fieldName);
     return(Byter.ToStr_UTF8(data));
 }
Exemple #10
0
 /// <summary>
 /// 获取Field的字符串形式值
 /// </summary>
 /// <param name="fieldName"></param>
 /// <returns></returns>
 public string GetField_Str_Hex(string fieldName)
 {
     byte[] data = GetFieldBytes(fieldName);
     return(Byter.ToHexStr(data));
 }