Added more FileSystem DataFormats
This commit is contained in:
parent
6af7ac629e
commit
7622791eb1
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -34,6 +34,7 @@
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataFormats\FileSystem\AlienNations\GD\GDDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ALTools\ALZ\ALZDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ALTools\EGG\ALZipCompressionMethod.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ALTools\EGG\ALZipFileAttributeFlags.cs" />
|
||||
@ -41,6 +42,7 @@
|
||||
<Compile Include="DataFormats\FileSystem\ALTools\EGG\EGGDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ALTools\EGG\Internal\BlockInfo.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ALTools\EGG\Internal\FileInfo.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Aquarnoid\GOB\GOBDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ARC\ARCDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ARJ\ARJCompressionMethod.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ARJ\ARJDataFormat.cs" />
|
||||
@ -81,7 +83,7 @@
|
||||
<Compile Include="DataFormats\FileSystem\FSB\FSBDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Garena\YanghxDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\GCD\GCDDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\GOB\GOBDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\IndianaJones\GOB\GOBDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\GPW\GPWDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Hardball\MB6DataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\HighwayPursuit\HighwayPursuitDataFormat.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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")]
|
||||
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{988052D4-92F5-4A6F-BE1D-33852D1E5D1E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UniversalEditor</RootNamespace>
|
||||
<AssemblyName>UniversalEditor.Plugins.Monolith</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataFormats\FileSystem\Monolith\REZ\REZDataFormat.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2d4737e6-6d95-408a-90db-8dff38147e85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467e5c-05bc-4856-aadc-13906ef4cadd}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@ -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}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user