Add POD archive file format used in Microsoft's Hellbender video game
This commit is contained in:
parent
11cc52a9d7
commit
35da00c4f7
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UniversalEditor Version="4.0">
|
||||
<Associations>
|
||||
<Association>
|
||||
<Filters>
|
||||
<Filter Title="Microsoft POD archive">
|
||||
<FileNameFilters>
|
||||
<FileNameFilter>*.pod</FileNameFilter>
|
||||
</FileNameFilters>
|
||||
</Filter>
|
||||
</Filters>
|
||||
<ObjectModels>
|
||||
<ObjectModel TypeName="UniversalEditor.ObjectModels.FileSystem.FileSystemObjectModel" />
|
||||
</ObjectModels>
|
||||
<DataFormats>
|
||||
<DataFormat TypeName="UniversalEditor.DataFormats.FileSystem.Microsoft.POD.PODDataFormat" />
|
||||
</DataFormats>
|
||||
</Association>
|
||||
</Associations>
|
||||
</UniversalEditor>
|
||||
@ -658,6 +658,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Extensions\GameDeveloper\Extensions\SEGA\DataFormats\SegaFARC.uexml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Extensions\FileSystem\Associations\Microsoft\POD.uexml" />
|
||||
</ItemGroup>
|
||||
<Target Name="Build">
|
||||
<Copy SourceFiles="@(Content)" DestinationFiles="@(Content->'$(OutputPath)%(RelativeDir)%(Filename)%(Extension)')" />
|
||||
</Target>
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using UniversalEditor.IO;
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
using UniversalEditor.ObjectModels.FileSystem.FileSources;
|
||||
|
||||
namespace UniversalEditor.DataFormats.FileSystem.Microsoft.POD
|
||||
{
|
||||
public class PODDataFormat : DataFormat
|
||||
{
|
||||
private static DataFormatReference _dfr = null;
|
||||
protected override DataFormatReference MakeReferenceInternal()
|
||||
{
|
||||
if (_dfr == null)
|
||||
{
|
||||
_dfr = base.MakeReferenceInternal();
|
||||
_dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All);
|
||||
}
|
||||
return _dfr;
|
||||
}
|
||||
|
||||
private string mvarComment = String.Empty;
|
||||
public string Comment { get { return mvarComment; } set { mvarComment = value; } }
|
||||
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) throw new ObjectModelNotSupportedException();
|
||||
|
||||
Reader reader = base.Accessor.Reader;
|
||||
int fileCount = reader.ReadInt32();
|
||||
mvarComment = reader.ReadFixedLengthString(80).TrimNull();
|
||||
|
||||
for (int i = 0; i < fileCount; i++)
|
||||
{
|
||||
string fileName = reader.ReadFixedLengthString(32).TrimNull();
|
||||
|
||||
int length = reader.ReadInt32();
|
||||
int offset = reader.ReadInt32();
|
||||
|
||||
File file = fsom.AddFile(fileName);
|
||||
file.Size = length;
|
||||
file.Source = new EmbeddedFileSource(reader, offset, length);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null) throw new ObjectModelNotSupportedException();
|
||||
|
||||
Writer writer = base.Accessor.Writer;
|
||||
|
||||
File[] files = fsom.GetAllFiles();
|
||||
writer.WriteInt32(files.Length);
|
||||
|
||||
writer.WriteFixedLengthString(mvarComment, 80);
|
||||
|
||||
int offset = 84 + (40 * files.Length);
|
||||
|
||||
foreach (File file in files)
|
||||
{
|
||||
writer.WriteFixedLengthString(file.Name, 32);
|
||||
|
||||
int length = (int)file.Source.GetLength();
|
||||
writer.WriteInt32(length);
|
||||
writer.WriteInt32(offset);
|
||||
|
||||
offset += length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -51,6 +51,7 @@
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\MSCompressed\MSCompressedDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\MSCompressed\MSCompressedKWAJCompressionMethod.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\MSCompressed\MSCompressedKWAJHeaderFlags.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\POD\PODDataFormat.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\WindowsImage\WIMArchiveFlags.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\WindowsImage\WIMArchiveHeader.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\Microsoft\WindowsImage\WIMDataFormat.cs" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user