Skip to content

Commit d0f8057

Browse files
committed
Expose index type
1 parent b8b8121 commit d0f8057

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

TACTSharp/Extensions/SpanExtensions.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Runtime.CompilerServices;
5-
using System.Text;
6-
using System.Threading.Tasks;
1+
using System.Runtime.CompilerServices;
72

83
namespace TACTSharp.Extensions
94
{

TACTSharp/IndexInstance.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ public sealed class IndexInstance
99
private readonly long indexSize;
1010
private IndexFooter footer;
1111
private readonly short archiveIndex = -1;
12-
private readonly bool isFileIndex;
13-
private readonly bool isGroupArchive;
12+
public readonly bool isFileIndex;
13+
public readonly bool isCDNIndex;
14+
public readonly bool isGroupIndex;
1415

1516
private readonly MemoryMappedFile indexFile;
1617
private readonly MemoryMappedViewAccessor accessor;
@@ -37,7 +38,8 @@ public IndexInstance(string path, short archiveIndex = -1)
3738
accessor.Read(0, out footer);
3839

3940
isFileIndex = footer.offsetBytes == 0;
40-
isGroupArchive = footer.offsetBytes == 6;
41+
isCDNIndex = footer.offsetBytes == 4;
42+
isGroupIndex = footer.offsetBytes == 6;
4143

4244
this.blockSizeBytes = footer.blockSizeKBytes << 10;
4345
this.entrySize = footer.keyBytes + footer.sizeBytes + footer.offsetBytes;
@@ -98,7 +100,7 @@ public IndexInstance(string path, short archiveIndex = -1)
98100
var archiveIndex = this.archiveIndex;
99101

100102
// TODO: Patch group archive?
101-
if (isGroupArchive)
103+
if (isGroupIndex)
102104
{
103105
size = entry.Slice(footer.keyBytes, footer.sizeBytes).ReadInt32BE();
104106
archiveIndex = entry.Slice(footer.keyBytes + footer.sizeBytes, 2).ReadInt16BE();
@@ -161,7 +163,7 @@ unsafe public (int offset, int size, int archiveIndex) GetIndexInfo(ReadOnlySpan
161163
return (-1, -1, -1);
162164

163165
// TODO: Patch group archive?
164-
if (isGroupArchive)
166+
if (isGroupIndex)
165167
{
166168
var encodedSize = entry.Slice(footer.keyBytes, footer.sizeBytes).ReadInt32BE();
167169
var fileArchiveIndex = entry.Slice(footer.keyBytes + footer.sizeBytes, 2).ReadInt16BE();

0 commit comments

Comments
 (0)