我有一个关于如何对文本文件进行排序的问题。我有一个srec
文件,我需要在发送之前对其进行排序COM1
。因此,在打开期间或发送之前,我需要对文件进行排序。
这是我的srec
文件的示例:
S2140338BE0E0606510004008D15FE915115FE9191CC S2140338CE04008D15FE9006010242C78C0AB79C04AF S2140338DE008D15FE91D6C78C0AB79C04088D1D0065 S2130338EE1A16270704088D1D001A0CC78C11190C
S20C038E880000000000000D23AA
S2100202C000033403000336C3000338DBDF S2140347C0045C3F0510060504008D15FEFC1304006B S2140347D08D15FEFD060104008D15FE80068304007C S2140347E08D15FE821304008D15FE8806FF04008DCA S2140347F015FE8906FF04008D15FE8E060104008D46
这是源代码:
StringList list = new StringList().FromFile(appfile.FileName);
// Read file and put it in a list
foreach (String line in list)
{
serialPort1.Write(line);
}
MessageBox.Show("Bootfile and Applicationfile are send succesfully.");