public static void doArchive(List<string> fileList, string savePath)
        {
            try
            {
                //(1)ZIPクラスをインスタンス化
                using (ZipFile zip = new ZipFile(Encoding.GetEncoding(LpsDefineMost.ENCODING_SJIS)))
                {
                    //(2)圧縮レベルを設定
                    zip.CompressionLevel = CompressionLevel.BestCompression;

                    foreach (string filePath in fileList)
                    {
                        //(3)ファイルを追加
                        zip.AddFile(filePath);
                    }

                    //(5)ZIPファイルを保存
                    zip.Save(savePath);
                }
            }
            catch
            {
                LpsLogController lc = new LpsLogController();
                lc.writingLog("PathController : doArchive\n一部ファイルの削除に失敗しました。");
            }
        }
示例#2
0
 /// <summary>
 /// コンストラクター
 /// </summary>
 public XmlMost()
 {
     lc = new LpsLogController();
 }
 public static string getSettingFilePath()
 {
     LpsLogController lc = new LpsLogController();
     try
     {
         checkDir(getAppPath() + "\\setting");
         return getAppPath() + "\\setting\\setting.xml";
     }
     catch (System.Exception err)
     {
         LpsLogControllerCus.writingLog("LiplisFileController", MethodBase.GetCurrentMethod().Name, err.ToString());
         return "";
     }
 }
 /// <summary>
 /// コンストラクター
 /// </summary>
 public HtmlParser()
 {
     lc = new LpsLogController();
 }
        /// <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
            {
                LpsLogController lc = new LpsLogController();
                lc.writingLog("PathController : delteFile\n一部ファイルの削除に失敗しました。");
            }
        }
 public string getLogPath()
 {
     lc = new LpsLogController();
     try
     {
         checkDir(getAppPath() + "\\log");
         return getAppPath() + "\\log\\liplis.log";
     }
     catch (System.Exception err)
     {
         lc.writingLog("PathController : getLogPath\n" + err);
         return "";
     }
 }
 public static string getXmlPath()
 {
     LpsLogController lc = new LpsLogController();
     try
     {
         checkDir(getAppPath() + "\\xml");
         return getAppPath() + "\\xml\\";
     }
     catch (System.Exception err)
     {
         lc.writingLog("PathController : getXmlPath\n" + err);
         return "";
     }
 }
 public LpsPathController(string cacheFilePath)
 {
     lc = new LpsLogController();
 }
 /// <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
         {
             LpsLogController lc = new LpsLogController();
             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 (System.IO.Directory.Exists(filePath))
     {
         try
         {
             DirectoryInfo di = new DirectoryInfo(filePath);
             di.Delete(true);;
         }
         catch
         {
             LpsLogController lc = new LpsLogController();
             lc.writingLog("PathController : delteFile\nファイルの削除に失敗しました。");
         }
         return true;
     }
     else
     {
         return false;
     }
 }
示例#11
0
 public WebCapture(Form parrentForm)
 {
     lc = new LpsLogController();
     this.parrentForm = parrentForm;
 }
        public static bool doDefrost(string filePath, string savePath)
        {
            try
            {
                //(1)ZIPファイルを読み込み
                using (ZipFile zip = ZipFile.Read(filePath))
                {
                    //(2)解凍時に既にファイルがあったら上書きする設定
                    zip.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
                    //(3)全て解凍する
                    zip.ExtractAll(savePath);
                }

                return true;
            }
            catch
            {
                LpsLogController lc = new LpsLogController();
                lc.writingLog("PathController : doArchive\n一部ファイルの削除に失敗しました。");

                return false;
            }
        }
 public JpgController()
 {
     lc = new LpsLogController();
 }