<commit_before>﻿using ExcelLibrary.SpreadSheet;
using Qowaiv.CodeGenerator.Xml;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;

namespace Qowaiv.CodeGenerator.Generators
{
	/// <summary>Generator for resource files.</summary>
	public class QowaivCodeGenerator
	{
		/// <summary>Constructor.</summary>
		public QowaivCodeGenerator() { }

		/// <summary>Generates the resource files.</summary>
		/// <param name="dir">
		/// The directory to write to.
		/// </param>
		public void Generate(DirectoryInfo dir)
		{
			if (!dir.Exists) { dir.Create(); }
			GenerateGender(dir);
			GenerateCountry(dir);
			GenerateCurrency(dir);
			GenerateCountryToCurrency(dir);
			GenerateIban(dir);
			GeneratePostalCode(dir);
			GenerateUnknown(dir);
			GenerateInternetMediaType(dir);
		}

		/// <summary>Generates the gender resource file.</summary>
		protected void GenerateGender(DirectoryInfo dir)
		{
			using (var stream = GetType().Assembly
				.GetManifestResourceStream("Qowaiv.CodeGenerator.Resources.Gender.xls"))
			{
				var workbook = Workbook.Load(stream);
				var worksheet = workbook.Worksheets[0];

				var key_index = 1;
				var val_index = 2;
				var cmt_index = 3;

				var resx = new XResourceFile();

				var header = worksheet.Cells.GetRow(0);

				int i = 1;

				while (true)
				{
					var row = worksheet.Cells.GetRow(i++);

					if (row.LastColIndex == int.MinValue) { break; }

					resx.Data.Add(new XResourceFileData(
						row.GetCell(key_index).StringValue,
						row.GetCell(val_index).StringValue,
						row.GetCell(cmt_index).StringValue));
				}

				resx.Save(new FileInfo(Path.Combine(dir.FullName, "GenderLabels.resx")));

				for (int lng_index = cmt_index + 1; lng_index <= header.LastColIndex; lng_index++)
				{
					var resx_lng = new XResourceFile();

					var culture = header.GetCell(lng_index).StringValue;

					i = 1;

					while (true)
					{
						var row = worksheet.Cells.GetRow(i++);
						if (row.LastColIndex == int.MinValue) { break; }

						var key = row.GetCell(key_index).StringValue;
						var val = row.GetCell(lng_index).StringValue;
						var cmd = row.GetCell(cmt_index).StringValue;
						var def = resx[key].Value;

						if (!string.IsNullOrEmpty(val) && def != val)
						{
							resx_lng.Data.Add(new XResourceFileData(key, val, cmd));
						}
					}
					resx_lng.Save(new FileInfo(Path.Combine(dir.FullName, "GenderLabels." + culture + ".resx")));
				}
			}
		}

