📄 log.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace GPSClassLibrary
{
public class Log
{
string logPath;
public bool IsValid = false;
public Log(string path)
{
if (path != "")
{
logPath = path + ".log";
if (!File.Exists(logPath))
File.Create(logPath);
IsValid = true;
}
}
public void writeLog(string strWrite)
{
using (StreamWriter sw = new StreamWriter(logPath, true))
{
sw.WriteLine(strWrite);
sw.Close();
}
}
public string[] ReadLog()
{
List<string> strList = new List<string>();
using (StreamReader sr = new StreamReader(logPath))
{
if (sr != StreamReader.Null)
{
while (!sr.EndOfStream)
{
strList.Add(sr.ReadLine());
}
}
sr.Close();
}
return strList.ToArray();
}
public void ClearLog()
{
using (StreamWriter sw = new StreamWriter(logPath,false))
{
sw.Write("");
sw.Close();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -