Пример #1
0
        public static CRemoteFileStruct ParseDir(string inpStr)
        {
            CRemoteFileStruct rstr = new CRemoteFileStruct()
            {
                IsDir = true
            };

            //03-31-18  07:51PM       <DIR>          Bots
            //string stTmp = "03-31-18  07:51PM";
            //string stTmp = "03-31-18  07:51AM";
            //string stTmp = "03-31-18  07:51PM       <DIR>";
            //string stTmp = "03-31-18  07:51PM       <DIR>          Bots";

            Regex newReg = new Regex(@"([0-9]{2}\-[0-9]{2}\-[0-9]{2})[\s]+([0-9]{2}\:[0-9]{2}[PA]M)[\s]+<DIR>[\s]+([\w]+)");
            Match m      = newReg.Match(inpStr);

            if (m.Groups.Count == 4)
            {
                rstr.Dt = GetDateTime(m.Groups[1].ToString(), m.Groups[2].ToString());

                rstr.Name = m.Groups[3].ToString();
            }
            else
            {
                //TODO error
            }



            return(rstr);
        }
        private bool IsNeedFileMoving(CRemoteFileStruct remFileStruct)
        {
            double deltaHours = (DateTime.Now - remFileStruct.Dt.AddHours(_parHoursOffset)).TotalHours;


            if (deltaHours > _parHoursOld)
            {
                return(true);
            }

            return(false);
        }
Пример #3
0
        public static CRemoteFileStruct GetFileStruct(string inpString)
        {
            CRemoteFileStruct rstr = null;


            if (inpString.Contains("<DIR>"))
            {
                rstr = ParseDir(inpString);
            }
            else
            {
                rstr = ParseFile(inpString);
            }


            return(rstr);
        }
Пример #4
0
        public static CRemoteFileStruct ParseFile(string inpStr)
        {
            //string st = "03-31-18  03:46AM               589809 BfxRaw_auth.txt";

            Regex newReg = new Regex(@"([0-9]{2}\-[0-9]{2}\-[0-9]{2})[\s]+([0-9]{2}\:[0-9]{2}[PA]M)[\s]+([0-9]*)[\s]+([\w\.\=\s]+)");

            CRemoteFileStruct rstr = new CRemoteFileStruct();
            Match             m    = newReg.Match(inpStr);

            if (m.Groups.Count == 5)
            {
                rstr.Dt   = GetDateTime(m.Groups[1].ToString(), m.Groups[2].ToString());
                rstr.Size = Convert.ToInt64(m.Groups[3].ToString());
                rstr.Name = m.Groups[4].ToString();
            }



            return(rstr);
        }