85 {
86 string[] prefetchSheetNames = new string[2] { "Element", "Material" };
87 SourceCache[] array = imports.Select(SourceCache.GetOrCreate).Distinct().ToArray();
88 Dictionary<SourceCache, (string, ISheet[], ISheet[])> dictionary = (from c in array
89 where c.IsDirtyOrEmpty
90 select
PrefetchWorkbook(c.SheetFile.FullName, prefetchSheetNames)).ToArray().ToDictionary(((
string file, ISheet[]
sheets, ISheet[] fetched) p) => SourceCache.GetOrCreate(p.file));
92 HashSet<SourceData> hashSet = new HashSet<SourceData> { elements };
93 SourceCache[] array2 = array;
94 foreach (SourceCache sourceCache in array2)
95 {
96 string arg = sourceCache.SheetFile.ShortPath();
97 if (
fileProviders.TryGetValue(sourceCache.SheetFile.FullName, out var value))
98 {
99 sourceCache.SetMod(value);
100 }
101 if (sourceCache.IsDirtyOrEmpty)
102 {
103 if (!dictionary.TryGetValue(sourceCache, out var value2) || value2.Item3.Length == 0)
104 {
105 continue;
106 }
107 ISheet[]
item = value2.Item3;
108 foreach (ISheet sheet
in item)
109 {
111 if (!item2.IsEmpty())
112 {
113 sourceCache.EmplaceCache(sheet.SheetName, item2);
114 value?.sourceRows.UnionWith(item2);
115 Debug.Log(
$"#source workbook {arg}:{sheet.SheetName}:{item2.Length}");
116 }
117 }
118 continue;
119 }
120 string[] array3 = prefetchSheetNames;
121 foreach (string text in array3)
122 {
123 if (sourceCache.TryGetCache(text, out var rows))
124 {
125 int num = elements.ImportRows(rows);
126 value?.sourceRows.UnionWith(rows);
127 Debug.Log(
$"#source workbook-cache {arg}:{text}:{num}");
128 }
129 }
130 }
131 array2 = array;
132 foreach (SourceCache sourceCache2 in array2)
133 {
134 string text2 = sourceCache2.SheetFile.ShortPath();
135 if (sourceCache2.IsDirtyOrEmpty)
136 {
137 if (!dictionary.TryGetValue(sourceCache2, out var value3) || value3.Item2.Length == 0)
138 {
139 continue;
140 }
141 Debug.Log(
"#source workbook " + text2);
142 ISheet[]
item = value3.Item2;
143 foreach (ISheet sheet2
in item)
144 {
145 if (prefetchSheetNames.Contains(sheet2.SheetName))
146 {
147 continue;
148 }
150 if ((object)sourceData != null)
151 {
152 int? num2 = array4?.Length;
153 if (num2.HasValue && num2.GetValueOrDefault() > 0)
154 {
155 sourceCache2.EmplaceCache(sheet2.SheetName, array4);
156 sourceCache2.Mod?.sourceRows.UnionWith(array4);
157 hashSet.Add(sourceData);
158 }
159 }
160 }
161 continue;
162 }
163 foreach (KeyValuePair<
string,
SourceData.
BaseRow[]> item3 in sourceCache2.Source)
164 {
165 item3.Deconstruct(out var key, out var value4);
166 string text3 = key;
170 {
171 if (sourceData2 is
SourceElement || (
object)sourceData2 ==
null)
172 {
173 continue;
174 }
175 }
176 else
177 {
179 }
180 if (array5 == null)
181 {
182 Debug.Log(
"#source cached rows are empty " + text2 +
":" + text3);
183 continue;
184 }
186 sourceCache2.Mod?.sourceRows.UnionWith(array5);
187 Debug.Log(
$"#source workbook-cache {text2}:{text3}:{num3}");
188 hashSet.Add(sourceData2);
189 }
190 }
191 if (resetData)
192 {
194 }
195 return hashSet;
196 }
static SourceManager sources
override int ImportRows(IEnumerable< BaseRow > sourceRows)
static void HotInit(IEnumerable< SourceData > sourceData)
Dictionary< string, EMod > fileProviders
SourceData FindSourceByName(string name)
string ISheet[] ISheet[] fetched PrefetchWorkbook(string file, string[] prefetchNames)
SourceData.BaseRow[] LoadBySheetName(ISheet sheet, string file)