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 {
110 ExcelParser.allowTrimming = true;
111 try
112 {
114 if (!item2.IsEmpty())
115 {
116 sourceCache.EmplaceCache(sheet.SheetName, item2);
117 value?.sourceRows.UnionWith(item2);
118 Debug.Log(
$"#source workbook {arg}:{sheet.SheetName}:{item2.Length}");
119 }
120 }
121 finally
122 {
123 ExcelParser.allowTrimming = false;
124 }
125 }
126 continue;
127 }
128 string[] array3 = prefetchSheetNames;
129 foreach (string text in array3)
130 {
131 if (sourceCache.TryGetCache(text, out var rows))
132 {
133 int num = elements.ImportRows(rows);
134 value?.sourceRows.UnionWith(rows);
135 Debug.Log(
$"#source workbook-cache {arg}:{text}:{num}");
136 }
137 }
138 }
139 array2 = array;
140 foreach (SourceCache sourceCache2 in array2)
141 {
142 string text2 = sourceCache2.SheetFile.ShortPath();
143 string key;
144 if (sourceCache2.IsDirtyOrEmpty)
145 {
146 if (!dictionary.TryGetValue(sourceCache2, out var value3) || value3.Item2.Length == 0)
147 {
148 continue;
149 }
150 Debug.Log(
"#source workbook " + text2);
151 ISheet[]
item = value3.Item2;
152 foreach (ISheet sheet2
in item)
153 {
154 if (prefetchSheetNames.Contains(sheet2.SheetName))
155 {
156 continue;
157 }
158 key = sheet2.SheetName;
159 int allowTrimming;
160 switch (key)
161 {
162 default:
163 allowTrimming = ((!(key == "Word")) ? 1 : 0);
164 break;
165 case "General":
166 case "Game":
167 case "Note":
168 case "List":
169 allowTrimming = 0;
170 break;
171 }
172 ExcelParser.allowTrimming = (byte)allowTrimming != 0;
173 try
174 {
176 if ((object)sourceData != null)
177 {
178 int? num2 = array4?.Length;
179 if (num2.HasValue && num2.GetValueOrDefault() > 0)
180 {
181 sourceCache2.EmplaceCache(sheet2.SheetName, array4);
182 sourceCache2.Mod?.sourceRows.UnionWith(array4);
183 hashSet.Add(sourceData);
184 }
185 }
186 }
187 finally
188 {
189 ExcelParser.allowTrimming = false;
190 }
191 }
192 continue;
193 }
194 foreach (KeyValuePair<
string,
SourceData.
BaseRow[]> item3 in sourceCache2.Source)
195 {
196 item3.Deconstruct(out key, out var value4);
197 string text3 = key;
201 {
202 if (sourceData2 is
SourceElement || (
object)sourceData2 ==
null)
203 {
204 continue;
205 }
206 }
207 else
208 {
210 }
211 if (array5 == null)
212 {
213 Debug.Log(
"#source cached rows are empty " + text2 +
":" + text3);
214 continue;
215 }
217 sourceCache2.Mod?.sourceRows.UnionWith(array5);
218 Debug.Log(
$"#source workbook-cache {text2}:{text3}:{num3}");
219 hashSet.Add(sourceData2);
220 }
221 }
222 if (resetData)
223 {
225 }
226 return hashSet;
227 }
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)