微信图片解决方法-windows版的dat文件
发布时间:2021-01-04 07:15 所属栏目:52 来源:网络整理
导读: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 (编辑:ASP站长网) |
相关内容
网友评论
推荐文章
热点阅读