static void Main()
        {
            var fileLength = new FileInfo(FilePath).Length;
            var currentLine = new Listbyte();
            var lines = new Liststring();

            using (var mmf = MemoryMappedFile.CreateFromFile(FilePath, FileMode.Open))
            {
                long offset = 0;
                long size = 0x40000000;

                while (size = fileLength)
                {
                    var view = mmf.CreateViewAccessor(offset, size);

                    for (long i = 0; i  size; i++)
                    {
                        var currentByte = view.ReadByte(i);

                        if (currentByte == 13)
                        {
                            currentLine.Reverse();
                            var currentLineAsArray = currentLine.ToArray();

                            var line = Encoding.UTF8.GetString(currentLineAsArray, 0, currentLineAsArray.Length);

                            if (!lines.Contains(line))
                                lines.Add(line);

                            currentLine.Clear();
                        }
                        else if (currentByte != 10)
                            currentLine.Insert(0, currentByte);
                    }

                    if (size == fileLength) break;

                    offset = size;
                    size = size  2  fileLength  fileLength  size  2;
                }
            }

            Console.WriteLine(lines.Count);

            Console.ReadKey();
        }
        public void GenerateConfig()
        {
            var dirChecked         = new System.IO.DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "..", "..", "..", "..", "Black.Beard.Calendarium", "Countries"));
            var dirNotChecked      = new System.IO.DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "..", "..", "..", "..", "Black.Beard.Calendarium", "Countries", "NotChecked"));
            var dirNotCheckedClean = new System.IO.DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "..", "..", "..", "..", "Black.Beard.Calendarium", "Countries", "NotCheckedClean"));

            if (!dirNotChecked.Exists)
            {
                dirNotChecked.Create();
            }

            if (!dirNotCheckedClean.Exists)
            {
                dirNotCheckedClean.Create();
            }

            var referential = Helper.Referential;

            foreach (var countryItem in referential)
            {
                StringBuilder sb    = new StringBuilder(2000);
                var           infos = CountryHelper.GetInfos(countryItem.Key);
                bool          clean = true;

                if (infos.Item3.Length == 0)
                {
                    continue;
                }

                var config = new CountryConfiguration()
                {
                    Country  = countryItem.Key,
                    Calendar = infos.Item3[0],
                };

                if (!string.IsNullOrEmpty(infos.Item1))
                {
                    config.Culture  = infos.Item2;
                    config.Calendar = infos.Item3[0];

                    foreach (var calendar in infos.Item3)
                    {
                        sb.AppendLine($"// calendar : {calendar}");
                    }

                    sb.AppendLine(string.Empty);
                }

                Dictionary <string, Dictionary <string, Liststring> > _doc = new Dictionary <string, Dictionary <string, Liststring> >();
                foreach (var date in countryItem.Value)
                {
                    if (date.Reconstitued)
                    {
                        clean = false;
                        sb.AppendLine($"// Orphan observed date {date.DayName} : {date.ObservedDate.Date}");
                        continue;
                    }

                    if (!_doc.TryGetValue(date.DayName, out Dictionary <string, Liststring> _dic))
                    {
                        _doc.Add(date.DayName, _dic = new Dictionary <string, Liststring>());
                    }

                    var u3 = date.Date.Split('-');

                    string rule = $"{int.Parse(u3[u3.Length - 2])}-{int.Parse(u3[u3.Length - 1])}";

                    if (!_dic.TryGetValue(rule, out Liststring years))
                    {
                        _dic.Add(rule, years = new Liststring());
                    }

                    years.Years.Add(int.Parse(u3[0]).ToString());

                    if (date.ObservedDate != null)
                    {
                        years.Observeds.Add($"{date.DayName},{date.Date.Split('-')[2]},{date.ObservedDate.Date.Split('-')[2]}");
                    }
                }


                foreach (var day in _doc)
                {
                    var _h = new HashSet <string>();

                    foreach (var rule in day.Value)
                    {
                        PeriodConfiguration p = null;

                        if (rule.Value.Years.Count > 5)
                        {
                            p = new PeriodConfiguration(day.Key, true, rule.Key)
                            {
                                CultureInfo = CultureInfo.GetCultureInfo(infos.Item2),
                            };

                            config.Periods.Add(p);

                            if (int.Parse(rule.Value.Years[0]) < 2000)
                            {
                                p.Calendar = CalendarEnum.Hijri;
                            }
                            else if (int.Parse(rule.Value.Years[0]) > 3000)
                            {
                                p.Calendar = CalendarEnum.Julian;
                            }
                        }
                        else
                        {
                            var _rule = Helper.GetRule(day.Key);
                            if (string.IsNullOrEmpty(_rule))
                            {
                                clean = false;
                                var dates = string.Join(',', rule.Value);
                                sb.AppendLine($"// Date : {day.Key}, {rule.Key}, {dates}");
                            }

                            else if (_rule == "<<NotImplemented>>")
                            {
                            }
                            else
                            {
                                if (_h.Add(day.Key + " - " + _rule))
                                {
                                    p = new PeriodConfiguration(day.Key, true, _rule)
                                    {
                                        CultureInfo = CultureInfo.GetCultureInfo(infos.Item2),
                                    };

                                    config.Periods.Add(p);
                                }
                            }
                        }

                        if (rule.Value.Observeds.Count > 0)
                        {
                            foreach (var item in rule.Value.Observeds)
                            {
                                var days = item.Split(',');

                                string name = days[0];
                                int    d1   = int.Parse(days[1]);
                                int    d2   = int.Parse(days[2]);

                                var ds = d2 - d1;

                                if (d2 == 31 && d1 == 1)
                                {
                                    ds = 1;
                                }

                                if (ds > 2)
                                {
                                    clean = false;
                                    sb.AppendLine($"// Observed date {item}");
                                }

                                var it = config.Periods.First(c => c.Name == name);

                                if (string.IsNullOrEmpty(it.RuleObserved) || ds > 1)
                                {
                                    it.RuleObserved = ds == 1
                                        ? "? (SUNDAY) : >> MONDAY"
                                        : "? (SATURDAY | SUNDAY) : >> MONDAY"
                                    ;
                                }
                            }
                        }
                    }
                }

                if (!File.Exists(config.GetFilname(dirChecked)))
                {
                    sb = config.Serialize(sb);

                    if (clean)
                    {
                        config.Save(dirNotCheckedClean, sb);
                    }
                    else
                    {
                        config.Save(dirNotChecked, sb);
                    }
                }
            }
        }