資源簡(jiǎn)介
通過C#實(shí)現(xiàn)串口通信,里面的代碼展示了如何監(jiān)聽計(jì)算機(jī)中的串口,解析數(shù)據(jù)或者發(fā)送數(shù)據(jù),做串口開發(fā)的可以參考
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Drawing;
using?System.Windows.Forms;
using?System.Reflection;
namespace?PCComm
{
????partial?class?AboutBox?:?Form
????{
????????public?AboutBox()
????????{
????????????InitializeComponent();
????????????//??Initialize?the?AboutBox?to?display?the?product?information?from?the?assembly?information.
????????????//??Change?assembly?information?settings?for?your?application?through?either:
????????????//??-?Project->Properties->Application->Assembly?Information
????????????//??-?AssemblyInfo.cs
????????????this.Text?=?String.Format(“About?{0}“?Assemblytitle);
????????????this.labelProductName.Text?=?AssemblyProduct;
????????????this.labelVersion.Text?=?String.Format(“Version?{0}“?AssemblyVersion);
????????????this.labelCopyright.Text?=?AssemblyCopyright;
????????????this.labelCompanyName.Text?=?AssemblyCompany;
????????????this.textBoxDescription.Text?=?AssemblyDescription;
????????}
????????#region?Assembly?Attribute?Accessors
????????public?string?Assemblytitle
????????{
????????????get
????????????{
????????????????//?Get?all?title?attributes?on?this?assembly
????????????????object[]?attributes?=?Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblytitleAttribute)?false);
????????????????//?If?there?is?at?least?one?title?attribute
????????????????if?(attributes.Length?>?0)
????????????????{
????????????????????//?Select?the?first?one
????????????????????AssemblytitleAttribute?titleAttribute?=?(AssemblytitleAttribute)attributes[0];
????????????????????//?If?it?is?not?an?empty?string?return?it
????????????????????if?(titleAttribute.title?!=?““)
????????????????????????return?titleAttribute.title;
????????????????}
????????????????//?If?there?was?no?title?attribute?or?if?the?title?attribute?was?the?empty?string?return?the?.exe?name
????????????????return?System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Codebase);
????????????}
????????}
????????public?string?AssemblyVersion
????????{
????????????get
????????????{
????????????????return?Assembly.GetExecutingAssembly().GetName().Version.ToString();
????????????}
????????}
????????public?string?AssemblyDescription
????????{
????????????get
????????????{
????????????????//?Get?all?Description?attributes?on?this?assembly
????????????????object[]?attributes?=?Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute)?false);
????????????????//?If?there?aren‘t?any?Description?attributes?return?an?empty?string
????????????????if?(attributes.Length?==?0)
????????????????????return?““;
????????????????//?If?there?is?a?Description?attribute?return?its?value
????????????????return?((AssemblyDescriptionAttribute)attributes[0]).Description;
????????????}
????????}
????????public?string?AssemblyProduct
????????{
????????????get
????????????{
????????????????//?Get?all?P
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????4884??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\AboutBox.cs
?????文件??????10533??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\AboutBox.Designer.cs
?????文件??????49720??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\AboutBox.resx
?????文件???????1276??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\app.config
?????文件??????13851??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\CommunicationManager.cs
?????文件???????3967??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\frmMain.cs
?????文件??????31481??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\frmMain.Designer.cs
?????文件??????15028??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\frmMain.resx
?????文件????????475??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Program.cs
?????文件???????1352??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\AssemblyInfo.cs
?????文件???????3086??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\Resources.Designer.cs
?????文件???????6197??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\Resources.resx
?????文件???????3309??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\Settings.Designer.cs
?????文件????????927??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\Settings.settings
?????文件???????3774??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Resources\serial.ico
?????文件???????3899??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\SerialPortCommunication.csproj
?????文件???????1255??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Settings.cs
?????文件????????958??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication.sln
????..A..H.?????17408??2011-11-28?01:28??SerialPort-master\SerialPort-master\Backup\SerialPortCommunication.suo
????.......????????50??2011-11-28?01:28??SerialPort-master\SerialPort-master\README
????.......??????4884??2011-11-28?01:28??SerialPort-master\SerialPort-master\SerialPortCommunication\AboutBox.cs
????.......?????10533??2011-11-28?01:28??SerialPort-master\SerialPort-master\SerialPortCommunication\AboutBox.Designer.cs
????.......?????49720??2011-11-28?01:28??SerialPort-master\SerialPort-master\SerialPortCommunication\AboutBox.resx
????.......??????1276??2011-11-28?01:28??SerialPort-master\SerialPort-master\SerialPortCommunication\app.config
?????文件???????1276??2011-11-28?01:28??SerialPort-master\SerialPort-master\SerialPortCommunication\bin\Release\SerialPortCommunication.exe.config
?????文件??????11608??2015-03-30?15:03??SerialPort-master\SerialPort-master\SerialPortCommunication\bin\Release\SerialPortCommunication.vshost.exe
?????文件???????1276??2011-11-28?01:28??SerialPort-master\SerialPort-master\SerialPortCommunication\bin\Release\SerialPortCommunication.vshost.exe.config
?????文件????????490??2010-03-17?22:39??SerialPort-master\SerialPort-master\SerialPortCommunication\bin\Release\SerialPortCommunication.vshost.exe.manifest
????.......?????13851??2011-11-28?01:28??SerialPort-master\SerialPort-master\SerialPortCommunication\CommunicationManager.cs
????.......??????3967??2011-11-28?01:28??SerialPort-master\SerialPort-master\SerialPortCommunication\frmMain.cs
............此處省略42個(gè)文件信息
評(píng)論
共有 條評(píng)論