Parse XCC local mix database.

This commit is contained in:
Paul Chote
2013-05-17 20:49:47 +12:00
parent 50b87b580a
commit 8817fd2cc5
2 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
#region Copyright & License Information
/*
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System.Collections.Generic;
using System.IO;
namespace OpenRA.FileFormats
{
public class XccLocalDatabase
{
public readonly string[] Entries;
public XccLocalDatabase(Stream s)
{
// Skip unnecessary header data
s.Seek(48, SeekOrigin.Begin);
var reader = new BinaryReader(s);
var count = reader.ReadInt32();
Entries = new string[count];
for (var i = 0; i < count; i++)
{
var chars = new List<char>();
char c;
while ((c = reader.ReadChar()) != 0)
chars.Add(c);
Entries[i] = new string(chars.ToArray());
}
}
}
}

View File

@@ -139,6 +139,7 @@
<Compile Include="WRange.cs" />
<Compile Include="HSLColor.cs" />
<Compile Include="Graphics\ShpTSReader.cs" />
<Compile Include="FileFormats\XccLocalDatabase.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">