加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

微信图片解决方法-windows版的dat文件

发布时间:2020-12-14 05:58:14 所属栏目:Windows 来源:网络整理
导读:public string decodeImg(string filepath) { Dictionarystring,byte[] headers = new Dictionarystring,byte[] { { "jpg",new byte[]{ 0xff,0xd8 }},{ "png",new byte[]{ 0x89,0x50 }},{ "gif",new byte[]{ 0x47,0x49 }},}; for (int i = 0; i 10; i++) { t
public string decodeImg(string filepath)
        {
            Dictionary<string,byte[]> headers = new Dictionary<string,byte[]>
            {
                { "jpg",new byte[]{ 0xff,0xd8 }},{ "png",new byte[]{ 0x89,0x50 }},{ "gif",new byte[]{ 0x47,0x49 }},};
            for (int i = 0; i < 10; i++)
            {
                try
                {
                    byte[] buf = File.ReadAllBytes(filepath);
                    foreach (string encoding in headers.Keys)
                    {
                        byte header_code = headers[encoding][0];
                        byte check_code = headers[encoding][1];
                        byte magic = do_magic(header_code,buf);
                        byte code = (byte)(buf[1] ^ magic);
                        if (check_code == code)
                        {
                            byte[] outbytes = decode(magic,buf);
                            string outpath = filepath.Replace("dat",encoding);
                            File.WriteAllBytes(outpath,outbytes);
                            return outpath;
                        }
                    }
                    break;
                }
                catch (FileNotFoundException ex)
                {
                    Thread.Sleep(1000);
                }
            }
            return null;
        }

微信开发SDK-联系QQ:3209-66311

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读