从Windows窗体中的Hexa转换构建的图像 [英] built Image from Hexa Conversion in Windows Form

查看:60
本文介绍了从Windows窗体中的Hexa转换构建的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请指导我,我有ascii形式的数据。

首先我需要转换为hexa然后从hexa值生成图像.png



这里是ascii形式的值

 $$ ,,,, 47, 80808080807080807080908080808080A09090909080908090909090A0909090A09090909090A0809090A0909090A0A0A09090A0A09090808080808080707080807080808070807070708070706070607050606060606050606070606060606070607070706070606070707070707080807080808080807070809080808080808080808090809 * 





///////////暗示

$$ ,,, ,47,标题

*< cr>< lf>为页脚

解决方案
,,,, 47,070807080808070708090708080808080808080A0908080809090809080908090808080908090809090A0809090909090909090A0A090A090B0B090A0909080909090A090909090A0A0A090A0A0A090A09090A0A0A0A0A0A0A0A090B0A0A0A0C0B090A0C0B0A090A0A0B090A090A0A0A0A0B0A0B0A0909090A0A090A090A09090909080909080808090C0A09090908080808090908080808070706070707070706070607070706070708070808070607070707080707070708080708080808090808080808080708080908080809080908080809080807080808080808090808080808090808070808090909080908090808080909090909090A090A0A0A090908080809090909090909080909090909080908090908080809090808080807080709080807070607080807080807070805050607060605060607060606070606060606080707060707080707070706070708080807080707080807080808080808080809080808080908080808080708080808080808080708080808080807080807080908080808080A09090909080908090909090A0909090A09090909090A0809090A0909090A0A0A09090A0A09090808080808080707080807080808070807070708070706070607050606060606050 606070606060606070607070706070606070707070708080808080808080807070809080808080808080808090809 *





///////////提示


< blockquote> ,,,, 47,For header

*< cr>< lf>对于页脚


您可以使用 int.Parse 连续十六进制数字对的方法,例如:

  //    
// 读取文件内容(忽略页眉和页脚)
// 进入字符串text
//
// 创建一个足以容纳二进制值的数组
int size = text.Length / 2 ;
int [] binary = new int < /跨度> [大小];
for int i = 0 ; i < size; i ++)
{
string pair = text.Substring(i * 2 2 );
int val = int .Parse(pair,NumberStyles.HexNumber);
binary [i] = val;
}



您现在拥有数据二进制内容的副本。


Please Guide me i have data which is in ascii form.
First i need to convert into hexa then from hexa values generate image in .png

here are values which are in ascii form

$$,,,,47,070807080808070708090708080808080808080A0908080809090809080908090808080908090809090A0809090909090909090A0A090A090B0B090A0909080909090A090909090A0A0A090A0A0A090A09090A0A0A0A0A0A0A0A090B0A0A0A0C0B090A0C0B0A090A0A0B090A090A0A0A0A0B0A0B0A0909090A0A090A090A09090909080909080808090C0A09090908080808090908080808070706070707070706070607070706070708070808070607070707080707070708080708080808090808080808080708080908080809080908080809080807080808080808090808080808090808070808090909080908090808080909090909090A090A0A0A090908080809090909090909080909090909080908090908080809090808080807080709080807070607080807080807070805050607060605060607060606070606060606080707060707080707070706070708080807080707080807080808080808080809080808080908080808080708080808080808080708080808080807080807080908080808080A09090909080908090909090A0909090A09090909090A0809090A0909090A0A0A09090A0A09090808080808080707080807080808070807070708070706070607050606060606050606070606060606070607070706070606070707070707080807080808080807070809080808080808080808090809*



///////////hint
$$,,,,47, For header
*<cr><lf> For footer

解决方案

,,,,47,070807080808070708090708080808080808080A0908080809090809080908090808080908090809090A0809090909090909090A0A090A090B0B090A0909080909090A090909090A0A0A090A0A0A090A09090A0A0A0A0A0A0A0A090B0A0A0A0C0B090A0C0B0A090A0A0B090A090A0A0A0A0B0A0B0A0909090A0A090A090A09090909080909080808090C0A09090908080808090908080808070706070707070706070607070706070708070808070607070707080707070708080708080808090808080808080708080908080809080908080809080807080808080808090808080808090808070808090909080908090808080909090909090A090A0A0A090908080809090909090909080909090909080908090908080809090808080807080709080807070607080807080807070805050607060605060607060606070606060606080707060707080707070706070708080807080707080807080808080808080809080808080908080808080708080808080808080708080808080807080807080908080808080A09090909080908090909090A0909090A09090909090A0809090A0909090A0A0A09090A0A09090808080808080707080807080808070807070708070706070607050606060606050606070606060606070607070706070606070707070707080807080808080807070809080808080808080808090809*



///////////hint


,,,,47, For header
*<cr><lf> For footer


You can convert this to binary (not hexa, hex is what you see in the file), using the int.Parse method on successive pairs of hex digits, something like:

//
// read the content of the file (ignoring header and footer)
// into the string "text"
//
// create an array large enough to hold the binary values
int size = text.Length / 2;
int[] binary = new int[size];
for (int i = 0; i < size; i++)
{
    string pair = text.Substring(i * 2, 2);
    int val = int.Parse(pair, NumberStyles.HexNumber);
    binary[i] = val;
}


You now have a copy of the binary content of your data.


这篇关于从Windows窗体中的Hexa转换构建的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