2024-03-13 01:44:15 -04:00
|
|
|
|
#if NET40_OR_GREATER || NETCOREAPP
|
2024-03-12 23:27:23 -04:00
|
|
|
|
using System.Collections.Concurrent;
|
2024-03-13 01:44:15 -04:00
|
|
|
|
#else
|
2022-11-03 15:54:00 -07:00
|
|
|
|
using System.Collections.Generic;
|
2024-03-12 23:27:23 -04:00
|
|
|
|
#endif
|
2022-11-03 15:54:00 -07:00
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using SabreTools.DatItems;
|
|
|
|
|
|
|
|
|
|
|
|
namespace SabreTools.DatFiles
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Item dictionary with statistics, bucketing, and sorting
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[JsonObject("items"), XmlRoot("items")]
|
2024-03-13 01:44:15 -04:00
|
|
|
|
public class ItemDictionaryDB
|
2022-11-03 15:54:00 -07:00
|
|
|
|
{
|
|
|
|
|
|
#region Private instance variables
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-03-12 23:27:23 -04:00
|
|
|
|
/// Internal dictionary for all items
|
2022-11-03 15:54:00 -07:00
|
|
|
|
/// </summary>
|
2024-03-12 23:27:23 -04:00
|
|
|
|
#if NET40_OR_GREATER || NETCOREAPP
|
2024-03-13 01:44:15 -04:00
|
|
|
|
private readonly ConcurrentDictionary<long, DatItem> items = new ConcurrentDictionary<long, DatItem>();
|
2024-03-12 23:27:23 -04:00
|
|
|
|
#else
|
2024-03-13 01:44:15 -04:00
|
|
|
|
private readonly Dictionary<long, DatItem> items = [];
|
2024-03-12 23:27:23 -04:00
|
|
|
|
#endif
|
2022-11-03 15:54:00 -07:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-03-12 23:27:23 -04:00
|
|
|
|
/// Internal dictionary for all machines
|
2022-11-03 15:54:00 -07:00
|
|
|
|
/// </summary>
|
2024-03-12 23:27:23 -04:00
|
|
|
|
#if NET40_OR_GREATER || NETCOREAPP
|
2024-03-13 01:44:15 -04:00
|
|
|
|
private readonly ConcurrentDictionary<long, Machine> machines = new ConcurrentDictionary<long, Machine>();
|
2024-03-12 23:27:23 -04:00
|
|
|
|
#else
|
2024-03-13 01:44:15 -04:00
|
|
|
|
private readonly Dictionary<long, Machine> machines = [];
|
2024-03-13 01:41:18 -04:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Internal dictionary for item to machine mappings
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
#if NET40_OR_GREATER || NETCOREAPP
|
2024-03-13 01:44:15 -04:00
|
|
|
|
private readonly ConcurrentDictionary<long, long> itemToMachineMapping = new ConcurrentDictionary<long, long>();
|
2024-02-28 22:54:56 -05:00
|
|
|
|
#else
|
2024-03-13 01:44:15 -04:00
|
|
|
|
private readonly Dictionary<long, long> itemToMachineMapping = [];
|
2024-02-28 22:54:56 -05:00
|
|
|
|
#endif
|
2022-11-03 15:54:00 -07:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|