从一个盒子到另一个盒子 [英] From one box to another
问题描述
我想要一个程序,如果它在一个文本框中读取01,在另一个文本框中它将打印A,如果是02,它将打印B,如果可能,我希望它是可逆的,基本上我自己的自制翻译,如果你愿意,任何帮助将不胜感激。
编辑:
我想要它进行文本编辑项目我正在工作
基本上我有一个组合框,它将成为我想要的地址的门户
,对于这个例子,我希望它从0x2C840A读取到0x02C8435并沿途获取十六进制值并将其转换为文本。
这是我现在所拥有的基本形状
我的尝试:
< pre> BinaryReader br = new BinaryReader(File.OpenRead(ofd.FileName));
string hexValues = null;
for(int v = 0x2C840A; v< = 0x02C8435; v ++)
{
br.BaseStream.Position = v;
hexValues + = br.ReadByte()。ToString(X2);
if(Scriptbox.Text ==Test Message)Hexbox.Text =(hexValues);
你' d创建一个包含01,02等的列表和另一个包含A,B等的列表。
翻译时从01到A:
outputBox.Text = list2 [list1.IndexOf(inputBox.Text)]
向后翻译即。从D到04:
outputBox.Text = list1 [list2.IndexOf(inputBox.Text)]
说明:
list1包含01,02,03,04,05等
list2包含A,B ,C,D,E等
从例如转换时。 01到A:
•在list1中获取其索引
•将outputBox.Text设置为list2中相同索引处的项目。 / BLOCKQUOTE>
I want a program that say if it read "01" in one textbox, in another textbox it would print "A" and if "02", it would print "B" and if possible I would like it to be reversible, basically my own homemade translator if you will, any help would be appreciated.
EDIT:
I was wanting it for a text editing project I was working on
basically I have a combobox that will be my portal to the address I want
and for this example I want it to read from 0x2C840A to 0x02C8435 and get the hex values along the way and turn it into text.
This is the basic shape of what I have right now
What I have tried:
<pre>BinaryReader br = new BinaryReader(File.OpenRead(ofd.FileName)); string hexValues = null; for (int v = 0x2C840A; v <= 0x02C8435; v++) { br.BaseStream.Position = v; hexValues += br.ReadByte().ToString("X2"); if (Scriptbox.Text == "Test Message") Hexbox.Text = (hexValues);解决方案You'd create a list containing 01, 02 etc and another list containing A, B etc.
When translating forwards ie from 01 to A:
outputBox.Text = list2[list1.IndexOf(inputBox.Text)]
When translating backwards ie. from D to 04:
outputBox.Text = list1[list2.IndexOf(inputBox.Text)]
Explanation:
list1 contains 01, 02, 03, 04, 05 etc
list2 contains A, B, C, D, E etc
When converting from eg. 01 to A:
• Get its index in list1
• Set outputBox.Text to the item in list2 at the same index.
这篇关于从一个盒子到另一个盒子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!