private void WriteCodepointBlock(StreamWriter writer, string blockName, string beginning, string end,
IEnumerable<IPuaCharacter> puaCharacters, string data, List<IUcdCharacter> addToBidi, List<IUcdCharacter> removeFromBidi,
List<IUcdCharacter> addToNorm, List<IUcdCharacter> removeFromNorm)
{
//Write each entry
foreach (var puaCharacter in puaCharacters)
{
LogCodepoint(puaCharacter.CodePoint);
// Construct an equivelant UnicodeData.txt line
var line = puaCharacter.CodePoint + ";" + blockName
+ data.Substring(data.IndexOf(';'));
AddToLists(line, puaCharacter, addToBidi, removeFromBidi, addToNorm, removeFromNorm);
//If the current xmlCodepoint is the same as the beginning codepoint
if (puaCharacter.CompareTo(beginning) == 0)
{
//Shift the beginning down one
beginning = AddHex(beginning, 1);
WriteUnicodeDataLine(puaCharacter, writer);
}
//If the current xmlCodepoint is between the beginning and end
else if (puaCharacter.CompareTo(end) != 0)
{
//We're writing a range block below the current xmlCodepoint
WriteRange(writer, beginning, AddHex(puaCharacter.CodePoint, -1), blockName, data);
//Writes the current xmlCodepoint line
WriteUnicodeDataLine(puaCharacter, writer);
//Increment the beginning by one
beginning = AddHex(puaCharacter.CodePoint, 1);
}
//If the current xmlCodepoint is the same as the end codepoint
else
{
//Moves the end down a codepoint address
end = AddHex(end, -1);
//Write our range of data
WriteRange(writer, beginning, end, blockName, data);
//Writes the current line
WriteUnicodeDataLine(puaCharacter, writer);
return;
}
}
//Write our range of data
WriteRange(writer, beginning, end, blockName, data);
}