[Android] in ConfigFile.java do not add [<sectionless!>]

This commit is contained in:
zilmar 2016-10-02 07:48:27 +11:00
parent 628a0d769d
commit e76cc73671
1 changed files with 89 additions and 94 deletions

View File

@ -28,9 +28,6 @@ import android.util.Log;
public class ConfigFile
{
/** The name we use for the untitled section (preamble) of the config file. */
public static final String SECTIONLESS_NAME = "[<sectionless!>]";
/** Name of the config file. */
private final String mFilename;
@ -144,16 +141,12 @@ public class ConfigFile
DataInputStream in = new DataInputStream( fstream );
BufferedReader br = new BufferedReader( new InputStreamReader( in ) );
String sectionName = SECTIONLESS_NAME;
ConfigSection section = new ConfigSection( sectionName, br ); // Read the 'sectionless'
// section
mConfigMap.put( sectionName, section ); // Save the data to 'configMap'
ConfigSection section = new ConfigSection( "", br ); // section
// Loop through reading the remaining sections
while( !TextUtils.isEmpty( section.nextName ) )
{
// Get the next section name
sectionName = section.nextName;
String sectionName = section.nextName;
// Load the next section
section = new ConfigSection( sectionName, br );
@ -265,9 +258,10 @@ public class ConfigFile
parameters = new HashMap<String, ConfigParameter>();
lines = new LinkedList<ConfigLine>();
if( !TextUtils.isEmpty( sectionName ) && !sectionName.equals( SECTIONLESS_NAME ) )
if( !TextUtils.isEmpty( sectionName ))
{
lines.add( new ConfigLine( ConfigLine.LINE_SECTION, "[" + sectionName + "]\n", null ) );
}
name = sectionName;
}
@ -286,9 +280,10 @@ public class ConfigFile
parameters = new HashMap<String, ConfigParameter>();
lines = new LinkedList<ConfigLine>();
if( !TextUtils.isEmpty( sectionName ) && !sectionName.equals( SECTIONLESS_NAME ) )
if( !TextUtils.isEmpty( sectionName ))
{
lines.add( new ConfigLine( ConfigLine.LINE_SECTION, "[" + sectionName + "]\n", null ) );
}
name = sectionName;
// No file to read from. Quit.