com.wallstop-studios.unity-helpers 2.0.0-rc78.9 → 2.0.0-rc79.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/Runtime/Protobuf-Net/System.Collections.Immutable.dll +0 -0
  2. package/Runtime/Protobuf-Net/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  3. package/Runtime/Protobuf-Net/protobuf-net.Core.dll +0 -0
  4. package/Runtime/Protobuf-Net/protobuf-net.dll +0 -0
  5. package/Runtime/Utils/Ascii85.cs +115 -0
  6. package/Runtime/Utils/Ascii85.cs.meta +3 -0
  7. package/Runtime/Utils/LZMA.cs +53 -0
  8. package/Runtime/Utils/LZMA.cs.meta +3 -0
  9. package/Runtime/Utils/SevenZip/Common/CRC.cs +61 -0
  10. package/Runtime/Utils/SevenZip/Common/CRC.cs.meta +11 -0
  11. package/Runtime/Utils/SevenZip/Common/InBuffer.cs +71 -0
  12. package/Runtime/Utils/SevenZip/Common/InBuffer.cs.meta +11 -0
  13. package/Runtime/Utils/SevenZip/Common/OutBuffer.cs +65 -0
  14. package/Runtime/Utils/SevenZip/Common/OutBuffer.cs.meta +11 -0
  15. package/Runtime/Utils/SevenZip/Common.meta +3 -0
  16. package/Runtime/Utils/SevenZip/Compress/LZ/IMatchFinder.cs +28 -0
  17. package/Runtime/Utils/SevenZip/Compress/LZ/IMatchFinder.cs.meta +11 -0
  18. package/Runtime/Utils/SevenZip/Compress/LZ/LzBinTree.cs +404 -0
  19. package/Runtime/Utils/SevenZip/Compress/LZ/LzBinTree.cs.meta +11 -0
  20. package/Runtime/Utils/SevenZip/Compress/LZ/LzInWindow.cs +153 -0
  21. package/Runtime/Utils/SevenZip/Compress/LZ/LzInWindow.cs.meta +11 -0
  22. package/Runtime/Utils/SevenZip/Compress/LZ/LzOutWindow.cs +110 -0
  23. package/Runtime/Utils/SevenZip/Compress/LZ/LzOutWindow.cs.meta +11 -0
  24. package/Runtime/{Protobuf-Net/System.Collections.Immutable.xml.meta → Utils/SevenZip/Compress/LZ.meta} +3 -2
  25. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaBase.cs +101 -0
  26. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaBase.cs.meta +11 -0
  27. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaDecoder.cs +464 -0
  28. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaDecoder.cs.meta +11 -0
  29. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaEncoder.cs +1669 -0
  30. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaEncoder.cs.meta +11 -0
  31. package/Runtime/Utils/SevenZip/Compress/LZMA.meta +8 -0
  32. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoder.cs +233 -0
  33. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoder.cs.meta +11 -0
  34. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBit.cs +137 -0
  35. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBit.cs.meta +11 -0
  36. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBitTree.cs +170 -0
  37. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBitTree.cs.meta +11 -0
  38. package/Runtime/Utils/SevenZip/Compress/RangeCoder.meta +8 -0
  39. package/Runtime/{Protobuf-Net/System.Runtime.CompilerServices.Unsafe.xml.meta → Utils/SevenZip/Compress.meta} +3 -2
  40. package/Runtime/Utils/SevenZip/ICoder.cs +177 -0
  41. package/Runtime/Utils/SevenZip/ICoder.cs.meta +11 -0
  42. package/Runtime/Utils/SevenZip.meta +3 -0
  43. package/package.json +3 -1
  44. package/Runtime/Protobuf-Net/System.Buffers.dll +0 -0
  45. package/Runtime/Protobuf-Net/System.Buffers.dll.meta +0 -33
  46. package/Runtime/Protobuf-Net/System.Collections.Immutable.xml +0 -6812
  47. package/Runtime/Protobuf-Net/System.Numerics.Vectors.dll +0 -0
  48. package/Runtime/Protobuf-Net/System.Numerics.Vectors.dll.meta +0 -33
  49. package/Runtime/Protobuf-Net/System.Runtime.CompilerServices.Unsafe.xml +0 -342
