123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- namespace Senparc.Weixin.MP.Sample.CommonService
- {
- /// <summary>
- /// 常用处理类
- /// </summary>
- public class CommonHandleClass
- {
- public CommonHandleClass() {
-
- }
- /// <summary>
- /// 微信接口日志目录路径
- /// </summary>
- public static string WeiXinlogsPath {
- get { return LYFZ.WinAPI.CustomPublicMethod.BasePath + "\\Logs\\WeiXinlogs\\"; }
- }
- /// <summary>
- /// 写日志(用于跟踪)
- /// </summary>
- public static void WriteLog(string strMemo)
- {
- string filename = LYFZ.WinAPI.CustomPublicMethod.BasePath + "\\Logs\\WeiXinlogs.txt";
- if (!Directory.Exists(System.IO.Path.GetDirectoryName(filename)))
- Directory.CreateDirectory(System.IO.Path.GetDirectoryName(filename));
- StreamWriter sr = null;
- try
- {
- if (!File.Exists(filename))
- {
- sr = File.CreateText(filename);
- }
- else
- {
- sr = File.AppendText(filename);
- }
- sr.WriteLine(strMemo);
- }
- catch
- {
- }
- finally
- {
- if (sr != null)
- sr.Close();
- }
- }
- }
- }
|