Esempio n. 1
0
        public void Test_Zlib_Decompress()
        {
            var compressCount = 4;

            for (int i = compressCount; i >= 0; i--)
            {
                var json = FileHelper.ReadToBytes(i == compressCount
                    ? $"D:\\test_compression_result_{i}.txt"
                    : $"D:\\test_decompress_result_{i + 1}.txt");
                var result = ZlibHelper.DeCompressBytes(json);
                FileHelper.Write($"D:\\test_decompress_result_{i}.txt", result);
            }
        }
Esempio n. 2
0
        public void Test_Zlib_Compress()
        {
            var compressCount = 4;

            for (int i = 0; i <= compressCount; i++)
            {
                var json = FileHelper.Read(i == 0
                    ? "D:\\iTestRunner_R1_format.txt"
                    : $"D:\\test_compression_result_{i - 1}.txt");
                var initBytes = Encoding.UTF8.GetBytes(json);
                var result    = ZlibHelper.CompressBytes(initBytes, zlibConst.Z_BEST_COMPRESSION);
                FileHelper.Write($"D:\\test_compression_result_{i}.txt", result);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 添加表单参数
        /// </summary>
        /// <param name="request">Http请求</param>
        /// <param name="log">日志</param>
        private async Task AddFormParamsAsync(Microsoft.AspNetCore.Http.HttpRequest request, ILog log)
        {
            if (IsMultipart(request.ContentType))
            {
                return;
            }
            request.EnableRewind();
            var result = await FileHelper.ToStringAsync(request.Body, isCloseStream : false);

            if (string.IsNullOrWhiteSpace(result))
            {
                return;
            }
            log.Params("表单参数:").Params(result);
        }