		/// <summary>Generates the country info resource file.</summary>
		protected void GenerateCountry(DirectoryInfo dir)
		{
			using (var stream = GetType().Assembly
				.GetManifestResourceStream("Qowaiv.CodeGenerator.Resources.Country.xls"))
			{
				using (var writer = new StreamWriter(Path.Combine(dir.FullName, "CountryConstants.cs")))
				{
					writer.WriteLine("namespace Qowaiv\r\n{\r\n    public partial struct Country\r\n    {");

					var workbook = Workbook.Load(stream);
					var worksheet = workbook.Worksheets[0];

					var all = new List<string>();

					var key_index = 1;
					var num_index = 2;
					var is2_index = 3;
					var is3_index = 4;
					//var win_index = 5;
					var str_index = 6;
					var end_index = 7;
					var tel_index = 8;
					var reg_index = 9;
					//var nat_index = 10;
					var def_index = 11;

					var resx = new XResourceFile();

					var header = worksheet.Cells.GetRow(0);

					int i = 1;

					while (true)
					{
						var row = worksheet.Cells.GetRow(i++);

						if (row.LastColIndex == int.MinValue) { break; }

						var key = row.GetCell(key_index).StringValue.Trim();

						var num = row.GetCell(num_index).StringValue.Trim();
						var iso2 = row.GetCell(is2_index).StringValue.Trim();
						var iso3 = row.GetCell(is3_index).StringValue.Trim();
						var start = row.GetCell(str_index).DateTimeValue;
						DateTime? end = string.IsNullOrEmpty(row.GetCell(end_index).StringValue) ? (DateTime?)null : (DateTime?)row.GetCell(end_index).DateTimeValue;
						var tel = row.GetCell(tel_index).StringValue.Trim();
						var display = row.GetCell(def_index).StringValue.Trim();
						var hasRegInfo = XmlConvert.ToBoolean(row.GetCell(reg_index).StringValue);

						if (key != "ZZ")
						{
							all.Add(key);

							writer.WriteLine("        /// <summary>Describes the country {0} ({1}).</summary>", display, key);
							if (end.HasValue)
							{
								writer.WriteLine("        /// <remarks>End date is {0:yyyy-MM-dd}.</remarks>", end.Value);
							}
							writer.Write("        public static readonly Country {0} = new Country()", key);
							writer.Write(" { m_Value = \"");
							writer.Write(key);
							writer.WriteLine("\" };");
							writer.WriteLine();
						}
						key += '_';

						resx.Data.Add(new XResourceFileData(key + "DisplayName", display));
						resx.Data.Add(new XResourceFileData(key + "ISO", num));
						resx.Data.Add(new XResourceFileData(key + "ISO2", iso2));
						resx.Data.Add(new XResourceFileData(key + "ISO3", iso3));
						resx.Data.Add(new XResourceFileData(key + "StartDate", start.ToString("yyyy-MM-dd")));

						if (end.HasValue)
						{
							resx.Data.Add(new XResourceFileData(key + "EndDate", end.Value.ToString("yyyy-MM-dd")));
						}
						if (!string.IsNullOrEmpty(tel))
						{
							resx.Data.Add(new XResourceFileData(key + "CallingCode", tel));
						}
						if (hasRegInfo)
						{
							resx.Data.Add(new XResourceFileData(key + "RegionInfoExists", true.ToString()));
						}
					}

					resx.Data.Add(new XResourceFileData("All", String.Join(";", all)));

					resx.Save(new FileInfo(Path.Combine(dir.FullName, "CountryLabels.resx")));

					for (int lng_index = def_index + 1; lng_index <= header.LastColIndex; lng_index++)
					{
						var resx_lng = new XResourceFile();

						var culture = header.GetCell(lng_index).StringValue;

						i = 1;

						while (true)
						{
							var row = worksheet.Cells.GetRow(i++);
							if (row.LastColIndex == int.MinValue) { break; }

							var key = row.GetCell(key_index).StringValue + "_DisplayName";
							var val = row.GetCell(lng_index).StringValue.Trim();
							var cmd = string.Format("{0} ({1})", row.GetCell(def_index).StringValue, row.GetCell(is2_index).StringValue);
							var def = resx[key].Value;

							if (!string.IsNullOrEmpty(val) && def != val)
							{
								resx_lng.Data.Add(new XResourceFileData(key, val, cmd));
							}
						}
						resx_lng.Save(new FileInfo(Path.Combine(dir.FullName, "CountryLabels." + culture + ".resx")));
					}
					writer.WriteLine("    }\r\n}");
				}
			}
		}
		
		/// <summary>Generates the country info resource file.</summary>
		protected void GenerateCountryToCurrency(DirectoryInfo dir)
		{
			using (var stream = GetType().Assembly
				.GetManifestResourceStream("Qowaiv.CodeGenerator.Resources.CountryToCurrency.xls"))
			{
				using (var writer = new StreamWriter(Path.Combine(dir.FullName, "CountryToCurrencyMappings.cs")))
				{
					writer.WriteLine("using System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\n");

					writer.WriteLine("namespace Qowaiv\r\n{\r\n\tinternal partial struct CountryToCurrency\r\n\t{");
					
					writer.WriteLine("\t\tpublic static readonly ReadOnlyCollection<CountryToCurrency> All = new ReadOnlyCollection<CountryToCurrency>(new List<CountryToCurrency>()\r\n\t\t{");

					var workbook = Workbook.Load(stream);
					var worksheet = workbook.Worksheets[0];

					var all = new List<string>();

					var country_index = 1;
					var currency_index = 2;
					var date_index = 0;
					
					var resx = new XResourceFile();

					var header = worksheet.Cells.GetRow(0);

					int i = 1;

					while (true)
					{
						var row = worksheet.Cells.GetRow(i++);

						if (row.LastColIndex == int.MinValue) { break; }

						var country = row.GetCell(country_index).StringValue.Trim();
						var cur = row.GetCell(currency_index).StringValue.Trim();
						Date start = Date.Parse(row.GetCell(date_index).StringValue);

						if (start == Date.MinValue)
						{
							writer.WriteLine("\t\t\tnew CountryToCurrency(Country.{0}, Currency.{1}),", country, cur);
						}
						else
						{
							writer.WriteLine("\t\t\tnew CountryToCurrency(Country.{0}, Currency.{1}, new Date({2:yyyy, MM, dd})),", country, cur, start);
						}
			
					}
					writer.WriteLine("\t\t});\r\n\t}\r\n}");
				}
			}
		}

