yet another ancient PC video game file format plugin
This commit is contained in:
parent
2a5af21d06
commit
fdaf7720c3
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UniversalEditor Version="4.0">
|
||||
<Associations>
|
||||
<Association>
|
||||
<Filters>
|
||||
<Filter Title="Dweep DAT archive" ContentType="application/x-dweep-dat">
|
||||
<FileNameFilters>
|
||||
<FileNameFilter>*.dat</FileNameFilter>
|
||||
</FileNameFilters>
|
||||
</Filter>
|
||||
</Filters>
|
||||
<ObjectModels>
|
||||
<ObjectModel TypeName="UniversalEditor.ObjectModels.FileSystem.FileSystemObjectModel" />
|
||||
</ObjectModels>
|
||||
<DataFormats>
|
||||
<DataFormat TypeName="UniversalEditor.Plugins.Dweep.DataFormats.FileSystem.DAT.DweepDATDataFormat" />
|
||||
</DataFormats>
|
||||
</Association>
|
||||
</Associations>
|
||||
</UniversalEditor>
|
||||
@ -0,0 +1,95 @@
|
||||
//
|
||||
// DweepDATDataFormat.cs - provides a DataFormat for reading and writing Dweep DAT archives
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
using UniversalEditor.ObjectModels.FileSystem.FileSources;
|
||||
|
||||
namespace UniversalEditor.Plugins.Dweep.DataFormats.FileSystem.DAT
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a <see cref="DataFormat" /> for reading and writing Dweep
|
||||
/// DAT archives.
|
||||
/// </summary>
|
||||
[DataFormatImplementationStatus(ImplementationStatus.Complete)]
|
||||
public class DweepDATDataFormat : 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;
|
||||
}
|
||||
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null)
|
||||
throw new ObjectModelNotSupportedException();
|
||||
|
||||
uint filecount = Accessor.Reader.ReadUInt32();
|
||||
|
||||
uint thisFileOffset = Accessor.Reader.ReadUInt32();
|
||||
for (uint i = 0; i < filecount - 1; i++)
|
||||
{
|
||||
string filename = Accessor.Reader.ReadFixedLengthString(13).TrimNull();
|
||||
uint nextFileOffset = Accessor.Reader.ReadUInt32();
|
||||
|
||||
uint length = nextFileOffset - thisFileOffset;
|
||||
|
||||
File file = fsom.AddFile(filename);
|
||||
file.Source = new EmbeddedFileSource(Accessor.Reader, thisFileOffset, length);
|
||||
|
||||
thisFileOffset = nextFileOffset;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
FileSystemObjectModel fsom = (objectModel as FileSystemObjectModel);
|
||||
if (fsom == null)
|
||||
throw new ObjectModelNotSupportedException();
|
||||
|
||||
File[] files = fsom.GetAllFiles();
|
||||
Accessor.Writer.WriteUInt32((uint)(files.Length + 1));
|
||||
|
||||
uint offset = (uint)(((files.Length + 1) * 17) + 4);
|
||||
Accessor.Writer.WriteUInt32(offset);
|
||||
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
Accessor.Writer.WriteFixedLengthString(files[i].Name, 13);
|
||||
Accessor.Writer.WriteUInt32((uint)(offset + files[i].Size));
|
||||
offset += (uint)files[i].Size;
|
||||
}
|
||||
|
||||
Accessor.Writer.WriteFixedLengthString(String.Empty, 13);
|
||||
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
Accessor.Writer.WriteBytes(files[i].GetData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("Universal Editor plugin for Dweep")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Mike Becker's Software")]
|
||||
[assembly: AssemblyProduct("Universal Editor Plugin Pack")]
|
||||
[assembly: AssemblyCopyright("Mike Becker's Software")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9496A94E-F386-4787-818F-FFB04A8EA892}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>UniversalEditor.Plugins.Dweep</RootNamespace>
|
||||
<AssemblyName>UniversalEditor.Plugins.Dweep</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<ReleaseVersion>4.0.2019.12</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\DAT\DweepDATDataFormat.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="DataFormats\" />
|
||||
<Folder Include="DataFormats\FileSystem\" />
|
||||
<Folder Include="DataFormats\FileSystem\DAT\" />
|
||||
<Folder Include="Associations\" />
|
||||
<Folder Include="Associations\FileSystem\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2D4737E6-6D95-408A-90DB-8DFF38147E85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467E5C-05BC-4856-AADC-13906EF4CADD}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Associations\FileSystem\DAT.uexml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@ -219,6 +219,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Sha
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.SwarmAssault", "Plugins\UniversalEditor.Plugins.SwarmAssault\UniversalEditor.Plugins.SwarmAssault.csproj", "{A3D15C91-8D55-4F02-87DC-A1C5E63B8C56}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Dweep", "Plugins\UniversalEditor.Plugins.Dweep\UniversalEditor.Plugins.Dweep.csproj", "{9496A94E-F386-4787-818F-FFB04A8EA892}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -635,6 +637,10 @@ Global
|
||||
{A3D15C91-8D55-4F02-87DC-A1C5E63B8C56}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A3D15C91-8D55-4F02-87DC-A1C5E63B8C56}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A3D15C91-8D55-4F02-87DC-A1C5E63B8C56}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{6F0AB1AF-E1A1-4D19-B19C-05BBB15C94B2} = {05D15661-E684-4EC9-8FBD-C014BA433CC5}
|
||||
@ -739,6 +745,7 @@ Global
|
||||
{29F3E82C-CF84-4966-91BF-152D3BCC2117} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{5763E226-26B9-4FAA-8305-4F48E61357E9} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{A3D15C91-8D55-4F02-87DC-A1C5E63B8C56} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user