public bool Read()
        {
            bool result;

            if (result = _reader.MoveToNextLine())
            {
                CodePoint     = HexCodePoint.ParsePrefixed(_reader.ReadField());
                PropertyName  = _reader.ReadField();
                PropertyValue = _reader.ReadField();
            }
            else
            {
                CodePoint     = 0;
                PropertyName  = null;
                PropertyValue = null;
            }

            return(result);
        }
예제 #2
0
        private static async Task ProcessUnihanVariants(IDataSource unihanDataSource, UnicodeInfoBuilder builder)
        {
            using (var reader = new UnihanDataFileReader(await unihanDataSource.OpenDataFileAsync(UnihanVariantsFileName).ConfigureAwait(false)))
            {
                while (reader.Read())
                {
                    // This statement is used to skip unhandled properties entirely.
                    switch (reader.PropertyName)
                    {
                    case UnihanProperty.SimplifiedVariant:
                    case UnihanProperty.TraditionalVariant:
                        break;

                    default:
                        // Ignore unhandled properties for now.
                        continue;
                    }

                    var entry = builder.GetUnihan(reader.CodePoint);

                    switch (reader.PropertyName)
                    {
                    case UnihanProperty.SimplifiedVariant:
                        entry.SimplifiedVariant = char.ConvertFromUtf32(HexCodePoint.ParsePrefixed(reader.PropertyValue));
                        break;

                    case UnihanProperty.TraditionalVariant:
                        entry.TraditionalVariant = char.ConvertFromUtf32(HexCodePoint.ParsePrefixed(reader.PropertyValue));
                        break;

                    default:
                        throw new InvalidOperationException();
                    }
                }
            }
        }