-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommonLibrary.cs
36 lines (31 loc) · 1.14 KB
/
CommonLibrary.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Globalization;
using HimbeertoniRaidTool.Common.Extensions;
using HimbeertoniRaidTool.Common.Localization;
using HimbeertoniRaidTool.Common.Services;
using Lumina.Excel;
using Lumina.Excel.Sheets;
using Item = HimbeertoniRaidTool.Common.Data.Item;
using LuminaItem = Lumina.Excel.Sheets.Item;
namespace HimbeertoniRaidTool.Common;
#pragma warning disable CS8618
public static class CommonLibrary
{
private static bool _isInitialized;
private static ExcelModule? _excelModule;
internal static ExcelModule ExcelModule
{
get => _excelModule ?? throw new InvalidOperationException("CommonLibrary is not initialized.");
private set => _excelModule = value;
}
public static void Init(ExcelModule module, string? language = null)
{
if (_isInitialized) return;
_isInitialized = true;
ExcelModule = module;
ItemExtensions.ItemInfoService = new ItemInfoService(module);
if (language is not null)
SetLanguage(language);
}
public static void SetLanguage(string langCode) => CommonLoc.Culture = new CultureInfo(langCode);
}
#pragma warning restore CS8618