📄 filescontrol.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace RFID_CAR
{
class FilesControl
{
public const string gc_str_files_path = "\\My Documents";
private const char m_c_field_separator = ',';
public bool is_xcwj_txt()
{
return File.Exists(gc_str_files_path+"\\xcwj.txt");
}
public bool findin_xcwj_txt(string str_uid,ref string str_record)
{
bool ret_b = false;
string valid = "1";
try
{
using (StreamReader stream = File.OpenText(gc_str_files_path + "\\xcwj.txt"))
{
while (stream.Peek() >= 0)
{
string str = stream.ReadLine();
string[] pstr_fields = str.Split(m_c_field_separator);
if (string.Equals(pstr_fields[0], str_uid))
if (string.Equals(pstr_fields[2], valid ))
{
str_record = string.Copy(str);
ret_b = true;
break;
}
}
stream.Close();
}
}
catch (Exception e_valid)
{
System.Windows.Forms.MessageBox.Show("err_valid:" + e_valid.Message);
}
return ret_b;
}
public bool write_scwj_txt(string str_input)
{
if(!File.Exists(gc_str_files_path+"\\scwj.txt"))
File.CreateText(gc_str_files_path+"\\scwj.txt");
try
{
StreamWriter stream = File.AppendText(gc_str_files_path+"\\scwj.txt");
stream.WriteLine (str_input);
stream.Close();
}
catch(Exception e)
{
return false;
}
return true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -