using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Microsoft.VisualBasic;

namespace tcEAI_C
{

    public class clsSPC
    {
        public static string strDataBaseType;
        public static string strConnectionString;

        private string Filepath_E = @"D:\Log\EAI_TC\";   // 指定Log

        public void SaveLog(string msg)
        {
            if (!Directory.Exists(Filepath_E))
            {
                Directory.CreateDirectory(Filepath_E);
            }
            //{
            //    var withBlock = My.MyProject.Application.Log.DefaultFileLogWriter;
            //    // If CInt(Format(Now, "mm")) >= 20 And CInt(Format(Now, "mm")) < 40 Then
            //    // .BaseFileName = "Log" & "_20"   'Log檔的檔名
            //    // ElseIf CInt(Format(Now, "mm")) >= 40 Then
            //    // .BaseFileName = "Log" & "_40"   'Log檔的檔名
            //    // Else
            //    withBlock.BaseFileName = "Log"; // & Format(Now, "mm")    'Log檔的檔名
            //                                    // End If
            //    withBlock.CustomLocation = Filepath_E;   // 自訂Log檔的存放路徑
            //    withBlock.AutoFlush = true;        // Log檔寫完後自動清除緩衝
            //    withBlock.LogFileCreationSchedule = Microsoft.VisualBasic.Logging.LogFileCreationScheduleOption.Daily; // 設定一天產生一個Log檔
            //    withBlock.MaxFileSize = long.MaxValue;   // 預設容量5M 改為 最大容量
            //}

            //My.MyProject.Application.Log.WriteEntry(string.Format("{0} {1}", Strings.Format(DateTime.Now, "yy/MM/dd HH:mm:ss ffff,"), msg));
        }

        public void combineException(ref List<ArrayList> strException, string code = null, string sysmsg = null, string mesmsg = null, string stack = null)
        {
            bool result = false;
            try
            {
                var al = new ArrayList();
                al.Add(code);
                al.Add(sysmsg);
                al.Add(mesmsg);
                al.Add(stack);
                strException.Add(al);
                result = true;
            }
            catch (Exception ex)
            {
                result = false;
            }
        }


    }
}