コード例 #1
0
        private bool Compare(string self, string comparable)
        {
            if (string.IsNullOrEmpty(self) | string.IsNullOrEmpty(comparable))
            {
                return(false);
            }

            self       = self.ToLower().TrimEnd(ZipExtension.ToCharArray()).TrimEnd(CsvExtension.ToCharArray());
            comparable = comparable.ToLower().TrimEnd(ZipExtension.ToCharArray()).TrimEnd(CsvExtension.ToCharArray());

            if (self.EndsWith(comparable) | comparable.EndsWith(self))
            {
                Log.Debug("full match", comparable);
                return(true);
            }

            if (self.EndsWith(Path.GetFileName(comparable)) | comparable.EndsWith(Path.GetFileName(self)))
            {
                Log.Debug("partial (file name) match", comparable);
                return(true);
            }

            return(false);
        }
コード例 #2
0
 private bool ThisZipFile(string temppath)//打包文件
 {
     try
     {
         FileInfo tfi = new FileInfo(temppath + ".log");
         lock (tfi)
         {
             if (!tfi.Exists)
             {
                 return(false);
             }
             //ZipFile.CompressFile(temppath + ".log", temppath + ".zip");
             ZipExtension.Compress(tfi);
             //tfi.Delete();
             File.Delete(tfi.FullName);
             return(true);
         }
     }
     catch (Exception e)
     {
         UnityEngine.Debug.Log(e.Message + e.StackTrace);
         return(false);
     }
 }