		/// <summary>Generates the country info resource file.</summary>
		protected void GenerateCurrency(DirectoryInfo dir)
		{
			using (var stream = GetType().Assembly
				.GetManifestResourceStream("Qowaiv.CodeGenerator.Resources.Currency.xls"))
			{
				using (var writer = new StreamWriter(Path.Combine(dir.FullName, "CurrencyConstants.cs")))
				{
					writer.WriteLine("namespace Qowaiv\r\n{\r\n    public partial struct Currency\r\n    {");

					var workbook = Workbook.Load(stream);
					var worksheet = workbook.Worksheets[0];

					var all = new List<string>();

					var key_index = 1;
					var iso_index = 2;
					var num_index = 3;
					var dig_index = 4;
					var sym_index = 5;
					var str_index = 6;
					var end_index = 7;
					var def_index = 8;

					var resx = new XResourceFile();

					var header = worksheet.Cells.GetRow(0);

					int i = 1;

					while (true)
					{
						var row = worksheet.Cells.GetRow(i++);

						if (row.LastColIndex == int.MinValue) { break; }

						var key = row.GetCell(key_index).StringValue.Trim();

						var iso = row.GetCell(iso_index).StringValue.Trim();
						int num = string.IsNullOrEmpty(row.GetCell(num_index).StringValue) ? 0 : (int)(double)row.GetCell(num_index).Value;
						int dig = string.IsNullOrEmpty(row.GetCell(dig_index).StringValue) ? 0 : (int)(double)row.GetCell(dig_index).Value;
						var start = row.GetCell(str_index).DateTimeValue;
						DateTime? end = string.IsNullOrEmpty(row.GetCell(end_index).StringValue) ? (DateTime?)null : (DateTime?)row.GetCell(end_index).DateTimeValue;
						var sym = row.GetCell(sym_index).StringValue.Trim();
						var display = row.GetCell(def_index).StringValue.Trim();

						if (key != "ZZZ")
						{
							all.Add(key);

							writer.WriteLine("        /// <summary>Describes the currency {0} ({1}).</summary>", display, key);
							if (end.HasValue)
							{
								writer.WriteLine("        /// <remarks>End date is {0:yyyy-MM-dd}.</remarks>", end.Value);
							}
							writer.Write("        public static readonly Currency {0} = new Currency()", key);
							writer.Write(" { m_Value = \"");
							writer.Write(key);
							writer.WriteLine("\" };");
							writer.WriteLine();
						}
						key += '_';

						resx.Data.Add(new XResourceFileData(key + "DisplayName", display));
						resx.Data.Add(new XResourceFileData(key + "Num", num.ToString("000")));
						resx.Data.Add(new XResourceFileData(key + "ISO", iso));
						resx.Data.Add(new XResourceFileData(key + "Digits", dig.ToString()));

						resx.Data.Add(new XResourceFileData(key + "StartDate", start.ToString("yyyy-MM-dd")));

						if (!string.IsNullOrEmpty(sym))
						{
							resx.Data.Add(new XResourceFileData(key + "Symbol", sym));
						}

						if (end.HasValue)
						{
							resx.Data.Add(new XResourceFileData(key + "EndDate", end.Value.ToString("yyyy-MM-dd")));
						}
					}

					resx.Data.Add(new XResourceFileData("All", String.Join(";", all)));

					resx.Save(new FileInfo(Path.Combine(dir.FullName, "CurrencyLabels.resx")));

					for (int lng_index = def_index + 1; lng_index <= header.LastColIndex; lng_index++)
					{
						var resx_lng = new XResourceFile();

						var culture = header.GetCell(lng_index).StringValue;

						i = 1;
<commit_msg>Changes on code generation for Financial namespace.<commit_after>﻿using ExcelLibrary.SpreadSheet;
using Qowaiv.CodeGenerator.Xml;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;

namespace Qowaiv.CodeGenerator.Generators
{
	/// <summary>Generator for resource files.</summary>
	public class QowaivCodeGenerator
	{
		/// <summary>Constructor.</summary>
		public QowaivCodeGenerator() { }

		/// <summary>Generates the resource files.</summary>
		/// <param name="dir">
		/// The directory to write to.
		/// </param>
		public void Generate(DirectoryInfo dir)
		{
			if (!dir.Exists) { dir.Create(); }

			var fin = new DirectoryInfo(Path.Combine(dir.FullName, "Financial"));
			if (!fin.Exists) { fin.Create(); }

			GenerateGender(dir);
			GenerateCountry(dir);
			GenerateCurrency(fin);
			GenerateCountryToCurrency(fin);
			GenerateIban(dir);
			GeneratePostalCode(dir);
			GenerateUnknown(dir);
			GenerateInternetMediaType(dir);
		}

		/// <summary>Generates the gender resource file.</summary>
		protected void GenerateGender(DirectoryInfo dir)
		{
			using (var stream = GetType().Assembly
				.GetManifestResourceStream("Qowaiv.CodeGenerator.Resources.Gender.xls"))
			{
				var workbook = Workbook.Load(stream);
				var worksheet = workbook.Worksheets[0];

				var key_index = 1;
				var val_index = 2;
				var cmt_index = 3;

				var resx = new XResourceFile();

				var header = worksheet.Cells.GetRow(0);

				int i = 1;

				while (true)
				{
					var row = worksheet.Cells.GetRow(i++);

					if (row.LastColIndex == int.MinValue) { break; }

					resx.Data.Add(new XResourceFileData(
						row.GetCell(key_index).StringValue,
						row.GetCell(val_index).StringValue,
						row.GetCell(cmt_index).StringValue));
				}

				resx.Save(new FileInfo(Path.Combine(dir.FullName, "GenderLabels.resx")));

				for (int lng_index = cmt_index + 1; lng_index <= header.LastColIndex; lng_index++)
				{
					var resx_lng = new XResourceFile();

					var culture = header.GetCell(lng_index).StringValue;

					i = 1;

					while (true)
					{
						var row = worksheet.Cells.GetRow(i++);
						if (row.LastColIndex == int.MinValue) { break; }

						var key = row.GetCell(key_index).StringValue;
						var val = row.GetCell(lng_index).StringValue;
						var cmd = row.GetCell(cmt_index).StringValue;
						var def = resx[key].Value;

						if (!string.IsNullOrEmpty(val) && def != val)
						{
							resx_lng.Data.Add(new XResourceFileData(key, val, cmd));
						}
					}
					resx_lng.Save(new FileInfo(Path.Combine(dir.FullName, "GenderLabels." + culture + ".resx")));
				}
			}
		}

		/// <summary>Generates the country info resource file.</summary>
		protected void GenerateCountry(DirectoryInfo dir)
		{
			using (var stream = GetType().Assembly
				.GetManifestResourceStream("Qowaiv.CodeGenerator.Resources.Country.xls"))
			{
				using (var writer = new StreamWriter(Path.Combine(dir.FullName, "CountryConstants.cs")))
				{
					writer.WriteLine("namespace Qowaiv\r\n{\r\n    public partial struct Country\r\n    {");

					var workbook = Workbook.Load(stream);
					var worksheet = workbook.Worksheets[0];

					var all = new List<string>();

					var key_index = 1;
					var num_index = 2;
					var is2_index = 3;
					var is3_index = 4;
					//var win_index = 5;
					var str_index = 6;
					var end_index = 7;
					var tel_index = 8;
					var reg_index = 9;
					//var nat_index = 10;
					var def_index = 11;

					var resx = new XResourceFile();

					var header = worksheet.Cells.GetRow(0);

					int i = 1;

					while (true)
					{
						var row = worksheet.Cells.GetRow(i++);

						if (row.LastColIndex == int.MinValue) { break; }

						var key = row.GetCell(key_index).StringValue.Trim();

						var num = row.GetCell(num_index).StringValue.Trim();
						var iso2 = row.GetCell(is2_index).StringValue.Trim();
						var iso3 = row.GetCell(is3_index).StringValue.Trim();
						var start = row.GetCell(str_index).DateTimeValue;
						DateTime? end = string.IsNullOrEmpty(row.GetCell(end_index).StringValue) ? (DateTime?)null : (DateTime?)row.GetCell(end_index).DateTimeValue;
						var tel = row.GetCell(tel_index).StringValue.Trim();
						var display = row.GetCell(def_index).StringValue.Trim();
						var hasRegInfo = XmlConvert.ToBoolean(row.GetCell(reg_index).StringValue);

						if (key != "ZZ")
						{
							all.Add(key);

							writer.WriteLine("        /// <summary>Describes the country {0} ({1}).</summary>", display, key);
							if (end.HasValue)
							{
								writer.WriteLine("        /// <remarks>End date is {0:yyyy-MM-dd}.</remarks>", end.Value);
							}
							writer.Write("        public static readonly Country {0} = new Country()", key);
							writer.Write(" { m_Value = \"");
							writer.Write(key);
							writer.WriteLine("\" };");
							writer.WriteLine();
						}
						key += '_';

						resx.Data.Add(new XResourceFileData(key + "DisplayName", display));
						resx.Data.Add(new XResourceFileData(key + "ISO", num));
						resx.Data.Add(new XResourceFileData(key + "ISO2", iso2));
						resx.Data.Add(new XResourceFileData(key + "ISO3", iso3));
						resx.Data.Add(new XResourceFileData(key + "StartDate", start.ToString("yyyy-MM-dd")));

						if (end.HasValue)
						{
							resx.Data.Add(new XResourceFileData(key + "EndDate", end.Value.ToString("yyyy-MM-dd")));
						}
						if (!string.IsNullOrEmpty(tel))
						{
							resx.Data.Add(new XResourceFileData(key + "CallingCode", tel));
						}
						if (hasRegInfo)
						{
							resx.Data.Add(new XResourceFileData(key + "RegionInfoExists", true.ToString()));
						}
					}

					resx.Data.Add(new XResourceFileData("All", String.Join(";", all)));

					resx.Save(new FileInfo(Path.Combine(dir.FullName, "CountryLabels.resx")));

					for (int lng_index = def_index + 1; lng_index <= header.LastColIndex; lng_index++)
					{
						var resx_lng = new XResourceFile();

						var culture = header.GetCell(lng_index).StringValue;

						i = 1;

						while (true)
						{
							var row = worksheet.Cells.GetRow(i++);
							if (row.LastColIndex == int.MinValue) { break; }

							var key = row.GetCell(key_index).StringValue + "_DisplayName";
							var val = row.GetCell(lng_index).StringValue.Trim();
							var cmd = string.Format("{0} ({1})", row.GetCell(def_index).StringValue, row.GetCell(is2_index).StringValue);
							var def = resx[key].Value;

							if (!string.IsNullOrEmpty(val) && def != val)
							{
								resx_lng.Data.Add(new XResourceFileData(key, val, cmd));
							}
						}
						resx_lng.Save(new FileInfo(Path.Combine(dir.FullName, "CountryLabels." + culture + ".resx")));
					}
					writer.WriteLine("    }\r\n}");
				}
			}
		}
		
		/// <summary>Generates the country info resource file.</summary>
		protected void GenerateCountryToCurrency(DirectoryInfo dir)
		{
			using (var stream = GetType().Assembly
				.GetManifestResourceStream("Qowaiv.CodeGenerator.Resources.CountryToCurrency.xls"))
			{
				using (var writer = new StreamWriter(Path.Combine(dir.FullName, "CountryToCurrencyMappings.cs")))
				{
					writer.WriteLine("using System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\n");

					writer.WriteLine("namespace Qowaiv.Financial\r\n{\r\n\tinternal partial struct CountryToCurrency\r\n\t{");
					
					writer.WriteLine("\t\tpublic static readonly ReadOnlyCollection<CountryToCurrency> All = new ReadOnlyCollection<CountryToCurrency>(new List<CountryToCurrency>()\r\n\t\t{");

					var workbook = Workbook.Load(stream);
					var worksheet = workbook.Worksheets[0];

					var all = new List<string>();

					var country_index = 1;
					var currency_index = 2;
					var date_index = 0;
					
					var resx = new XResourceFile();

					var header = worksheet.Cells.GetRow(0);

					int i = 1;

					while (true)
					{
						var row = worksheet.Cells.GetRow(i++);

						if (row.LastColIndex == int.MinValue) { break; }

						var country = row.GetCell(country_index).StringValue.Trim();
						var cur = row.GetCell(currency_index).StringValue.Trim();
						Date start = Date.Parse(row.GetCell(date_index).StringValue);

						if (start == Date.MinValue)
						{
							writer.WriteLine("\t\t\tnew CountryToCurrency(Country.{0}, Currency.{1}),", country, cur);
						}
						else
						{
							writer.WriteLine("\t\t\tnew CountryToCurrency(Country.{0}, Currency.{1}, new Date({2:yyyy, MM, dd})),", country, cur, start);
						}
			
					}
					writer.WriteLine("\t\t});\r\n\t}\r\n}");
				}
			}
		}

		/// <summary>Generates the country info resource file.</summary>
		protected void GenerateCurrency(DirectoryInfo dir)
		{
			using (var stream = GetType().Assembly
				.GetManifestResourceStream("Qowaiv.CodeGenerator.Resources.Currency.xls"))
			{
				using (var writer = new StreamWriter(Path.Combine(dir.FullName, "CurrencyConstants.cs")))
				{
					writer.WriteLine("namespace Qowaiv.Financial\r\n{\r\n    public partial struct Currency\r\n    {");

					var workbook = Workbook.Load(stream);
					var worksheet = workbook.Worksheets[0];

					var all = new List<string>();

					var key_index = 1;
					var iso_index = 2;
					var num_index = 3;
					var dig_index = 4;
					var sym_index = 5;
					var str_index = 6;
					var end_index = 7;
					var def_index = 8;

					var resx = new XResourceFile();

					var header = worksheet.Cells.GetRow(0);

					int i = 1;

					while (true)
					{
						var row = worksheet.Cells.GetRow(i++);

						if (row.LastColIndex == int.MinValue) { break; }

						var key = row.GetCell(key_index).StringValue.Trim();

						var iso = row.GetCell(iso_index).StringValue.Trim();
						int num = string.IsNullOrEmpty(row.GetCell(num_index).StringValue) ? 0 : (int)(double)row.GetCell(num_index).Value;
						int dig = string.IsNullOrEmpty(row.GetCell(dig_index).StringValue) ? 0 : (int)(double)row.GetCell(dig_index).Value;
						var start = row.GetCell(str_index).DateTimeValue;
						DateTime? end = string.IsNullOrEmpty(row.GetCell(end_index).StringValue) ? (DateTime?)null : (DateTime?)row.GetCell(end_index).DateTimeValue;
						var sym = row.GetCell(sym_index).StringValue.Trim();
						var display = row.GetCell(def_index).StringValue.Trim();

						if (key != "ZZZ")
						{
							all.Add(key);

							writer.WriteLine("        /// <summary>Describes the currency {0} ({1}).</summary>", display, key);
							if (end.HasValue)
							{
								writer.WriteLine("        /// <remarks>End date is {0:yyyy-MM-dd}.</remarks>", end.Value);
							}
							writer.Write("        public static readonly Currency {0} = new Currency()", key);
							writer.Write(" { m_Value = \"");
							writer.Write(key);
							writer.WriteLine("\" };");
							writer.WriteLine();
						}
						key += '_';

						resx.Data.Add(new XResourceFileData(key + "DisplayName", display));
						resx.Data.Add(new XResourceFileData(key + "Num", num.ToString("000")));
						resx.Data.Add(new XResourceFileData(key + "ISO", iso));
						resx.Data.Add(new XResourceFileData(key + "Digits", dig.ToString()));

						resx.Data.Add(new XResourceFileData(key + "StartDate", start.ToString("yyyy-MM-dd")));

						if (!string.IsNullOrEmpty(sym))
						{
							resx.Data.Add(new XResourceFileData(key + "Symbol", sym));
						}

						if (end.HasValue)
						{
							resx.Data.Add(new XResourceFileData(key + "EndDate", end.Value.ToString("yyyy-MM-dd")));
						}
					}

					resx.Data.Add(new XResourceFileData("All", string.Join(";", all)));

					resx.Save(new FileInfo(Path.Combine(dir.FullName, "CurrencyLabels.resx")));

					for (int lng_index = def_index + 1; lng_index <= header.LastColIndex; lng_index++)
					{
						var resx_lng = new XResourceFile();

						var culture = header.GetCell(lng_index).StringValue;

						i = 1;

{'fraction_non_alphanumeric': 0.14782868610956915, 'fraction_numerical': 0.006490456466971262, 'mean_word_length': 2.9341508483117757, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2273381', 'n_tokens_mistral': 10167, 'n_tokens_neox': 7688, 'n_words': 1454}