示例#1
0
        /// <summary>
        /// Reads DerivedName.txt and parses each entry in that file.
        /// </summary>
        private static Dictionary<int, string> ProcessDerivedNameFile()
        {
            using Stream stream = Resources.OpenResource(Resources.DerivedName);
            using StreamReader reader = new StreamReader(stream);

            Dictionary<int, string> dict = new Dictionary<int, string>();

            string thisLine;
            while ((thisLine = reader.ReadLine()) != null)
            {
                if (PropsFileEntry.TryParseLine(thisLine, out PropsFileEntry value))
                {
                    if (value.IsSingleCodePoint)
                    {
                        // Single code point of format "XXXX ; <Name>" (name shouldn't end with '*')

                        Assert.False(value.PropName.EndsWith("*"));
                        dict.Add(value.FirstCodePoint, value.PropName);
                    }
                    else
                    {
                        // Range of format "XXXX..YYYY ; <Name>-*"

                        Assert.True(value.PropName.EndsWith("*"));

                        string baseName = value.PropName[..^1];
示例#2
0
        /// <summary>
        /// Reads DerivedBidiClass.txt and parses each entry in that file.
        /// </summary>
        private static Dictionary<int, BidiClass> ProcessDerivedBidiClassFile()
        {
            using Stream stream = Resources.OpenResource(Resources.DerivedBidiClass);
            using StreamReader reader = new StreamReader(stream);

            Dictionary<int, BidiClass> dict = new Dictionary<int, BidiClass>();

            string thisLine;
            while ((thisLine = reader.ReadLine()) != null)
            {
                if (PropsFileEntry.TryParseLine(thisLine, out PropsFileEntry value))
                {
                    BidiClass bidiClass = BidiClassMap[value.PropName];

                    for (int i = value.FirstCodePoint; i <= value.LastCodePoint /* inclusive */; i++)
                    {
                        dict.Add(i, bidiClass);
                    }
                }
            }

            return dict;
        }