Example #1
0
        private static async Task UnicodeData(Ucd ucd)
        {
            var ud = await ucd.GetUnicodeData();

            DecompositionMap(ud);
            ReadUnicodeData(ud);
        }
            public Ucd(string version, StreamReader unicodeData, Ucd prev = default(Ucd))
            {
                Version = version;

                var list = new List<int>();

                string line;
                while ((line = unicodeData.ReadLine()) != null)
                {
                    if (string.IsNullOrWhiteSpace(line)) continue;
                    if (line.StartsWith("#")) continue;

                    var items = line.Split(';');
                    var codepoint = int.Parse(items[0], System.Globalization.NumberStyles.HexNumber);

                    list.Add(codepoint);
                }

                List = list;
                Set = new HashSet<int>(list);

                if (prev.Set != null)
                {
                    Difference = list.Except(prev.Set).ToArray();
                }
                else
                {
                    Difference = Array.Empty<int>();
                }
            }
Example #3
0
        private static IEnumerable <Ucd> ReadData(string dataFolder)
        {
            var prev = default(Ucd);

            foreach (var file in Directory.GetFiles(dataFolder))
            {
                var version = Path.GetFileName(file);

                using (var r = new StreamReader(file))
                {
                    var ucd = new Ucd(version, r, prev);
                    yield return(ucd);

                    prev = ucd;
                }
            }
        }
Example #4
0
            public Ucd(string version, StreamReader unicodeData, Ucd prev = default(Ucd))
            {
                Version = version;

                var list = new List <int>();

                string line;

                while ((line = unicodeData.ReadLine()) != null)
                {
                    if (string.IsNullOrWhiteSpace(line))
                    {
                        continue;
                    }
                    if (line.StartsWith("#"))
                    {
                        continue;
                    }

                    var items     = line.Split(';');
                    var codepoint = int.Parse(items[0], System.Globalization.NumberStyles.HexNumber);

                    list.Add(codepoint);
                }

                List = list;
                Set  = new HashSet <int>(list);

                if (prev.Set != null)
                {
                    Difference = list.Except(prev.Set).ToArray();
                }
                else
                {
                    Difference = Array.Empty <int>();
                }
            }
Example #5
0
        static async Task Main()
        {
            var ucd = new Ucd();

            await UnicodeData(ucd);
        }
        private static IEnumerable<Ucd> ReadData(string dataFolder)
        {
            var prev = default(Ucd);

            foreach (var file in Directory.GetFiles(dataFolder))
            {
                var version = Path.GetFileName(file);

                using (var r = new StreamReader(file))
                {
                    var ucd = new Ucd(version, r, prev);
                    yield return ucd;
                    prev = ucd;
                }
            }
        }