SIL.FieldWorks.UnicodeCharEditor.PUAInstaller.WriteCodepointBlock C# (CSharp) Method

WriteCodepointBlock() private method

Write a codepoint block, inserting the necessary codepoints properly.
private WriteCodepointBlock ( StreamWriter writer, string blockName, string beginning, string end, IEnumerable puaCharacters, string data, List addToBidi, List removeFromBidi, List addToNorm, List removeFromNorm ) : void
writer System.IO.StreamWriter UnicodeData.txt file to write lines to/
blockName string The name of the block (e.g. "Private Use")
beginning string First codepoint in the block
end string Last codepoint in the free block
puaCharacters IEnumerable An array of codepoints within the block, including the ends. /// DO NOT pass in points external to the free block.
data string A string that contains all of our properties and such for the character range
addToBidi List A list of UCD Characters to remove from the DerivedBidiClass.txt file
removeFromBidi List A list of UCD Characters to add to the DerivedBidiClass.txt file
addToNorm List A list of UCD Characters to remove
removeFromNorm List A list of UCD Characters to add
return void
		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);
		}