diff --git a/MixBrowser/Program.cs b/MixBrowser/Program.cs index 3f98366ea0..fb2b6f87c9 100644 --- a/MixBrowser/Program.cs +++ b/MixBrowser/Program.cs @@ -33,15 +33,15 @@ namespace MixBrowser return; } - MixFile file = new MixFile(fn); + Package file = new Package(fn); if (File.Exists("files.txt")) foreach (string filename in File.ReadAllLines("files.txt")) - MixEntry.AddStandardName(filename); + PackageEntry.AddStandardName(filename); else Console.WriteLine("-- files.txt doesnt exist --"); - foreach (MixEntry e in file.Content) + foreach (PackageEntry e in file.Content) Console.WriteLine(e); } } diff --git a/OpenRa.FileFormats/OpenRa.FileFormats.csproj b/OpenRa.FileFormats/OpenRa.FileFormats.csproj index 724b33e19a..446e0b62f0 100644 --- a/OpenRa.FileFormats/OpenRa.FileFormats.csproj +++ b/OpenRa.FileFormats/OpenRa.FileFormats.csproj @@ -37,8 +37,8 @@ - - + + diff --git a/OpenRa.FileFormats/MixFile.cs b/OpenRa.FileFormats/Package.cs similarity index 79% rename from OpenRa.FileFormats/MixFile.cs rename to OpenRa.FileFormats/Package.cs index c721b2ac9f..ae376d749b 100644 --- a/OpenRa.FileFormats/MixFile.cs +++ b/OpenRa.FileFormats/Package.cs @@ -5,18 +5,18 @@ using System.IO; namespace OpenRa.FileFormats { - public class MixFile + public class Package { readonly string filename; - readonly List index; + readonly List index; readonly bool isRmix, isEncrypted; - public ICollection Content + public ICollection Content { get { return index.AsReadOnly(); } } - public MixFile(string filename) + public Package(string filename) { this.filename = filename; using (Stream s = File.OpenRead(filename)) @@ -40,7 +40,7 @@ namespace OpenRa.FileFormats } } - List ParseRaHeader(Stream s) + List ParseRaHeader(Stream s) { if (!isEncrypted) { @@ -75,7 +75,7 @@ namespace OpenRa.FileFormats s.Position = headerStart; reader = new BinaryReader(s); - h = ReadUints(reader, 2 + numFiles * MixEntry.Size / 4); + h = ReadUints(reader, 2 + numFiles * PackageEntry.Size / 4); decrypted = fish.Decrypt(h); ms = new MemoryStream(); @@ -98,23 +98,23 @@ namespace OpenRa.FileFormats return ret; } - List ParseTdHeader(Stream s) + List ParseTdHeader(Stream s) { - List items = new List(); + List items = new List(); BinaryReader reader = new BinaryReader(s); ushort numFiles = reader.ReadUInt16(); uint dataSize = reader.ReadUInt32(); for (int i = 0; i < numFiles; i++) - items.Add(new MixEntry(reader)); + items.Add(new PackageEntry(reader)); return items; } public Stream GetContent(uint hash) { - foreach( MixEntry e in index ) + foreach( PackageEntry e in index ) if (e.Hash == hash) { using (Stream s = File.OpenRead(filename)) @@ -126,7 +126,7 @@ namespace OpenRa.FileFormats if (isEncrypted) s.Seek(80, SeekOrigin.Current); - s.Seek(index.Count * MixEntry.Size + e.Offset, SeekOrigin.Current); + s.Seek(index.Count * PackageEntry.Size + e.Offset, SeekOrigin.Current); byte[] data = new byte[ e.Length ]; s.Read( data, 0, (int)e.Length ); return new MemoryStream(data); @@ -138,7 +138,7 @@ namespace OpenRa.FileFormats public Stream GetContent(string filename) { - return GetContent(MixEntry.HashFilename(filename)); + return GetContent(PackageEntry.HashFilename(filename)); } } diff --git a/OpenRa.FileFormats/MixEntry.cs b/OpenRa.FileFormats/PackageEntry.cs similarity index 91% rename from OpenRa.FileFormats/MixEntry.cs rename to OpenRa.FileFormats/PackageEntry.cs index 642f5ec992..b70e3fc1f9 100644 --- a/OpenRa.FileFormats/MixEntry.cs +++ b/OpenRa.FileFormats/PackageEntry.cs @@ -5,13 +5,13 @@ using System.IO; namespace OpenRa.FileFormats { - public class MixEntry + public class PackageEntry { public readonly uint Hash; public readonly uint Offset; public readonly uint Length; - public MixEntry(BinaryReader r) + public PackageEntry(BinaryReader r) { Hash = r.ReadUInt32(); Offset = r.ReadUInt32();