예제 #1
0
        private bool ZipFileOperation(string fileName, string md5, string filePathAll)
        {
            string newZipFilePath = FileHelper.CopyTo(filePathAll);

            if (md5 == Common.Md5(newZipFilePath))
            {
                if (Operation.UnZipOperation(newZipFilePath))
                {
                    DBLogger.Insert(DBLogger.GetLoggerInfo(fileName, "上传的签名zip文件解压缩成功", 1));
                    return(true);
                }
                DBLogger.Insert(DBLogger.GetLoggerInfo(fileName, "上传的签名zip文件解压缩失败", 0));
                return(false);
            }
            else
            {
                DBLogger.Insert(DBLogger.GetLoggerInfo(fileName, "上传的签名zip文件验证不正确", 0));
                return(false);
            }
        }
예제 #2
0
        public bool Verify(string fileName, string md5)
        {
            bool isVerify = true;

            try
            {
                //文件保存的路径
                string filePathAll   = Upload.Common.GetFilePathAll(fileName);
                string filePathAllTo = Upload.Common.GetFilePathAllTo(fileName);
                if (fileName.EndsWith("xls") == false)
                {
                    //先判断是否是zip签名图片文件,如果是,单独处理
                    //先将zip移动到zip_file目录中,再解压缩,进行复制操作
                    if (fileName.EndsWith("zip"))
                    {
                        return(ZipFileOperation(fileName, md5, filePathAll));
                    }
                    filePathAllTo = Upload.Common.GetXdtImgFilePathToAll(fileName);
                }
                string uploadMessage = "上传数据验证结束";
                //判断文件是否正确
                if (md5 != Common.Md5(filePathAll))
                {
                    isVerify      = false;
                    uploadMessage = "上传数据验证异常";
                    filePathAllTo = Upload.Common.GetErrorFilePath(fileName);
                }
                Upload.FileHelper.CopyDirectoryOneFile(filePathAll, filePathAllTo);
                TxtLogger.Debug(string.Format("{0}:[{1} {2}]", "Verify", fileName, uploadMessage));
                DBLogger.Insert(DBLogger.GetLoggerInfo(fileName, "上传数据验证结束", 1));
            }
            catch (Exception ex)
            {
                isVerify = false;
                TxtLogger.Error(string.Format("{0}:[{1} {2}]:[{3}]", "Verify", fileName, "上传数据验证异常", ex.Message));
                DBLogger.Insert(DBLogger.GetLoggerInfo(fileName, "上传数据验证异常," + ex.Message, 0));
            }
            return(isVerify);
        }