public static void deleteOldTempFile(string tempDirPath, DateTime dt)
        {
            //ファイルリスト
            List<string> tempFileList = new List<string>();
            //テンプファイルリストを取得
            getFileList(tempDirPath, "*", ref tempFileList);

            try
            {
                //作成時刻と照らし合わせ、基準以上であれば削除する
                foreach (string path in tempFileList)
                {
                    System.Windows.Forms.Application.DoEvents();
                    FileInfo fi = new System.IO.FileInfo(path);

                    //ファイルの作成日が基準以前であれば削除する
                    if (fi.CreationTime < dt)
                    {
                        fi.Delete();
                    }
                }
            }
            catch
            {
                LiplisLog lc = new LiplisLog();
                LiplisLog.writingLog("LiplisFileController", MethodBase.GetCurrentMethod().Name, "一部ファイルの削除に失敗しました。");
            }
        }
Example #2
0
 /// <summary>
 /// コンストラクター
 /// </summary>
 public XmlMost()
 {
     lc = new LiplisLog();
 }
 public string getDbDirPath()
 {
     lc = new LiplisLog();
     try
     {
         //checkDir(getAppPath() + "\\db");
         //return getAppPath() + "\\db\\";
         checkDir(chacheFilePath + "\\db");
         return chacheFilePath + "\\db";
     }
     catch (System.Exception err)
     {
         LiplisLog.writingLog("LiplisFileController", MethodBase.GetCurrentMethod().Name, err.ToString());
         return "";
     }
 }
 public static string getXmlPath()
 {
     LiplisLog lc = new LiplisLog();
     try
     {
         checkDir(getAppPath() + "\\xml");
         return getAppPath() + "\\xml\\";
     }
     catch (System.Exception err)
     {
         LiplisLog.writingLog("LiplisFileController", MethodBase.GetCurrentMethod().Name, err.ToString());
         return "";
     }
 }
 public static string getWindowPath(string loadSkin)
 {
     LiplisLog lc = new LiplisLog();
     try
     {
         checkDir(getAppPath() + "\\skin");
         return getAppPath() + "\\skin\\" + loadSkin + "\\window\\";
     }
     catch (System.Exception err)
     {
         LiplisLog.writingLog("LiplisFileController", MethodBase.GetCurrentMethod().Name, err.ToString());
         return "";
     }
 }
 public LiplisFileController(string cacheFilePath)
 {
     lc = new LiplisLog();
 }
 public static bool delteFile(string filePath)
 {
     if (checkFileExist(filePath))
     {
         try
         {
             FileInfo fi = new System.IO.FileInfo(filePath);
             fi.Delete();
         }
         catch
         {
             LiplisLog lc = new LiplisLog();
             LiplisLog.writingLog("LiplisFileController", MethodBase.GetCurrentMethod().Name, "ファイルの削除に失敗しました。");
         }
         return true;
     }
     else
     {
         return false;
     }
 }