closer to map parsing!
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1076 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -39,6 +39,12 @@
|
|||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OpenRa.FileFormats\OpenRa.FileFormats.csproj">
|
||||||
|
<Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project>
|
||||||
|
<Name>OpenRa.FileFormats</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using OpenRa.FileFormats;
|
||||||
|
|
||||||
namespace MapViewer
|
namespace MapViewer
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,40 @@ namespace MapViewer
|
|||||||
Console.WriteLine("X: {0} Y: {1} Width: {2} Height: {3}",
|
Console.WriteLine("X: {0} Y: {1} Width: {2} Height: {3}",
|
||||||
map.GetValue("X", "0"), map.GetValue("Y", "0"),
|
map.GetValue("X", "0"), map.GetValue("Y", "0"),
|
||||||
map.GetValue("Width", "0"), map.GetValue("Height", "0"));
|
map.GetValue("Width", "0"), map.GetValue("Height", "0"));
|
||||||
|
|
||||||
|
// parse MapPack section
|
||||||
|
IniSection mapPackSection = iniFile.GetSection("MapPack");
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 1; ; i++)
|
||||||
|
{
|
||||||
|
string line = mapPackSection.GetValue(i.ToString(), null);
|
||||||
|
if (line == null)
|
||||||
|
break;
|
||||||
|
|
||||||
|
sb.Append(line.Trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] data = Convert.FromBase64String(sb.ToString());
|
||||||
|
Console.WriteLine("Format80 data: {0}", data.Length);
|
||||||
|
|
||||||
|
List<byte[]> chunks = new List<byte[]>();
|
||||||
|
|
||||||
|
BinaryReader reader = new BinaryReader(new MemoryStream(data));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
uint length = reader.ReadUInt32() & 0xdfffffff;
|
||||||
|
byte[] dest = new byte[8192];
|
||||||
|
byte[] src = reader.ReadBytes((int)length);
|
||||||
|
|
||||||
|
int actualLength = Format80.DecodeInto(new MemoryStream(src), dest);
|
||||||
|
Console.WriteLine("Chunk length: {0}", actualLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (EndOfStreamException) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user