|
10 | 10 | using System.Collections.Generic;
|
11 | 11 | using System.Collections.Immutable;
|
12 | 12 | using System.Collections.ObjectModel;
|
| 13 | +using System.IO; |
| 14 | +using System.IO.Compression; |
13 | 15 | using System.Linq;
|
14 | 16 | using System.Numerics;
|
15 | 17 | using System.Runtime.CompilerServices;
|
16 | 18 | using System.Security.Cryptography.X509Certificates;
|
17 | 19 | using System.Text;
|
| 20 | +using System.Xml.Linq; |
18 | 21 |
|
19 | 22 |
|
20 | 23 |
|
21 | 24 | // ---
|
22 | 25 |
|
23 | 26 |
|
24 | 27 |
|
25 |
| -var person = new Person(); |
26 |
| -var bin = MemoryPackSerializer.Serialize(person); |
| 28 | +//var encoder = new BrotliEncoder(4, 22); |
27 | 29 |
|
28 |
| -// overwrite data to existing instance. |
29 |
| -MemoryPackSerializer.Deserialize(bin, ref person); |
| 30 | +//// new BrotliDecoder().Decompress( |
30 | 31 |
|
31 | 32 |
|
| 33 | +////encoder.Compress(, , , , true); |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +//encoder.Dispose(); |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +//var person = new Person(); |
| 48 | +//var bin = MemoryPackSerializer.Serialize(person); |
| 49 | + |
| 50 | +//// overwrite data to existing instance. |
| 51 | +//MemoryPackSerializer.Deserialize(bin, ref person); |
| 52 | + |
| 53 | +//internal void WriteCore(ReadOnlySpan<byte> buffer, bool isFinalBlock = false) |
| 54 | +//{ |
| 55 | +// if (_mode != CompressionMode.Compress) |
| 56 | +// throw new InvalidOperationException(SR.BrotliStream_Decompress_UnsupportedOperation); |
| 57 | +// EnsureNotDisposed(); |
| 58 | + |
| 59 | +// OperationStatus lastResult = OperationStatus.DestinationTooSmall; |
| 60 | +// Span<byte> output = new Span<byte>(_buffer); |
| 61 | +// while (lastResult == OperationStatus.DestinationTooSmall) |
| 62 | +// { |
| 63 | +// int bytesConsumed; |
| 64 | +// int bytesWritten; |
| 65 | +// lastResult = _encoder.Compress(buffer, output, out bytesConsumed, out bytesWritten, isFinalBlock); |
| 66 | +// if (lastResult == OperationStatus.InvalidData) |
| 67 | +// throw new InvalidOperationException(SR.BrotliStream_Compress_InvalidData); |
| 68 | +// if (bytesWritten > 0) |
| 69 | +// _stream.Write(output.Slice(0, bytesWritten)); |
| 70 | +// if (bytesConsumed > 0) |
| 71 | +// buffer = buffer.Slice(bytesConsumed); |
| 72 | +// } |
| 73 | +//} |
| 74 | + |
| 75 | + |
| 76 | +//internal static partial class BrotliUtils |
| 77 | +//{ |
| 78 | +// public const int WindowBits_Min = 10; |
| 79 | +// public const int WindowBits_Default = 22; |
| 80 | +// public const int WindowBits_Max = 24; |
| 81 | +// public const int Quality_Min = 0; |
| 82 | +// public const int Quality_Default = 4; |
| 83 | +// public const int Quality_Max = 11; |
| 84 | +// public const int MaxInputSize = int.MaxValue - 515; // 515 is the max compressed extra bytes |
| 85 | + |
| 86 | +// internal static int GetQualityFromCompressionLevel(CompressionLevel compressionLevel) => |
| 87 | +// compressionLevel switch |
| 88 | +// { |
| 89 | +// CompressionLevel.NoCompression => Quality_Min, |
| 90 | +// CompressionLevel.Fastest => 1, |
| 91 | +// CompressionLevel.Optimal => Quality_Default, |
| 92 | +// CompressionLevel.SmallestSize => Quality_Max, |
| 93 | +// _ => throw new ArgumentException(SR.ArgumentOutOfRange_Enum, nameof(compressionLevel)) |
| 94 | +// }; |
| 95 | +//} |
| 96 | + |
32 | 97 |
|
33 | 98 | [MemoryPackable(GenerateType.Collection)]
|
34 | 99 | public partial class ListGenerics<T> : List<T>
|
|
0 commit comments