wzp
2021-07-28 864986e4cad03f6b9bba9a7e65379db496b62a6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
 
namespace APPCMPP2.AsiaINFO.SMS.APPCMPP2
{
    /// <summary>
    /// 没有派上用场。
    /// </summary>
    public class TempLog
    {
        //写日志
        public void WriteLog(string str)
        {
            string sFilePath = @".\Syslog";
            string sFileName = "sms.log";
            sFileName = sFilePath + "\\" + sFileName;
            if (!Directory.Exists(sFilePath))
            {
                Directory.CreateDirectory(sFilePath);
            }
            FileStream fs;
            StreamWriter sw;
            if (File.Exists(sFileName))
            {
                fs = new FileStream(sFileName, FileMode.Append, FileAccess.Write);
            }
            else
            {
                fs = new FileStream(sFileName, FileMode.Create, FileAccess.Write);
            }
            sw = new StreamWriter(fs);
            sw.WriteLine(DateTime.Now.ToString() + "  ----- " + str);
            sw.Close();
            fs.Close();
        }
    }
}