@@ -1,6 +1,7 @@
1
1
  fileFormatVersion: 2
2
- guid: 1cafb84e27fdef74a86d4be3a3f2ddde
3
- TextScriptImporter:
2
+ guid: 74d9937e5aef2f34da3f14c03ba6fa06
3
+ folderAsset: yes
4
+ DefaultImporter:
4
5
  externalObjects: {}
5
6
  userData:
6
7
  assetBundleName:
@@ -0,0 +1,101 @@
1
+ // LzmaBase.cs
2
+
3
+ namespace SevenZip.Compression.LZMA
4
+ {
5
+ internal abstract class Base
6
+ {
7
+ public const uint kNumRepDistances = 4;
8
+ public const uint kNumStates = 12;
9
+
10
+ // static byte []kLiteralNextStates = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
11
+ // static byte []kMatchNextStates = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
12
+ // static byte []kRepNextStates = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
13
+ // static byte []kShortRepNextStates = {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
14
+
15
+ public struct State
16
+ {
17
+ public uint Index;
18
+
19
+ public void Init()
20
+ {
21
+ Index = 0;
22
+ }
23
+
24
+ public void UpdateChar()
25
+ {
26
+ if (Index < 4)
27
+ Index = 0;
28
+ else if (Index < 10)
29
+ Index -= 3;
30
+ else
31
+ Index -= 6;
32
+ }
33
+
34
+ public void UpdateMatch()
35
+ {
36
+ Index = (uint)(Index < 7 ? 7 : 10);
37
+ }
38
+
39
+ public void UpdateRep()
40
+ {
41
+ Index = (uint)(Index < 7 ? 8 : 11);
42
+ }
43
+
44
+ public void UpdateShortRep()
45
+ {
46
+ Index = (uint)(Index < 7 ? 9 : 11);
47
+ }
48
+
49
+ public bool IsCharState()
50
+ {
51
+ return Index < 7;
52
+ }
53
+ }
54
+
55
+ public const int kNumPosSlotBits = 6;
56
+ public const int kDicLogSizeMin = 0;
57
+
58
+ // public const int kDicLogSizeMax = 30;
59
+ // public const uint kDistTableSizeMax = kDicLogSizeMax * 2;
60
+
61
+ public const int kNumLenToPosStatesBits = 2; // it's for speed optimization
62
+ public const uint kNumLenToPosStates = 1 << kNumLenToPosStatesBits;
63
+
64
+ public const uint kMatchMinLen = 2;
65
+
66
+ public static uint GetLenToPosState(uint len)
67
+ {
68
+ len -= kMatchMinLen;
69
+ if (len < kNumLenToPosStates)
70
+ return len;
71
+ return (uint)(kNumLenToPosStates - 1);
72
+ }
73
+
74
+ public const int kNumAlignBits = 4;
75
+ public const uint kAlignTableSize = 1 << kNumAlignBits;
76
+ public const uint kAlignMask = (kAlignTableSize - 1);
77
+
78
+ public const uint kStartPosModelIndex = 4;
79
+ public const uint kEndPosModelIndex = 14;
80
+ public const uint kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
81
+
82
+ public const uint kNumFullDistances = 1 << ((int)kEndPosModelIndex / 2);
83
+
84
+ public const uint kNumLitPosStatesBitsEncodingMax = 4;
85
+ public const uint kNumLitContextBitsMax = 8;
86
+
87
+ public const int kNumPosStatesBitsMax = 4;
88
+ public const uint kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
89
+ public const int kNumPosStatesBitsEncodingMax = 4;
90
+ public const uint kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
91
+
92
+ public const int kNumLowLenBits = 3;
93
+ public const int kNumMidLenBits = 3;
94
+ public const int kNumHighLenBits = 8;
95
+ public const uint kNumLowLenSymbols = 1 << kNumLowLenBits;
96
+ public const uint kNumMidLenSymbols = 1 << kNumMidLenBits;
97
+ public const uint kNumLenSymbols =
98
+ kNumLowLenSymbols + kNumMidLenSymbols + (1 << kNumHighLenBits);
99
+ public const uint kMatchMaxLen = kMatchMinLen + kNumLenSymbols - 1;
100
+ }
101
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 29689895f3f3a7b43ad42e89eb8f7450
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,464 @@
1
+ // LzmaDecoder.cs
2
+
3
+ using System;
4
+
5
+ namespace SevenZip.Compression.LZMA
6
+ {
7
+ using RangeCoder;
8
+
9
+ public class Decoder : ICoder, ISetDecoderProperties // ,System.IO.Stream
10
+ {
11
+ class LenDecoder
12
+ {
13
+ BitDecoder m_Choice = new BitDecoder();
14
+ BitDecoder m_Choice2 = new BitDecoder();
15
+ BitTreeDecoder[] m_LowCoder = new BitTreeDecoder[Base.kNumPosStatesMax];
16
+ BitTreeDecoder[] m_MidCoder = new BitTreeDecoder[Base.kNumPosStatesMax];
17
+ BitTreeDecoder m_HighCoder = new BitTreeDecoder(Base.kNumHighLenBits);
18
+ uint m_NumPosStates = 0;
19
+
20
+ public void Create(uint numPosStates)
21
+ {
22
+ for (uint posState = m_NumPosStates; posState < numPosStates; posState++)
23
+ {
24
+ m_LowCoder[posState] = new BitTreeDecoder(Base.kNumLowLenBits);
25
+ m_MidCoder[posState] = new BitTreeDecoder(Base.kNumMidLenBits);
26
+ }
27
+ m_NumPosStates = numPosStates;
28
+ }
29
+
30
+ public void Init()
31
+ {
32
+ m_Choice.Init();
33
+ for (uint posState = 0; posState < m_NumPosStates; posState++)
34
+ {
35
+ m_LowCoder[posState].Init();
36
+ m_MidCoder[posState].Init();
37
+ }
38
+ m_Choice2.Init();
39
+ m_HighCoder.Init();
40
+ }
41
+
42
+ public uint Decode(RangeCoder.Decoder rangeDecoder, uint posState)
43
+ {
44
+ if (m_Choice.Decode(rangeDecoder) == 0)
45
+ return m_LowCoder[posState].Decode(rangeDecoder);
46
+ else
47
+ {
48
+ uint symbol = Base.kNumLowLenSymbols;
49
+ if (m_Choice2.Decode(rangeDecoder) == 0)
50
+ symbol += m_MidCoder[posState].Decode(rangeDecoder);
51
+ else
52
+ {
53
+ symbol += Base.kNumMidLenSymbols;
54
+ symbol += m_HighCoder.Decode(rangeDecoder);
55
+ }
56
+ return symbol;
57
+ }
58
+ }
59
+ }
60
+
61
+ class LiteralDecoder
62
+ {
63
+ struct Decoder2
64
+ {
65
+ BitDecoder[] m_Decoders;
66
+
67
+ public void Create()
68
+ {
69
+ m_Decoders = new BitDecoder[0x300];
70
+ }
71
+
72
+ public void Init()
73
+ {
74
+ for (int i = 0; i < 0x300; i++)
75
+ m_Decoders[i].Init();
76
+ }
77
+
78
+ public byte DecodeNormal(RangeCoder.Decoder rangeDecoder)
79
+ {
80
+ uint symbol = 1;
81
+ do symbol = (symbol << 1) | m_Decoders[symbol].Decode(rangeDecoder);
82
+ while (symbol < 0x100);
83
+ return (byte)symbol;
84
+ }
85
+
86
+ public byte DecodeWithMatchByte(RangeCoder.Decoder rangeDecoder, byte matchByte)
87
+ {
88
+ uint symbol = 1;
89
+ do
90
+ {
91
+ uint matchBit = (uint)(matchByte >> 7) & 1;
92
+ matchByte <<= 1;
93
+ uint bit = m_Decoders[((1 + matchBit) << 8) + symbol].Decode(rangeDecoder);
94
+ symbol = (symbol << 1) | bit;
95
+ if (matchBit != bit)
96
+ {
97
+ while (symbol < 0x100)
98
+ symbol = (symbol << 1) | m_Decoders[symbol].Decode(rangeDecoder);
99
+ break;
100
+ }
101
+ } while (symbol < 0x100);
102
+ return (byte)symbol;
103
+ }
104
+ }
105
+
106
+ Decoder2[] m_Coders;
107
+ int m_NumPrevBits;
108
+ int m_NumPosBits;
109
+ uint m_PosMask;
110
+
111
+ public void Create(int numPosBits, int numPrevBits)
112
+ {
113
+ if (m_Coders != null && m_NumPrevBits == numPrevBits && m_NumPosBits == numPosBits)
114
+ return;
115
+ m_NumPosBits = numPosBits;
116
+ m_PosMask = ((uint)1 << numPosBits) - 1;
117
+ m_NumPrevBits = numPrevBits;
118
+ uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
119
+ m_Coders = new Decoder2[numStates];
120
+ for (uint i = 0; i < numStates; i++)
121
+ m_Coders[i].Create();
122
+ }
123
+
124
+ public void Init()
125
+ {
126
+ uint numStates = (uint)1 << (m_NumPrevBits + m_NumPosBits);
127
+ for (uint i = 0; i < numStates; i++)
128
+ m_Coders[i].Init();
129
+ }
130
+
131
+ uint GetState(uint pos, byte prevByte)
132
+ {
133
+ return ((pos & m_PosMask) << m_NumPrevBits)
134
+ + (uint)(prevByte >> (8 - m_NumPrevBits));
135
+ }
136
+
137
+ public byte DecodeNormal(RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte)
138
+ {
139
+ return m_Coders[GetState(pos, prevByte)].DecodeNormal(rangeDecoder);
140
+ }
141
+
142
+ public byte DecodeWithMatchByte(
143
+ RangeCoder.Decoder rangeDecoder,
144
+ uint pos,
145
+ byte prevByte,
146
+ byte matchByte
147
+ )
148
+ {
149
+ return m_Coders[GetState(pos, prevByte)]
150
+ .DecodeWithMatchByte(rangeDecoder, matchByte);
151
+ }
152
+ };
153
+
154
+ LZ.OutWindow m_OutWindow = new LZ.OutWindow();
155
+ RangeCoder.Decoder m_RangeDecoder = new RangeCoder.Decoder();
156
+
157
+ BitDecoder[] m_IsMatchDecoders = new BitDecoder[
158
+ Base.kNumStates << Base.kNumPosStatesBitsMax
159
+ ];
160
+ BitDecoder[] m_IsRepDecoders = new BitDecoder[Base.kNumStates];
161
+ BitDecoder[] m_IsRepG0Decoders = new BitDecoder[Base.kNumStates];
162
+ BitDecoder[] m_IsRepG1Decoders = new BitDecoder[Base.kNumStates];
163
+ BitDecoder[] m_IsRepG2Decoders = new BitDecoder[Base.kNumStates];
164
+ BitDecoder[] m_IsRep0LongDecoders = new BitDecoder[
165
+ Base.kNumStates << Base.kNumPosStatesBitsMax
166
+ ];
167
+
168
+ BitTreeDecoder[] m_PosSlotDecoder = new BitTreeDecoder[Base.kNumLenToPosStates];
169
+ BitDecoder[] m_PosDecoders = new BitDecoder[
170
+ Base.kNumFullDistances - Base.kEndPosModelIndex
171
+ ];
172
+
173
+ BitTreeDecoder m_PosAlignDecoder = new BitTreeDecoder(Base.kNumAlignBits);
174
+
175
+ LenDecoder m_LenDecoder = new LenDecoder();
176
+ LenDecoder m_RepLenDecoder = new LenDecoder();
177
+
178
+ LiteralDecoder m_LiteralDecoder = new LiteralDecoder();
179
+
180
+ uint m_DictionarySize;
181
+ uint m_DictionarySizeCheck;
182
+
183
+ uint m_PosStateMask;
184
+
185
+ public Decoder()
186
+ {
187
+ m_DictionarySize = 0xFFFFFFFF;
188
+ for (int i = 0; i < Base.kNumLenToPosStates; i++)
189
+ m_PosSlotDecoder[i] = new BitTreeDecoder(Base.kNumPosSlotBits);
190
+ }
191
+
192
+ void SetDictionarySize(uint dictionarySize)
193
+ {
194
+ if (m_DictionarySize != dictionarySize)
195
+ {
196
+ m_DictionarySize = dictionarySize;
197
+ m_DictionarySizeCheck = Math.Max(m_DictionarySize, 1);
198
+ uint blockSize = Math.Max(m_DictionarySizeCheck, (1 << 12));
199
+ m_OutWindow.Create(blockSize);
200
+ }
201
+ }
202
+
203
+ void SetLiteralProperties(int lp, int lc)
204
+ {
205
+ if (lp > 8)
206
+ throw new InvalidParamException();
207
+ if (lc > 8)
208
+ throw new InvalidParamException();
209
+ m_LiteralDecoder.Create(lp, lc);
210
+ }
211
+
212
+ void SetPosBitsProperties(int pb)
213
+ {
214
+ if (pb > Base.kNumPosStatesBitsMax)
215
+ throw new InvalidParamException();
216
+ uint numPosStates = (uint)1 << pb;
217
+ m_LenDecoder.Create(numPosStates);
218
+ m_RepLenDecoder.Create(numPosStates);
219
+ m_PosStateMask = numPosStates - 1;
220
+ }
221
+
222
+ bool _solid = false;
223
+
224
+ void Init(System.IO.Stream inStream, System.IO.Stream outStream)
225
+ {
226
+ m_RangeDecoder.Init(inStream);
227
+ m_OutWindow.Init(outStream, _solid);
228
+
229
+ uint i;
230
+ for (i = 0; i < Base.kNumStates; i++)
231
+ {
232
+ for (uint j = 0; j <= m_PosStateMask; j++)
233
+ {
234
+ uint index = (i << Base.kNumPosStatesBitsMax) + j;
235
+ m_IsMatchDecoders[index].Init();
236
+ m_IsRep0LongDecoders[index].Init();
237
+ }
238
+ m_IsRepDecoders[i].Init();
239
+ m_IsRepG0Decoders[i].Init();
240
+ m_IsRepG1Decoders[i].Init();
241
+ m_IsRepG2Decoders[i].Init();
242
+ }
243
+
244
+ m_LiteralDecoder.Init();
245
+ for (i = 0; i < Base.kNumLenToPosStates; i++)
246
+ m_PosSlotDecoder[i].Init();
247
+ // m_PosSpecDecoder.Init();
248
+ for (i = 0; i < Base.kNumFullDistances - Base.kEndPosModelIndex; i++)
249
+ m_PosDecoders[i].Init();
250
+
251
+ m_LenDecoder.Init();
252
+ m_RepLenDecoder.Init();
253
+ m_PosAlignDecoder.Init();
254
+ }
255
+
256
+ public void Code(
257
+ System.IO.Stream inStream,
258
+ System.IO.Stream outStream,
259
+ Int64 inSize,
260
+ Int64 outSize,
261
+ ICodeProgress progress
262
+ )
263
+ {
264
+ Init(inStream, outStream);
265
+
266
+ Base.State state = new Base.State();
267
+ state.Init();
268
+ uint rep0 = 0,
269
+ rep1 = 0,
270
+ rep2 = 0,
271
+ rep3 = 0;
272
+
273
+ UInt64 nowPos64 = 0;
274
+ UInt64 outSize64 = (UInt64)outSize;
275
+ if (nowPos64 < outSize64)
276
+ {
277
+ if (
278
+ m_IsMatchDecoders[state.Index << Base.kNumPosStatesBitsMax]
279
+ .Decode(m_RangeDecoder) != 0
280
+ )
281
+ throw new DataErrorException();
282
+ state.UpdateChar();
283
+ byte b = m_LiteralDecoder.DecodeNormal(m_RangeDecoder, 0, 0);
284
+ m_OutWindow.PutByte(b);
285
+ nowPos64++;
286
+ }
287
+ while (nowPos64 < outSize64)
288
+ {
289
+ // UInt64 next = Math.Min(nowPos64 + (1 << 18), outSize64);
290
+ // while(nowPos64 < next)
291
+ {
292
+ uint posState = (uint)nowPos64 & m_PosStateMask;
293
+ if (
294
+ m_IsMatchDecoders[(state.Index << Base.kNumPosStatesBitsMax) + posState]
295
+ .Decode(m_RangeDecoder) == 0
296
+ )
297
+ {
298
+ byte b;
299
+ byte prevByte = m_OutWindow.GetByte(0);
300
+ if (!state.IsCharState())
301
+ b = m_LiteralDecoder.DecodeWithMatchByte(
302
+ m_RangeDecoder,
303
+ (uint)nowPos64,
304
+ prevByte,
305
+ m_OutWindow.GetByte(rep0)
306
+ );
307
+ else
308
+ b = m_LiteralDecoder.DecodeNormal(
309
+ m_RangeDecoder,
310
+ (uint)nowPos64,
311
+ prevByte
312
+ );
313
+ m_OutWindow.PutByte(b);
314
+ state.UpdateChar();
315
+ nowPos64++;
316
+ }
317
+ else
318
+ {
319
+ uint len;
320
+ if (m_IsRepDecoders[state.Index].Decode(m_RangeDecoder) == 1)
321
+ {
322
+ if (m_IsRepG0Decoders[state.Index].Decode(m_RangeDecoder) == 0)
323
+ {
324
+ if (
325
+ m_IsRep0LongDecoders[
326
+ (state.Index << Base.kNumPosStatesBitsMax) + posState
327
+ ]
328
+ .Decode(m_RangeDecoder) == 0
329
+ )
330
+ {
331
+ state.UpdateShortRep();
332
+ m_OutWindow.PutByte(m_OutWindow.GetByte(rep0));
333
+ nowPos64++;
334
+ continue;
335
+ }
336
+ }
337
+ else
338
+ {
339
+ UInt32 distance;
340
+ if (m_IsRepG1Decoders[state.Index].Decode(m_RangeDecoder) == 0)
341
+ {
342
+ distance = rep1;
343
+ }
344
+ else
345
+ {
346
+ if (m_IsRepG2Decoders[state.Index].Decode(m_RangeDecoder) == 0)
347
+ distance = rep2;
348
+ else
349
+ {
350
+ distance = rep3;
351
+ rep3 = rep2;
352
+ }
353
+ rep2 = rep1;
354
+ }
355
+ rep1 = rep0;
356
+ rep0 = distance;
357
+ }
358
+ len =
359
+ m_RepLenDecoder.Decode(m_RangeDecoder, posState)
360
+ + Base.kMatchMinLen;
361
+ state.UpdateRep();
362
+ }
363
+ else
364
+ {
365
+ rep3 = rep2;
366
+ rep2 = rep1;
367
+ rep1 = rep0;
368
+ len = Base.kMatchMinLen + m_LenDecoder.Decode(m_RangeDecoder, posState);
369
+ state.UpdateMatch();
370
+ uint posSlot = m_PosSlotDecoder[Base.GetLenToPosState(len)]
371
+ .Decode(m_RangeDecoder);
372
+ if (posSlot >= Base.kStartPosModelIndex)
373
+ {
374
+ int numDirectBits = (int)((posSlot >> 1) - 1);
375
+ rep0 = ((2 | (posSlot & 1)) << numDirectBits);
376
+ if (posSlot < Base.kEndPosModelIndex)
377
+ rep0 += BitTreeDecoder.ReverseDecode(
378
+ m_PosDecoders,
379
+ rep0 - posSlot - 1,
380
+ m_RangeDecoder,
381
+ numDirectBits
382
+ );
383
+ else
384
+ {
385
+ rep0 += (
386
+ m_RangeDecoder.DecodeDirectBits(
387
+ numDirectBits - Base.kNumAlignBits
388
+ ) << Base.kNumAlignBits
389
+ );
390
+ rep0 += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder);
391
+ }
392
+ }
393
+ else
394
+ rep0 = posSlot;
395
+ }
396
+ if (
397
+ rep0 >= m_OutWindow.TrainSize + nowPos64
398
+ || rep0 >= m_DictionarySizeCheck
399
+ )
400
+ {
401
+ if (rep0 == 0xFFFFFFFF)
402
+ break;
403
+ throw new DataErrorException();
404
+ }
405
+ m_OutWindow.CopyBlock(rep0, len);
406
+ nowPos64 += len;
407
+ }
408
+ }
409
+ }
410
+ m_OutWindow.Flush();
411
+ m_OutWindow.ReleaseStream();
412
+ m_RangeDecoder.ReleaseStream();
413
+ }
414
+
415
+ public void SetDecoderProperties(byte[] properties)
416
+ {
417
+ if (properties.Length < 5)
418
+ throw new InvalidParamException();
419
+ int lc = properties[0] % 9;
420
+ int remainder = properties[0] / 9;
421
+ int lp = remainder % 5;
422
+ int pb = remainder / 5;
423
+ if (pb > Base.kNumPosStatesBitsMax)
424
+ throw new InvalidParamException();
425
+ UInt32 dictionarySize = 0;
426
+ for (int i = 0; i < 4; i++)
427
+ dictionarySize += ((UInt32)(properties[1 + i])) << (i * 8);
428
+ SetDictionarySize(dictionarySize);
429
+ SetLiteralProperties(lp, lc);
430
+ SetPosBitsProperties(pb);
431
+ }
432
+
433
+ public bool Train(System.IO.Stream stream)
434
+ {
435
+ _solid = true;
436
+ return m_OutWindow.Train(stream);
437
+ }
438
+
439
+ /*
440
+ public override bool CanRead { get { return true; }}
441
+ public override bool CanWrite { get { return true; }}
442
+ public override bool CanSeek { get { return true; }}
443
+ public override long Length { get { return 0; }}
444
+ public override long Position
445
+ {
446
+ get { return 0; }
447
+ set { }
448
+ }
449
+ public override void Flush() { }
450
+ public override int Read(byte[] buffer, int offset, int count)
451
+ {
452
+ return 0;
453
+ }
454
+ public override void Write(byte[] buffer, int offset, int count)
455
+ {
456
+ }
457
+ public override long Seek(long offset, System.IO.SeekOrigin origin)
458
+ {
459
+ return 0;
460
+ }
461
+ public override void SetLength(long value) {}
462
+ */
463
+ }
464
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: bd42543fc7d20e0458ca8a179aae4886
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: