示例#1
0
        private string GetFullPath(CmdLogType type, CommLogType CommType)
        {
            string   rtn = string.Empty;
            DateTime Date = DateTime.Now;
            string   strY, strM, strD, strFileName, strFullPath = "";

            strY = string.Format("{0:yyyy}", Date);
            strM = string.Format("{0:MM}", Date);
            strD = string.Format("{0:dd}", Date);
            switch (_Ver)
            {
            case eLOGVER.Old:
                strFileName = string.Format("{0}_{1:dd}.txt", type.ToString(), Date);
                strFullPath = string.Format("{0}\\{1}\\{2}\\{3}\\{4}", _PathFodler, type.ToString(), strY, strM, strFileName);
                switch (CommType)
                {
                case CommLogType.MPlus:
                case CommLogType.VEHICLE:
                case CommLogType.LDS:
                case CommLogType.QR:
                case CommLogType.UR:
                case CommLogType.TactTime:
                    rtn = string.Format("{0}\\{1}\\{2}\\{3}\\{4}\\{5}", _PathFodler, type.ToString(), CommType.ToString(), strY, strM, strFileName);
                    break;

                default:
                case CommLogType.None:
                    rtn = string.Format("{0}\\{1}\\{2}\\{3}\\{4}", _PathFodler, type.ToString(), strY, strM, strFileName);
                    break;
                }
                break;

            case eLOGVER.New:
                switch (type)
                {
                case CmdLogType.Comm:
                    switch (CommType)
                    {
                    case CommLogType.MPlus:
                    case CommLogType.VEHICLE:
                    case CommLogType.UR:
                    case CommLogType.QR:
                    case CommLogType.LDS:
                    case CommLogType.Conv:
                    case CommLogType.IO:
                    case CommLogType.TactTime:
                        rtn = $"{_PathFodler}\\{strY}\\{strM}\\{strD}\\{type.ToString()}\\{CommType.ToString()}.txt";
                        break;

                    default: rtn = $"{_PathFodler}\\{strY}\\{strM}\\{strD}\\{type.ToString()}.txt"; break;
                    }
                    break;

                default: rtn = $"{_PathFodler}\\{strY}\\{strM}\\{strD}\\{type.ToString()}.txt"; break;
                }
                break;
            }
            return(rtn);
        }
示例#2
0
        private void MakeDir(CmdLogType type, CommLogType CommType)
        {
            DateTime      Date = DateTime.Now;
            string        strY, strM, strD;
            DirectoryInfo dtif = new DirectoryInfo(_PathFodler);

            strY = string.Format("{0:yyyy}", Date);
            strM = string.Format("{0:MM}", Date);
            strD = string.Format("{0:dd}", Date);
            switch (_Ver)
            {
            case eLOGVER.Old:
                dtif = new DirectoryInfo(string.Format("{0}\\{1}\\{2}", _PathFodler, type.ToString(), strY));
                if (!dtif.Exists)
                {
                    dtif.Create();
                }
                switch (CommType)
                {
                case CommLogType.MPlus:
                case CommLogType.VEHICLE:
                case CommLogType.LDS:
                case CommLogType.QR:
                case CommLogType.UR:
                case CommLogType.TactTime:
                    dtif = new DirectoryInfo(string.Format("{0}\\{1}\\{2}\\{3}", _PathFodler, type.ToString(), strY, strM));
                    if (!dtif.Exists)
                    {
                        dtif.Create();
                    }

                    dtif = new DirectoryInfo(string.Format("{0}\\{1}\\{2}\\{3}\\{4}", _PathFodler, type.ToString(), CommType.ToString(), strY, strM));
                    if (!dtif.Exists)
                    {
                        dtif.Create();
                    }
                    break;

                case CommLogType.None:
                default:
                    dtif = new DirectoryInfo(string.Format("{0}\\{1}\\{2}\\{3}", _PathFodler, type.ToString(), strY, strM));
                    if (!dtif.Exists)
                    {
                        dtif.Create();
                    }
                    break;
                }
                break;

            case eLOGVER.New:
                dtif = new DirectoryInfo($"{_PathFodler}\\{strY}");
                if (!dtif.Exists)
                {
                    dtif.Create();
                }
                dtif = new DirectoryInfo($"{_PathFodler}\\{strY}\\{strM}");
                if (!dtif.Exists)
                {
                    dtif.Create();
                }
                dtif = new DirectoryInfo($"{_PathFodler}\\{strY}\\{strM}\\{strD}");
                if (!dtif.Exists)
                {
                    dtif.Create();
                }
                switch (type)
                {
                case CmdLogType.Comm:
                    dtif = new DirectoryInfo($"{_PathFodler}\\{strY}\\{strM}\\{strD}\\{type.ToString()}");
                    if (!dtif.Exists)
                    {
                        dtif.Create();
                    }
                    break;

                default: break;
                }
                break;
            }
        }