Elin Decompiled Documentation EA 23.319 Nightly Patch 1
Loading...
Searching...
No Matches
ExcelDataList.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.IO;
3
4public class ExcelDataList
5{
6 public List<ExcelData> items = new List<ExcelData>(0);
7
8 public Dictionary<string, Dictionary<string, string>> all = new Dictionary<string, Dictionary<string, string>>();
9
10 public List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
11
12 protected bool initialized;
13
14 public virtual int StartIndex => 5;
15
16 public void Reload()
17 {
18 all.Clear();
19 list.Clear();
20 initialized = false;
21 }
22
23 public virtual void Initialize()
24 {
25 if (initialized)
26 {
27 return;
28 }
29 foreach (ExcelData item in items)
30 {
31 item.startIndex = StartIndex;
32 List<Dictionary<string, string>> obj = item.BuildList();
33 string directoryName = new FileInfo(item.path).DirectoryName;
34 foreach (Dictionary<string, string> item2 in obj)
35 {
36 item2["path"] = directoryName;
37 if (item2.TryGetValue("id", out var value))
38 {
39 all[value] = item2;
40 }
41 list.Add(item2);
42 }
43 }
45 initialized = true;
46 }
47
48 public virtual void OnInitialize()
49 {
50 }
51
52 public bool HasRow(string id)
53 {
54 Initialize();
55 return all.ContainsKey(id);
56 }
57
58 public Dictionary<string, string> GetRow(string id)
59 {
60 Initialize();
61 return all.TryGetValue(id);
62 }
63
64 public void Add(ExcelData data)
65 {
66 items.Add(data);
67 Reload();
68 }
69
70 public void Clear()
71 {
72 items.Clear();
73 Reload();
74 }
75}
Dictionary< string, Dictionary< string, string > > all
Definition: ExcelDataList.cs:8
List< ExcelData > items
Definition: ExcelDataList.cs:6
bool HasRow(string id)
List< Dictionary< string, string > > list
virtual int StartIndex
virtual void OnInitialize()
void Add(ExcelData data)
Dictionary< string, string > GetRow(string id)
virtual void Initialize()