Skip to content

Commit

Permalink
Convert spaces to tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
ZwipZwapZapony committed Aug 5, 2024
1 parent 9cd5220 commit 0dcbff3
Show file tree
Hide file tree
Showing 16 changed files with 1,720 additions and 1,720 deletions.
8 changes: 4 additions & 4 deletions DOOMExtract/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
130 changes: 65 additions & 65 deletions DOOMExtract/DOOMExtract.csproj
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>{3B92A677-1D52-445E-A1D2-E228FB3DF706}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DOOMExtract</RootNamespace>
<AssemblyName>DOOMExtract</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DOOMResourceEntry.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DOOMResourceIndex.cs" />
<Compile Include="EndianIO.cs" />
<Compile Include="Utility.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</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>
<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>{3B92A677-1D52-445E-A1D2-E228FB3DF706}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DOOMExtract</RootNamespace>
<AssemblyName>DOOMExtract</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DOOMResourceEntry.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DOOMResourceIndex.cs" />
<Compile Include="EndianIO.cs" />
<Compile Include="Utility.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</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>
216 changes: 108 additions & 108 deletions DOOMExtract/DOOMResourceEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,112 +4,112 @@

namespace DOOMExtract
{
public class DOOMResourceEntry
{
private DOOMResourceIndex _index;

public int ID;
public string FileType; // type?
public string FileName2; // ??
public string FileName3; // full path

public long Offset;
public int Size;
public int CompressedSize;
public long Zero;
public byte PatchFileNumber;

public bool IsCompressed { get { return Size != CompressedSize; } }
public DOOMResourceEntry(DOOMResourceIndex index)
{
_index = index;
}

public override string ToString()
{
return GetFullName();
}

public string GetFullName()
{
if (!String.IsNullOrEmpty(FileName3))
return FileName3.Replace("/", "\\"); // convert to windows path

if (!String.IsNullOrEmpty(FileName2))
return FileName2.Replace("/", "\\"); // convert to windows path

return FileType.Replace("/", "\\"); // convert to windows path

}
public void Read(EndianIO io)
{
io.BigEndian = true;
ID = io.Reader.ReadInt32();

io.BigEndian = false;
// fname1
int size = io.Reader.ReadInt32();
FileType = io.Reader.ReadAsciiString(size);
// fname2
size = io.Reader.ReadInt32();
FileName2 = io.Reader.ReadAsciiString(size);
// fname3
size = io.Reader.ReadInt32();
FileName3 = io.Reader.ReadAsciiString(size);

io.BigEndian = true;

Offset = io.Reader.ReadInt64();
Size = io.Reader.ReadInt32();
CompressedSize = io.Reader.ReadInt32();
if (_index.Header_Version <= 4)
Zero = io.Reader.ReadInt64();
else
Zero = io.Reader.ReadInt32(); // Zero field is 4 bytes instead of 8 in version 5+

PatchFileNumber = io.Reader.ReadByte();
}

public void Write(EndianIO io)
{
io.BigEndian = true;
io.Writer.Write(ID);

io.BigEndian = false;
io.Writer.Write(FileType.Length);
io.Writer.WriteAsciiString(FileType, FileType.Length);
io.Writer.Write(FileName2.Length);
io.Writer.WriteAsciiString(FileName2, FileName2.Length);
io.Writer.Write(FileName3.Length);
io.Writer.WriteAsciiString(FileName3, FileName3.Length);

io.BigEndian = true;

io.Writer.Write(Offset);
io.Writer.Write(Size);
io.Writer.Write(CompressedSize);
if (_index.Header_Version <= 4)
io.Writer.Write(Zero);
else
io.Writer.Write((int)Zero); // Zero field is 4 bytes instead of 8 in version 5+
io.Writer.Write(PatchFileNumber);
}

public Stream GetDataStream(bool decompress)
{
if (Size == 0 && CompressedSize == 0)
return null;

var io = _index.GetResourceIO(PatchFileNumber);
if (io == null)
return null;

io.Stream.Position = Offset;
Stream dataStream = io.Stream;
if (IsCompressed && decompress)
dataStream = new InflaterInputStream(io.Stream, new ICSharpCode.SharpZipLib.Zip.Compression.Inflater(true), 4096);

return dataStream;
}
}
public class DOOMResourceEntry
{
private DOOMResourceIndex _index;

public int ID;
public string FileType; // type?
public string FileName2; // ??
public string FileName3; // full path

public long Offset;
public int Size;
public int CompressedSize;
public long Zero;
public byte PatchFileNumber;

public bool IsCompressed { get { return Size != CompressedSize; } }
public DOOMResourceEntry(DOOMResourceIndex index)
{
_index = index;
}

public override string ToString()
{
return GetFullName();
}

public string GetFullName()
{
if (!String.IsNullOrEmpty(FileName3))
return FileName3.Replace("/", "\\"); // convert to windows path

if (!String.IsNullOrEmpty(FileName2))
return FileName2.Replace("/", "\\"); // convert to windows path

return FileType.Replace("/", "\\"); // convert to windows path

}
public void Read(EndianIO io)
{
io.BigEndian = true;
ID = io.Reader.ReadInt32();

io.BigEndian = false;
// fname1
int size = io.Reader.ReadInt32();
FileType = io.Reader.ReadAsciiString(size);
// fname2
size = io.Reader.ReadInt32();
FileName2 = io.Reader.ReadAsciiString(size);
// fname3
size = io.Reader.ReadInt32();
FileName3 = io.Reader.ReadAsciiString(size);

io.BigEndian = true;

Offset = io.Reader.ReadInt64();
Size = io.Reader.ReadInt32();
CompressedSize = io.Reader.ReadInt32();
if (_index.Header_Version <= 4)
Zero = io.Reader.ReadInt64();
else
Zero = io.Reader.ReadInt32(); // Zero field is 4 bytes instead of 8 in version 5+

PatchFileNumber = io.Reader.ReadByte();
}

public void Write(EndianIO io)
{
io.BigEndian = true;
io.Writer.Write(ID);

io.BigEndian = false;
io.Writer.Write(FileType.Length);
io.Writer.WriteAsciiString(FileType, FileType.Length);
io.Writer.Write(FileName2.Length);
io.Writer.WriteAsciiString(FileName2, FileName2.Length);
io.Writer.Write(FileName3.Length);
io.Writer.WriteAsciiString(FileName3, FileName3.Length);

io.BigEndian = true;

io.Writer.Write(Offset);
io.Writer.Write(Size);
io.Writer.Write(CompressedSize);
if (_index.Header_Version <= 4)
io.Writer.Write(Zero);
else
io.Writer.Write((int)Zero); // Zero field is 4 bytes instead of 8 in version 5+
io.Writer.Write(PatchFileNumber);
}

public Stream GetDataStream(bool decompress)
{
if (Size == 0 && CompressedSize == 0)
return null;

var io = _index.GetResourceIO(PatchFileNumber);
if (io == null)
return null;

io.Stream.Position = Offset;
Stream dataStream = io.Stream;
if (IsCompressed && decompress)
dataStream = new InflaterInputStream(io.Stream, new ICSharpCode.SharpZipLib.Zip.Compression.Inflater(true), 4096);

return dataStream;
}
}
}
Loading

0 comments on commit 0dcbff3

Please sign in to comment.