public bool ReadUnicodeData()
{
FileStream dataFile = null;
StreamReader inputStream = null;
string strCurLine;
string[] strLineFields;
CharInfo curCharInfo;
try
{
dataFile =
new FileStream(DATA_FILENAME,FileMode.Open,FileAccess.Read);
inputStream = new StreamReader(dataFile,Encoding.ASCII);
}
catch(Exception exc)
{
Console.WriteLine("TestCase blocked",
UNABLE_TO_OPEN_FILE + " '" + DATA_FILENAME + "'.",exc);
if (inputStream != null)
inputStream.Close();
if (dataFile != null)
dataFile.Close();
return false;
}
try
{
m_uCharsRead = 0;
while ( (strCurLine = inputStream.ReadLine()) != null )
{
strLineFields = strCurLine.Split(FIELD_SEP);
curCharInfo = new CharInfo();
if (strLineFields[0].Length > 4)
continue;
else
curCharInfo.chChar =
Convert.ToChar(Convert.ToInt32(strLineFields[0],16));
curCharInfo.eCategory =
TranslateUnicodeCategory(strLineFields[2]);
if (strLineFields[8].Length > 0)
{
curCharInfo.dNumericValue =
ConvertToDouble(strLineFields[8]);
}
m_CharData.Add(curCharInfo.chChar,curCharInfo);
m_uCharsRead++;
}
}
catch(Exception exc)
{
Console.WriteLine("Testcase blocked",
BAD_DATA_FILE + " '" + DATA_FILENAME +
"', Line " + (m_uCharsRead + 1) + ".",
exc);
if (inputStream != null)
inputStream.Close();
if (dataFile != null)
dataFile.Close();
return false;
}
inputStream.Close();
dataFile.Close();
return true;
}
public static void Main(String[] strArgList)