//----------------------------------------------------------------------------
 public static void DeleteFile(string LogFilePath, string LogFileName, string SourcePath, string FileName)
 {
     try
     {
         FileName = (SourcePath.EndsWith("\\")) ? SourcePath + FileName : SourcePath + "\\" + FileName;
         DeleteFile(LogFilePath, LogFileName, FileName);
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + ".FileUtils." + MethodBase.GetCurrentMethod().Name);
     }
 }
 //---------------------------------------------------
 public static void MakeDir(string LogFilePath, string LogFileName, string DirectorName)
 {
     try
     {
         if (!Directory.Exists(DirectorName))
         {
             Directory.CreateDirectory(DirectorName);
         }
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + ".FileUtils." + MethodBase.GetCurrentMethod().Name);
     }
 }
 //---------------------------------------------
 public static void DeleteFile(string LogFilePath, string LogFileName, string FileName)
 {
     try
     {
         if (File.Exists(FileName))
         {
             File.Delete(FileName);
         }
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + ".FileUtils." + MethodBase.GetCurrentMethod().Name);
     }
 }
 //----------------------------------------------------------------------------
 public static void MoveFile(string LogFilePath, string LogFileName, string SourcePath, string FileName, string DestPath)
 {
     try
     {
         string OriginalFile = (SourcePath.EndsWith("\\")) ? SourcePath + FileName : SourcePath + "\\" + FileName;
         if (File.Exists(OriginalFile))
         {
             string DestinationFile = (DestPath.EndsWith("\\")) ? DestPath + FileName : DestPath + "\\" + FileName;
             File.Move(OriginalFile, DestinationFile);
         }
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog("SourcePath: " + SourcePath + " FileName: " + FileName + "DestPath: " + DestPath + " >>" + ex.Message, LogFilePath + "\\Exception", LogFileName + ".FileUtils." + MethodBase.GetCurrentMethod().Name);
     }
 }
 //-------------------------------------------------------
 public static void MakeYYYY_MM(string LogFilePath, string LogFileName, ref string RootPath, DateTime time)
 {
     try
     {
         if (time != null)
         {
             if (Directory.Exists(RootPath))
             {
                 RootPath = (RootPath.EndsWith("\\")) ? RootPath + time.Year.ToString() : RootPath + "\\" + time.Year.ToString();
                 MakeDir(LogFilePath, LogFileName, RootPath);
                 if (Directory.Exists(RootPath))
                 {
                     RootPath = RootPath + "\\" + ((time.Month < 10) ? "0" + time.Month.ToString() : time.Month.ToString());
                     MakeDir(LogFilePath, LogFileName, RootPath);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + ".FileUtils." + MethodBase.GetCurrentMethod().Name);
     }
 }
        //----------------------------------------------------------------------------
        public static bool FileExists(string LogFilePath, string LogFileName, string FileName, FileInfo[] l_FileInfo)
        {
            bool retVal = false;

            try
            {
                if (l_FileInfo.Length > 0)
                {
                    for (int i = 0; i < l_FileInfo.Length; i++)
                    {
                        if (l_FileInfo[i].Name == FileName)
                        {
                            retVal = true;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + ".FileUtils." + MethodBase.GetCurrentMethod().Name);
            }
            return(retVal);
        }