积极答复者
以下的那段话是什么意思?可否解释一下呢?看不懂。

问题
-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace OmRonPLCFCS
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string fcsConvert(string str)
{
byte[] _byt;
int m = 0;
_byt = System.Text.ASCIIEncoding.ASCII.GetBytes(str);
for (int i = 0; i < str.Length; i++) m = m ^ _byt[i];
string ff = Convert.ToString(m, 16);
byte[] _bty = System.Text.ASCIIEncoding.ASCII.GetBytes(ff);
for (int n = 0; n < ff.Length; n++)
{
if (_bty[n] >= 97) _bty[n] -= 32; //大小写转换
}
ff = System.Text.ASCIIEncoding.ASCII.GetString(_bty);
if (ff.Length <= 1) return ff = "0" + ff;
else
return ff;
}
private void button1_Click(object sender, EventArgs e)
{
if (!rdbR.Checked && !rdbW.Checked) { MessageBox.Show("请选择一种计算"); return; }
label1.Text = ((rdbR.Checked && !rdbW.Checked) ? textBox1.Text : textBox2.Text)
+ fcsConvert((rdbR.Checked && !rdbW.Checked) ? textBox1.Text : textBox2.Text) + "*";
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void rdbW_CheckedChanged(object sender, EventArgs e)
{
}
}
}
static string Chr(int asciiCode)
{
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
byte[] byteArray = new byte[] { (byte)asciiCode };
string strCharacter = asciiEncoding.GetString(byteArray);
return (strCharacter);
}
//生成一个写W区一个点的FINS命令
string Write_wr(uint add,uint bit, uint val)
{
string addr = add.ToString("X4");
string bitr = bit.ToString("X2");
string FINS = "@00FA000000000" + "0102" + "31" + addr + bitr + "0001";
if (val > 0) FINS = FINS + "01";
else
FINS = FINS + "00";
return FINS + fcsConvert(FINS) + "*" + Chr(13);
}
答案
-
Hi 幽灵魔君,
感谢你在MSDN论坛发帖。
这个代码你遇到什么问题吗?你可以把问题贴出来,我们可以根据出错的信息来解决问题。这样可以更快的解决问题。当然如果你的问题被解决, 也希望你能标记有用的回复作为答案,这样会帮助遇到相同问题的人。
根据你的代码,功能应该是把输入的信息,进行一定的转换转换,然后在输出,有点像加密的过程。代码我没有运行成功
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- 已标记为答案 绿绿山水 2017年5月25日 11:08
全部回复
-
Hi 幽灵魔君,
感谢你在MSDN论坛发帖。
这个代码你遇到什么问题吗?你可以把问题贴出来,我们可以根据出错的信息来解决问题。这样可以更快的解决问题。当然如果你的问题被解决, 也希望你能标记有用的回复作为答案,这样会帮助遇到相同问题的人。
根据你的代码,功能应该是把输入的信息,进行一定的转换转换,然后在输出,有点像加密的过程。代码我没有运行成功
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- 已标记为答案 绿绿山水 2017年5月25日 11:08
-
Hi 绿绿山水,
这种翻译的工作,根据MSDN论坛规则,我们是不给予支持。如果你在开发过程中遇到什么问题,请提供错误的信息。
感谢你对MSDN的支持。
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.