txt,csv檔案儲存
阿新 • • 發佈:2019-02-09
string NMEAPath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]) + "\\" + "NMEA_" + ".txt";//記事本
string DevicePath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]) + "\\" + "裝置資訊_" + ".csv";//csv檔案
if (!File.Exists(NMEAPath))
{
StringBuilder ss = new StringBuilder();
//StringBuilder ss = new StringBuilder();
ss.Append("測試時間,ICCID,DSN,IMEI,螢幕測試,軟體版本,網路狀態測試,訊號強度測試,揚聲器測試,麥克風測試,按鍵測試,通話測試,GPS測試");
ss.AppendLine();
File.AppendAllText(NMEAPath, ss.ToString(), Encoding.UTF8);
}
if (!File.Exists(DevicePath))
{
StringBuilder ss = new StringBuilder();
//StringBuilder ss = new StringBuilder();
ss.Append("測試時間,ICCID,DSN,IMEI,螢幕測試,軟體版本,網路狀態測試,訊號強度測試,揚聲器測試,麥克風測試,按鍵測試,通話測試,GPS測試");
ss.AppendLine();
File.AppendAllText(DevicePath, ss.ToString(), Encoding.UTF8);
}
File.AppendAllText(DevicePath, "\t213123134123,");
File.AppendAllText(DevicePath, "dfafsafas,");
string DevicePath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]) + "\\" + "裝置資訊_" + ".csv";//csv檔案
if (!File.Exists(NMEAPath))
{
StringBuilder ss = new StringBuilder();
//StringBuilder ss = new StringBuilder();
ss.Append("測試時間,ICCID,DSN,IMEI,螢幕測試,軟體版本,網路狀態測試,訊號強度測試,揚聲器測試,麥克風測試,按鍵測試,通話測試,GPS測試");
ss.AppendLine();
File.AppendAllText(NMEAPath, ss.ToString(), Encoding.UTF8);
}
if (!File.Exists(DevicePath))
{
StringBuilder ss = new StringBuilder();
//StringBuilder ss = new StringBuilder();
ss.Append("測試時間,ICCID,DSN,IMEI,螢幕測試,軟體版本,網路狀態測試,訊號強度測試,揚聲器測試,麥克風測試,按鍵測試,通話測試,GPS測試");
ss.AppendLine();
File.AppendAllText(DevicePath, ss.ToString(), Encoding.UTF8);
}
File.AppendAllText(DevicePath, "\t213123134123,");
File.AppendAllText(DevicePath, "dfafsafas,");