资源简介
实现10路串口数据的采集,显示,解析保存,并能够实时图表显示
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication2
{
public interface IUpdateTxt
{
void Save(string data);
bool Start(string path string flag string header);
void Stop();
}
class UpdateTxt : IUpdateTxt
{
private string path;
private string text;
public void SetPath(string path string Index)
{
DateTime dt = DateTime.Now;
string time = string.Format(“{0:yyyyMMddHHmmssffff}“ dt);
this.path = path + “\\“ + Index + “_“ + time + “.txt“;
FileStream fs1 = new FileStream(this.path FileMode.Create);//创建写入文件
fs1.Close();
}
public void Save(string data)
{
_Save(System.DateTime.Now.ToString() + “;“ + data);
}
private void _Save(string data)
{
if (!save)
{
return;
}
if (path == null)
{
return;
}
StreamWriter sw = new StreamWriter(path true);
sw.WriteLine(data);
sw.Close();
}
private bool save = false;
public bool Start(string path string flag string header)
{
try
{
DateTime dt = DateTime.Now;
string time = string.Format(“{0:yyyyMMddHHmmssffff}“ dt);
this.path = path + “\\“ + flag + “_“ + time + “.txt“;
FileStream fs1 = new FileStream(this.path FileMode.Create);//创建写入文件
fs1.Close();
save = true;
_Save(header);
return save;
}
catch (Exception)
{
save = false;
return save;
}
}
public void Stop()
{
save = false;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 49664 2018-05-29 17:29 WindowsFormsApplication4\.vs\WindowsFormsApplication2\v14\.suo
文件 23552 2018-05-29 15:01 WindowsFormsApplication4\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe
文件 38400 2018-05-29 15:01 WindowsFormsApplication4\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb
文件 22688 2018-05-29 15:37 WindowsFormsApplication4\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe
文件 490 2015-12-02 08:23 WindowsFormsApplication4\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest
文件 2085 2018-05-22 16:57 WindowsFormsApplication4\WindowsFormsApplication2\daterecive.cs
文件 20842 2018-05-29 15:00 WindowsFormsApplication4\WindowsFormsApplication2\Form1.cs
文件 24107 2018-05-23 12:15 WindowsFormsApplication4\WindowsFormsApplication2\Form1.Designer.cs
文件 6189 2018-05-23 12:15 WindowsFormsApplication4\WindowsFormsApplication2\Form1.resx
文件 1452 2018-05-23 12:18 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6944 2018-05-25 17:36 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 2814 2018-05-29 15:38 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt
文件 1012 2018-05-25 14:55 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csproj.GenerateResource.Cache
文件 2210 2018-05-29 15:01 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csprojResolveAssemblyReference.cache
文件 23552 2018-05-29 15:01 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.exe
文件 180 2018-05-25 14:55 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.Form1.resources
文件 38400 2018-05-29 15:01 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.pdb
文件 180 2018-05-25 14:55 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.Properties.Resources.resources
文件 505 2018-05-21 17:52 WindowsFormsApplication4\WindowsFormsApplication2\Program.cs
文件 1356 2018-05-21 17:52 WindowsFormsApplication4\WindowsFormsApplication2\Properties\AssemblyInfo.cs
文件 2861 2018-05-21 17:52 WindowsFormsApplication4\WindowsFormsApplication2\Properties\Resources.Designer.cs
文件 5612 2018-05-21 17:52 WindowsFormsApplication4\WindowsFormsApplication2\Properties\Resources.resx
文件 1111 2018-05-21 17:52 WindowsFormsApplication4\WindowsFormsApplication2\Properties\Settings.Designer.cs
文件 249 2018-05-21 17:52 WindowsFormsApplication4\WindowsFormsApplication2\Properties\Settings.settings
文件 3803 2018-05-22 16:57 WindowsFormsApplication4\WindowsFormsApplication2\WindowsFormsApplication2.csproj
文件 1039 2018-05-21 17:52 WindowsFormsApplication4\WindowsFormsApplication2.sln
目录 0 2018-05-21 17:52 WindowsFormsApplication4\WindowsFormsApplication2\obj\Debug\TempPE
目录 0 2018-05-25 17:34 WindowsFormsApplication4\.vs\WindowsFormsApplication2\v14
目录 0 2018-05-25 17:34 WindowsFormsApplication4\WindowsFormsApplication2\bin\Debug
目录 0 2018-05-22 16:45 WindowsFormsApplication4\WindowsFormsApplication2\bin\Release
............此处省略11个文件信息
- 上一篇:C#开发Web留言板功能
- 下一篇:C# 计算器 仿windows计算器
相关资源
- C# 计算器 仿windows计算器
- C#开发Web留言板功能
-
C#读取xm
l配置文件 - C# 学生管理系统 链接Access数据库
- Asp.net(C#) 创建windows服务并定时执行
- 获取TIMQQ信息.zip
- winform创建不规则窗体和控件源码.ra
- C#截图小工具
- 图像特征点的提取以及同名像点匹配
- c#编写送水管理系统
- C#屏幕截图工具及源码
- 三轴运动控制C#
- 工厂用来测试键盘好坏的的一个软件
- C#贪食蛇全能版
- C# 爬虫接口
- C#网络监控软件代码
- 字符串加密与解密C#源码
- C# Socket 分包传送数据
- C#编写的模拟操作系统虚拟内存分页请
- C#实现简单的Socket文件传输
- C#与Halcon联合编程,实现窗口鼠标滚轮
- asp.netC#定时发送邮件
- win7 win8 C# 音量控制 Volume
- TEA加密解密器C#开发
- 三层结构MVCC#框架
- C#笔试题 各大公司迅雷,腾讯,华为
- c#计算器实现 仿windows计算器
- 104协议dll源代码C#
- 101协议dll源码C#
- C#编写登录窗体,连接SQL,有登录、注
评论
共有 条评论