Parse XCC local mix database.
This commit is contained in:
37
OpenRA.FileFormats/FileFormats/XccLocalDatabase.cs
Normal file
37
OpenRA.FileFormats/FileFormats/XccLocalDatabase.cs
Normal 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -139,6 +139,7 @@
|
|||||||
<Compile Include="WRange.cs" />
|
<Compile Include="WRange.cs" />
|
||||||
<Compile Include="HSLColor.cs" />
|
<Compile Include="HSLColor.cs" />
|
||||||
<Compile Include="Graphics\ShpTSReader.cs" />
|
<Compile Include="Graphics\ShpTSReader.cs" />
|
||||||
|
<Compile Include="FileFormats\XccLocalDatabase.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||||
|
|||||||
Reference in New Issue
Block a user