public string getLogPath() { lc = new ComLogController(); try { checkDir(getAppPath() + "\\log"); return getAppPath() + "\\log\\liplis.log"; } catch (System.Exception err) { lc.writingLog("PathController : getLogPath\n" + err); return ""; } }
/// <summary> /// 古いテンプファイルを削除する /// 設定時間以上アクセスの無いファイルを削除する /// </summary> 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 { ComLogController lc = new ComLogController(); lc.writingLog("PathController : delteFile\n一部ファイルの削除に失敗しました。"); } }
public string getJavascriptPath() { lc = new ComLogController(); try { checkDir(getAppPath() + "\\js"); return getAppPath() + "\\js\\"; } catch (System.Exception err) { lc.writingLog("PathController : getJavascriptPath\n" + err); return ""; } }
public static string getXmlPath() { ComLogController lc = new ComLogController(); try { checkDir(getAppPath() + "\\xml"); return getAppPath() + "\\xml\\"; } catch (System.Exception err) { lc.writingLog("PathController : getXmlPath\n" + err); return ""; } }
public static void doArchive(List<string> fileList, string savePath) { try { //(1)ZIPクラスをインスタンス化 using (ZipFile zip = new ZipFile(Encoding.GetEncoding(ComDefineMost.ENCODING_SJIS))) { //(2)圧縮レベルを設定 zip.CompressionLevel = CompressionLevel.BestCompression; foreach (string filePath in fileList) { //(3)ファイルを追加 zip.AddFile(filePath); } //(5)ZIPファイルを保存 zip.Save(savePath); } } catch { ComLogController lc = new ComLogController(); lc.writingLog("PathController : doArchive\n一部ファイルの削除に失敗しました。"); } }
/// <summary> /// ファイルを消去する /// </summary> /// <param name="filePath"></param> /// <returns></returns> public static bool delteFile(string filePath) { if (checkFileExist(filePath)) { try { FileInfo fi = new System.IO.FileInfo(filePath); fi.Delete(); } catch { ComLogController lc = new ComLogController(); lc.writingLog("PathController : delteFile\nファイルの削除に失敗しました。"); } return true; } else { return false; } }
/// <summary> /// ディクトリを消去する /// </summary> /// <param name="filePath"></param> /// <returns></returns> public static bool delteDir(string filePath) { if (checkFileExist(filePath)) { try { DirectoryInfo di = new DirectoryInfo(filePath); di.Delete(true);; } catch { ComLogController lc = new ComLogController(); lc.writingLog("PathController : delteFile\nファイルの削除に失敗しました。"); } return true; } else { return false; } }