git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1953 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
chrisf
2008-03-25 00:45:43 +00:00
parent eb7094d49e
commit 33e856345f
16 changed files with 126 additions and 179 deletions

View File

@@ -47,18 +47,19 @@ namespace OpenRa.FileFormats
bool ProcessEntry( string line )
{
Match m = entryPattern.Match( line );
if( m == null || !m.Success )
return false;
int comment = line.IndexOf(';');
if (comment >= 0)
line = line.Substring(0, comment);
if( currentSection == null )
throw new InvalidOperationException( "No current INI section" );
int eq = line.IndexOf('=');
if (eq < 0)
return false;
string keyName = m.Groups[ 1 ].Value;
string keyValue = m.Groups[ 2 ].Value;
currentSection.Add( keyName, keyValue );
if (currentSection == null)
throw new InvalidOperationException("No current INI section");
currentSection.Add(line.Substring(0, eq),
line.Substring(eq + 1, line.Length - eq - 1));
return true;
}