using System.Collections.Generic;
using QCRPG.Framework;

namespace QCRPG.TSL.BT;

public class RecentParameterSettings : IConfigurable
{
	public List<string> leLongTermKeys = new List<string> { "0102030405060708090A0B0C0D0E0F10" };

	public List<string> leRandomNumbers = new List<string> { "0102030405060708" };

	public Configuration GetConfiguration()
	{
		Configuration configuration = new Configuration();
		int count = leLongTermKeys.Count;
		configuration.SetInt("LELongTermKeyCount", count);
		for (int i = 1; i <= count; i++)
		{
			string name = $"LELongTermKey{i}";
			configuration.SetString(name, leLongTermKeys[i - 1]);
		}
		int count2 = leRandomNumbers.Count;
		configuration.SetInt("LERandomNumberCount", count2);
		for (int j = 1; j <= count2; j++)
		{
			string name2 = $"LERandomNumber{j}";
			configuration.SetString(name2, leRandomNumbers[j - 1]);
		}
		return configuration;
	}

	public void SetConfiguration(Configuration configuration)
	{
		int @int = configuration.GetInt("LELongTermKeyCount", 1);
		for (int i = 1; i <= @int; i++)
		{
			string name = $"LELongTermKey{i}";
			string @string = configuration.GetString(name, leLongTermKeys[0]);
			if (!leLongTermKeys.Contains(@string))
			{
				leLongTermKeys.Add(@string);
			}
		}
		int int2 = configuration.GetInt("LERandomNumberCount", 1);
		for (int j = 1; j <= int2; j++)
		{
			string name2 = $"LERandomNumber{j}";
			string string2 = configuration.GetString(name2, leRandomNumbers[0]);
			if (!leRandomNumbers.Contains(string2))
			{
				leRandomNumbers.Add(string2);
			}
		}
	}
}
