diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/AlienNations/GD/GDDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/AlienNations/GD/GDDataFormat.cs new file mode 100644 index 00000000..336cae82 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/AlienNations/GD/GDDataFormat.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UniversalEditor.ObjectModels.FileSystem; + +namespace UniversalEditor.DataFormats.FileSystem.AlienNations.GD +{ + public class GDDataFormat : DataFormat + { + private static DataFormatReference _dfr = null; + public override DataFormatReference MakeReference() + { + if (_dfr == null) + { + _dfr = base.MakeReference(); + _dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All); + _dfr.Filters.Add("Alien Nations GD archive", new string[] { "*.gd" }); + } + return _dfr; + } + + protected override void LoadInternal(ref ObjectModel objectModel) + { + FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); + if (fsom == null) throw new ObjectModelNotSupportedException(); + + IO.Reader reader = base.Accessor.Reader; + uint archiveHeaderLength = reader.ReadUInt32(); + if (archiveHeaderLength != 24) throw new InvalidDataFormatException("Archive header length is not equal to 24!"); + + uint fileNameDirectoryOffset = reader.ReadUInt32(); + uint fileNameOffsetsDirectoryOffset = reader.ReadUInt32(); + uint fileEntriesDirectoryOffset = reader.ReadUInt32(); + uint fileDataOffset = reader.ReadUInt32(); + uint fileCount = reader.ReadUInt32(); + + string[] fileNames = new string[fileCount]; + uint[] fileNameRelativeOffsets = new uint[fileCount]; + ulong[] fileDataOffsets = new ulong[fileCount]; + + #region FileNameDirectory + { + reader.Seek(fileNameDirectoryOffset, IO.SeekOrigin.Begin); + for (uint i = 0; i < fileCount; i++) + { + fileNames[i] = reader.ReadNullTerminatedString(); + } + } + #endregion + #region FileNameOffsetsDirectory + { + for (uint i = 0; i < fileCount; i++) + { + fileNameRelativeOffsets[i] = reader.ReadUInt32(); + } + } + #endregion + #region FileEntriesDirectory + { + for (uint i = 0; i < fileCount; i++) + { + ulong unknown1 = reader.ReadUInt64(); // 12 + uint fileID = reader.ReadUInt32(); + uint unknown2 = reader.ReadUInt32(); // 52 + uint unknown3 = reader.ReadUInt32(); + uint unknown4 = reader.ReadUInt32(); + uint unknown5 = reader.ReadUInt32(); + uint unknown6 = reader.ReadUInt32(); + uint unknown7 = reader.ReadUInt32(); + uint unknown8 = reader.ReadUInt32(); + uint unknown9 = reader.ReadUInt32(); + uint unknown10 = reader.ReadUInt32(); + uint unknown11 = reader.ReadUInt32(); + ushort unknown12 = reader.ReadUInt16(); + ushort unknown13 = reader.ReadUInt16(); + fileDataOffsets[i] = reader.ReadUInt64(); + } + } + #endregion + + throw new NotImplementedException(); + } + + protected override void SaveInternal(ObjectModel objectModel) + { + throw new NotImplementedException(); + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/Aquarnoid/GOB/GOBDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/Aquarnoid/GOB/GOBDataFormat.cs new file mode 100644 index 00000000..e3a1a5b7 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/Aquarnoid/GOB/GOBDataFormat.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UniversalEditor.ObjectModels.FileSystem; + +namespace UniversalEditor.DataFormats.FileSystem.Aquarnoid.GOB +{ + public class GOBDataFormat : DataFormat + { + private static DataFormatReference _dfr = null; + public override DataFormatReference MakeReference() + { + if (_dfr == null) + { + _dfr = base.MakeReference(); + _dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All); + _dfr.Filters.Add("Aquarnoid GOB archive", new byte?[][] { new byte?[] { (byte)'G', (byte)'O', (byte)'B', (byte)0 } }, new string[] { "*.gob" }); + } + return _dfr; + } + + + protected override void LoadInternal(ref ObjectModel objectModel) + { + FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); + if (fsom == null) throw new ObjectModelNotSupportedException(); + + IO.Reader reader = base.Accessor.Reader; + string GOB_ = reader.ReadFixedLengthString(4); + if (GOB_ != "GOB\0") throw new InvalidDataFormatException("File does not begin with \"GOB\", 0"); + + uint fileCount = reader.ReadUInt32(); + for (uint i = 0; i < fileCount; i++) + { + uint offset = reader.ReadUInt32(); + uint length = reader.ReadUInt32(); + string fileName = reader.ReadFixedLengthString(260).TrimNull(); + + File file = fsom.AddFile(fileName); + file.Properties.Add("offset", offset); + file.Properties.Add("length", length); + file.Properties.Add("reader", reader); + file.Size = length; + file.DataRequest += file_DataRequest; + } + } + + private void file_DataRequest(object sender, DataRequestEventArgs e) + { + File file = (sender as File); + uint offset = (uint)file.Properties["offset"]; + uint length = (uint)file.Properties["length"]; + IO.Reader reader = (IO.Reader)file.Properties["reader"]; + + reader.Seek(offset, IO.SeekOrigin.Begin); + e.Data = reader.ReadBytes(length); + } + + protected override void SaveInternal(ObjectModel objectModel) + { + FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); + if (fsom == null) throw new ObjectModelNotSupportedException(); + + IO.Writer writer = base.Accessor.Writer; + writer.WriteFixedLengthString("GOB\0"); + + File[] files = fsom.GetAllFiles(); + writer.WriteUInt32((uint)files.Length); + + uint offset = (uint)(8 + (268 * files.Length)); + foreach (File file in files) + { + writer.WriteUInt32(offset); + writer.WriteUInt32((uint)(file.GetDataAsByteArray().Length)); + writer.WriteFixedLengthString(file.Name, 260); + } + foreach (File file in files) + { + writer.WriteBytes(file.GetDataAsByteArray()); + } + writer.Flush(); + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/GOB/GOBDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/IndianaJones/GOB/GOBDataFormat.cs similarity index 93% rename from CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/GOB/GOBDataFormat.cs rename to CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/IndianaJones/GOB/GOBDataFormat.cs index 39440bf5..d291cb25 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/GOB/GOBDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/IndianaJones/GOB/GOBDataFormat.cs @@ -5,7 +5,7 @@ using System.Text; using UniversalEditor.IO; using UniversalEditor.ObjectModels.FileSystem; -namespace UniversalEditor.DataFormats.FileSystem.GOB +namespace UniversalEditor.DataFormats.FileSystem.IndianaJones.GOB { public class GOBDataFormat : DataFormat { @@ -16,7 +16,7 @@ namespace UniversalEditor.DataFormats.FileSystem.GOB { _dfr = base.MakeReference(); _dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All); - _dfr.Filters.Add("Indiana Jones And The Infernal Machine GOB archive", new string[] { "*.gob" }); + _dfr.Filters.Add("Indiana Jones And The Infernal Machine GOB archive", new byte?[][] { new byte?[] { (byte)'G', (byte)'O', (byte)'B', (byte)' ' } }, new string[] { "*.gob" }); } return _dfr; } diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/UniversalEditor.Plugins.FileSystem.csproj b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/UniversalEditor.Plugins.FileSystem.csproj index f64c4370..bc384f56 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/UniversalEditor.Plugins.FileSystem.csproj +++ b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/UniversalEditor.Plugins.FileSystem.csproj @@ -34,6 +34,7 @@ + @@ -41,6 +42,7 @@ + @@ -81,7 +83,7 @@ - + diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Monolith/DataFormats/FileSystem/Monolith/REZ/REZDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Monolith/DataFormats/FileSystem/Monolith/REZ/REZDataFormat.cs new file mode 100644 index 00000000..892288b4 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Monolith/DataFormats/FileSystem/Monolith/REZ/REZDataFormat.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UniversalEditor.ObjectModels.FileSystem; + +namespace UniversalEditor.Plugins.Monolith.DataFormats.FileSystem.Monolith.REZ +{ + public class REZDataFormat : DataFormat + { + private static DataFormatReference _dfr = null; + public override DataFormatReference MakeReference() + { + if (_dfr == null) + { + _dfr = base.MakeReference(); + _dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All); + _dfr.ExportOptions.Add(new CustomOptionText("Description", "&Description:", String.Empty, 127)); + _dfr.Sources.Add("http://wiki.xentax.com/index.php?title=Monolith_REZ"); + _dfr.Filters.Add("Monolith Productions REZ archive", new string[] { "*.rez" }); + } + return _dfr; + } + + private string mvarDescription = String.Empty; + public string Description { get { return mvarDescription; } set { mvarDescription = value; } } + + private uint mvarFormatVersion = 1; + public uint FormatVersion { get { return mvarFormatVersion; } set { mvarFormatVersion = value; } } + + protected override void LoadInternal(ref ObjectModel objectModel) + { + FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); + if (fsom == null) throw new ObjectModelNotSupportedException(); + + IO.Reader reader = base.Accessor.Reader; + mvarDescription = reader.ReadFixedLengthString(127); + mvarFormatVersion = reader.ReadUInt32(); + + uint diroffset = reader.ReadUInt32(); + uint dirsize = reader.ReadUInt32(); + + throw new NotImplementedException(); + } + + protected override void SaveInternal(ObjectModel objectModel) + { + FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel); + if (fsom == null) throw new ObjectModelNotSupportedException(); + + File[] allfiles = fsom.GetAllFiles(); + + IO.Writer writer = base.Accessor.Writer; + writer.WriteFixedLengthString(mvarDescription, 127); + writer.WriteUInt32(mvarFormatVersion); + + uint diroffset = 184; // 127 + (11 * 4) + 13 + uint dirsize = 0; + + foreach (File file in fsom.Files) + { + diroffset += (uint)file.GetDataAsByteArray().Length; + + } + throw new NotImplementedException(); + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Monolith/Properties/AssemblyInfo.cs b/CSharp/Plugins/UniversalEditor.Plugins.Monolith/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..884dae5e --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Monolith/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("UniversalEditor.Plugins.Monolith")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("City of Orlando")] +[assembly: AssemblyProduct("UniversalEditor.Plugins.Monolith")] +[assembly: AssemblyCopyright("Copyright © City of Orlando 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f6375ea2-60ab-464d-8f32-eefe1533f348")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Monolith/UniversalEditor.Plugins.Monolith.csproj b/CSharp/Plugins/UniversalEditor.Plugins.Monolith/UniversalEditor.Plugins.Monolith.csproj new file mode 100644 index 00000000..c8051c5f --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Monolith/UniversalEditor.Plugins.Monolith.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {988052D4-92F5-4A6F-BE1D-33852D1E5D1E} + Library + Properties + UniversalEditor + UniversalEditor.Plugins.Monolith + v3.5 + 512 + + + true + full + false + ..\..\Output\Debug\Plugins\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\Output\Release\Plugins\ + TRACE + prompt + 4 + + + + + + + + + + + + {2d4737e6-6d95-408a-90db-8dff38147e85} + UniversalEditor.Core + + + {30467e5c-05bc-4856-aadc-13906ef4cadd} + UniversalEditor.Essential + + + + + \ No newline at end of file diff --git a/CSharp/UniversalEditor.sln b/CSharp/UniversalEditor.sln index 8b03fd6f..31e6e40e 100644 --- a/CSharp/UniversalEditor.sln +++ b/CSharp/UniversalEditor.sln @@ -93,6 +93,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Mic EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Microsoft.VisualStudio", "Plugins\UniversalEditor.Plugins.Microsoft.VisualStudio\UniversalEditor.Plugins.Microsoft.VisualStudio.csproj", "{E6C9A73D-4556-4220-9BC7-302A7EE64C1A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Monolith", "Plugins\UniversalEditor.Plugins.Monolith\UniversalEditor.Plugins.Monolith.csproj", "{988052D4-92F5-4A6F-BE1D-33852D1E5D1E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -319,6 +321,12 @@ Global {E6C9A73D-4556-4220-9BC7-302A7EE64C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {E6C9A73D-4556-4220-9BC7-302A7EE64C1A}.Release|Any CPU.Build.0 = Release|Any CPU {E6C9A73D-4556-4220-9BC7-302A7EE64C1A}.Release|x86.ActiveCfg = Release|Any CPU + {988052D4-92F5-4A6F-BE1D-33852D1E5D1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {988052D4-92F5-4A6F-BE1D-33852D1E5D1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {988052D4-92F5-4A6F-BE1D-33852D1E5D1E}.Debug|x86.ActiveCfg = Debug|Any CPU + {988052D4-92F5-4A6F-BE1D-33852D1E5D1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {988052D4-92F5-4A6F-BE1D-33852D1E5D1E}.Release|Any CPU.Build.0 = Release|Any CPU + {988052D4-92F5-4A6F-BE1D-33852D1E5D1E}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -353,6 +361,7 @@ Global {BED1EEAF-9ADD-46F6-92D0-53957858E25B} = {71CFF024-26F7-4626-A526-B435FDF8D64E} {9F1FDC26-5F1C-4C2A-BBBF-3A597A72802D} = {71CFF024-26F7-4626-A526-B435FDF8D64E} {E6C9A73D-4556-4220-9BC7-302A7EE64C1A} = {71CFF024-26F7-4626-A526-B435FDF8D64E} + {988052D4-92F5-4A6F-BE1D-33852D1E5D1E} = {71CFF024-26F7-4626-A526-B435FDF8D64E} {FE016EA3-DC31-4A92-8B0A-8C746EC117E1} = {46041F27-7C1C-4209-B72B-251EDB5D4C61} {C1F34183-7A2F-41A6-9958-F6F329099654} = {A846CA33-9CAA-4237-B14F-8721DBA89442} {5A423A3E-51C5-4188-8AD5-FB5C0CB76C6A} = {C1F34183-7A2F-41A6-9958-F6F329099654}