86 {
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)).ToArray().ToDictionary(((
string file, ISheet[]
sheets, ISheet element) 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 }
102 if (sourceCache.IsDirtyOrEmpty)
103 {
104 if (dictionary.TryGetValue(sourceCache, out var value2) && value2.Item3 != null)
105 {
107 sourceCache.EmplaceCache(
"Element",
item);
108 value?.sourceRows.UnionWith(
item);
109 Debug.Log(
string.Format(
"#source workbook {0}:{1}:{2}", arg,
"Element",
item.Length));
110 }
111 }
112 else if (sourceCache.TryGetCache("Element", out rows))
113 {
114 int num = elements.ImportRows(rows);
115 value?.sourceRows.UnionWith(rows);
116 Debug.Log(
string.Format(
"#source workbook-cache {0}:{1}:{2}", arg,
"Element", num));
117 }
118 }
119 array2 = array;
120 foreach (SourceCache sourceCache2 in array2)
121 {
122 string text = sourceCache2.SheetFile.ShortPath();
123 if (sourceCache2.IsDirtyOrEmpty)
124 {
125 if (!dictionary.TryGetValue(sourceCache2, out var value3) || value3.Item2.Length == 0)
126 {
127 continue;
128 }
129 Debug.Log(
"#source workbook " + text);
130 ISheet[] item2 = value3.Item2;
131 foreach (ISheet sheet in item2)
132 {
133 if (sheet.SheetName == "Element")
134 {
135 continue;
136 }
138 if ((object)sourceData != null)
139 {
140 int? num2 = array3?.Length;
141 if (num2.HasValue && num2.GetValueOrDefault() > 0)
142 {
143 sourceCache2.EmplaceCache(sheet.SheetName, array3);
144 sourceCache2.Mod?.sourceRows.UnionWith(array3);
145 hashSet.Add(sourceData);
146 }
147 }
148 }
149 continue;
150 }
151 foreach (KeyValuePair<
string,
SourceData.
BaseRow[]> item3 in sourceCache2.Source)
152 {
153 item3.Deconstruct(out var key, out var value4);
154 string text2 = key;
158 {
159 if (sourceData2 is
SourceElement || (
object)sourceData2 ==
null)
160 {
161 continue;
162 }
163 }
164 else
165 {
167 }
168 if (array4 == null)
169 {
170 Debug.Log(
"#source cached rows are empty " + text +
":" + text2);
171 continue;
172 }
174 sourceCache2.Mod?.sourceRows.UnionWith(array4);
175 Debug.Log(
$"#source workbook-cache {text}:{text2}:{num3}");
176 hashSet.Add(sourceData2);
177 }
178 }
179 if (resetData)
180 {
182 }
183 return hashSet;
184 }
static SourceManager sources
override int ImportRows(IEnumerable< BaseRow > sourceRows)
string ISheet[] ISheet element PrefetchWorkbook(string file)
static void HotInit(IEnumerable< SourceData > sourceData)
Dictionary< string, EMod > fileProviders
SourceData FindSourceByName(string name)
SourceData.BaseRow[] LoadBySheetName(ISheet sheet, string file)