This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
using System.Text.RegularExpressions; | |
using System.Linq; | |
using ICSharpCode.SharpZipLib.Zip.Compression.Streams; | |
using System.IO.Compression; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iterate each sample file | |
foreach (var sample in Directory.GetFiles(@"C:\Users\temp\Downloads\sample")) | |
{ | |
// open the file stream and create a reader | |
using var stream = File.OpenRead(sample); | |
using var reader = new BinaryReader(stream); | |
// read the header | |
var magic = reader.ReadString(4); | |
var fileTableCompressedSize = reader.ReadInt32(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PackageItemType; | |
(function (PackageItemType) { | |
PackageItemType[PackageItemType["Image"] = 0] = "Image"; | |
PackageItemType[PackageItemType["MovieClip"] = 1] = "MovieClip"; | |
PackageItemType[PackageItemType["Sound"] = 2] = "Sound"; | |
PackageItemType[PackageItemType["Component"] = 3] = "Component"; | |
PackageItemType[PackageItemType["Atlas"] = 4] = "Atlas"; | |
PackageItemType[PackageItemType["Font"] = 5] = "Font"; | |
PackageItemType[PackageItemType["Swf"] = 6] = "Swf"; | |
PackageItemType[PackageItemType["Misc"] = 7] = "Misc"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MukArchive { | |
uint16 version | |
uint16 fileCount | |
uint32 fileNameLength; // unused, game always uses 8 | |
FileInfo fileInfos[fileCount]; | |
byte fileData[x]; | |
} | |
struct FileInfo { | |
char Name[8]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsafe static class FastLZ | |
{ | |
private const int MAX_COPY = 32; | |
private const int MAX_LEN = 264; /* 256 + 8 */ | |
private const uint MAX_L1_DISTANCE = 8192; | |
private const uint MAX_L2_DISTANCE = 8191; | |
private const uint MAX_FARDISTANCE = 65535 + MAX_L2_DISTANCE - 1; | |
private const int HASH_LOG = 14; | |
private const int HASH_SIZE = 1 << HASH_LOG; | |
private const uint HASH_MASK = HASH_SIZE - 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WELL512 | |
{ | |
private readonly uint[] State; | |
private int Index; | |
public WELL512(uint seed) | |
{ | |
Index = 0; | |
State = new uint[16]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
namespace ConsoleAppFramework | |
{ | |
class StarskyHutchBTW : FileStream | |
{ | |
public readonly BTWHeader Header; | |
public readonly BTWOffsets Offsets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FileStream fs = File.OpenRead(@"D:\Games\The Nations Gold\dump\file691_gami_MM_VK2_00.tga"); | |
ushort width = fs.Read<ushort>(); | |
ushort height = fs.Read<ushort>(); | |
fs.Position = 20; // not needed | |
// convert the remaining data to a uint16 array | |
int inputSize = (int)(fs.Length - 20) / 2; | |
ushort[] input = fs.Read<ushort>(inputSize); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Diagnostics.CodeAnalysis; | |
using System.IO; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
namespace ConsoleApp2 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
namespace Parser | |
{ | |
public class CombinedFile : FileStream | |
{ | |
public IEnumerable<string> Files => TOC.Keys; |