Elin Decompiled Documentation EA 23.284 Nightly Patch 2
Loading...
Searching...
No Matches
SourceData.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Reflection;
5using NPOI.SS.UserModel;
6using NPOI.SS.Util;
7using NPOI.XSSF.UserModel;
8using UnityEngine;
9
10public class SourceData<T, T2> : SourceData where T : SourceData.BaseRow
11{
12 public class FieldInfo
13 {
14 public string id;
15
16 public string name;
17
18 public bool isStatic;
19
20 public int width;
21
22 public int column;
23
24 public bool IsIndex => id == "id";
25
26 public string GetValue(T r)
27 {
28 if (r.HasField<string>(id))
29 {
30 return r.GetField<string>(id);
31 }
32 if (r.HasField<int>(id))
33 {
34 return r.GetField<int>(id).ToString();
35 }
36 if (r.HasField<string[]>(id))
37 {
38 string text = "";
39 string[] field = r.GetField<string[]>(id);
40 if (field != null)
41 {
42 string[] array = field;
43 foreach (string text2 in array)
44 {
45 text = text + text2 + ",";
46 }
47 }
48 return text.TrimEnd(',');
49 }
50 return "";
51 }
52 }
53
54 public class FieldMap
55 {
57
58 public int column;
59 }
60
61 public List<T> rows = new List<T>();
62
63 public Dictionary<T2, T> map = new Dictionary<T2, T>();
64
65 public Dictionary<string, T> alias = new Dictionary<string, T>();
66
67 [NonSerialized]
68 public bool initialized;
69
70 [NonSerialized]
71 private List<T> _backupRows = new List<T>();
72
73 [NonSerialized]
74 public List<string> editorListString = new List<string>();
75
76 public static ISheet currentSheet;
77
78 public virtual bool AllowHotInitialization => false;
79
80 public virtual string[] ImportFields => new string[1] { "" };
81
82 public override void Init()
83 {
84 Debug.Log("Initializing:" + base.name);
85 if (initialized)
86 {
87 Debug.Log("#init Skipping sourceData.Init:" + base.name);
88 return;
89 }
90 initialized = true;
91 editorListString.Clear();
93 int num = 0;
94 foreach (T row in rows)
95 {
96 SetRow(row);
97 if (row.UseAlias)
98 {
99 alias[row.GetAlias] = row;
100 }
101 row._index = num;
102 num++;
103 }
104 OnInit();
105 }
106
107 public virtual void OnInit()
108 {
109 }
110
111 public virtual void SetRow(T row)
112 {
113 }
114
115 public override void Reset()
116 {
117 initialized = false;
118 if (!Application.isPlaying)
119 {
120 BaseCore.resetRuntime = true;
121 }
122 if (map != null)
123 {
124 map.Clear();
125 }
126 if (alias != null)
127 {
128 alias.Clear();
129 }
130 if (Application.isPlaying && AllowHotInitialization)
131 {
132 Init();
133 }
134 }
135
136 public override bool ImportData(ISheet sheet, string bookname, bool overwrite = false)
137 {
138 if (!overwrite)
139 {
140 rows = new List<T>();
141 }
142 isNew = true;
143 nameSheet = sheet.SheetName;
144 nameBook = bookname;
145 SourceData.rowDefault = sheet.GetRow(2);
146 int num = 0;
147 for (int i = 3; i <= sheet.LastRowNum; i++)
148 {
149 SourceData.row = sheet.GetRow(i);
150 if (SourceData.row == null || SourceData.row.GetCell(0) == null || SourceData.row.GetCell(0).ToString().IsEmpty())
151 {
152 break;
153 }
154 T val = CreateRow();
155 val.OnImportData(this);
156 rows.Add(val);
157 num++;
158 }
159 string text = sheet.SheetName + "/" + sheet.LastRowNum + "/" + num;
160 Debug.Log(text);
161 ERROR.msg = text;
163 initialized = false;
164 return true;
165 }
166
167 public virtual void OnAfterImportData()
168 {
169 }
170
171 public virtual T CreateRow()
172 {
173 return null;
174 }
175
176 public override int ImportRows(IEnumerable<BaseRow> sourceRows)
177 {
178 int num = 0;
179 foreach (BaseRow sourceRow in sourceRows)
180 {
181 if (sourceRow is T val)
182 {
183 val.OnImportData(this);
184 rows.Add(val);
185 num++;
186 }
187 }
189 initialized = false;
190 return num;
191 }
192
193 public virtual void RemoveDuplicateRows()
194 {
195 HashSet<T2> hashSet = new HashSet<T2>();
196 List<T> list = new List<T>(rows.Count);
197 string arg = GetType().Name;
198 System.Reflection.FieldInfo field = typeof(T).GetField("id");
199 bool flag = typeof(LangRow).IsAssignableFrom(typeof(T));
200 if (field == null)
201 {
202 return;
203 }
204 if (field.FieldType != typeof(T2))
205 {
206 Debug.LogError($"#source override: {arg} id field mismatch {field.FieldType} != {typeof(T2)}");
207 }
208 for (int num = rows.Count - 1; num >= 0; num--)
209 {
210 T val = rows[num];
211 T2 val2 = (T2)field.GetValue(val);
212 if (hashSet.Add(val2))
213 {
214 list.Add(val);
215 }
216 else if (!flag)
217 {
218 Debug.Log($"#source override: {arg} {val2}");
219 }
220 }
221 if (rows.Count != list.Count)
222 {
223 Debug.Log($"#source override: {arg} total/{rows.Count} -> unique/{list.Count}");
224 list.Reverse();
225 rows = list;
226 }
227 }
228
229 public override void BackupSource()
230 {
232 }
233
234 public override void RollbackSource()
235 {
237 }
238
239 public List<string> GetListString()
240 {
241 return BuildEditorList().editorListString;
242 }
243
245 {
246 if (editorListString.Count == 0)
247 {
248 foreach (T row in rows)
249 {
250 editorListString.Add(row.GetEditorListName());
251 }
252 }
253 return this;
254 }
255
256 public List<FieldInfo> GetFields()
257 {
258 List<FieldInfo> list = new List<FieldInfo>();
259 int x = 0;
260 AddField("id", 4096);
261 AddField("version", 4096);
262 AddField("filter", 4096);
263 AddField("name", 4096);
264 AddField("text", 4096);
265 AddField("detail", 4096);
266 AddField("description", 4096);
267 string[] importFields = ImportFields;
268 foreach (string text in importFields)
269 {
270 if (!text.IsEmpty())
271 {
272 AddField(text, 4096);
273 }
274 }
275 return list;
276 void AddField(string id, int width)
277 {
278 bool flag = id == "id" || id == "filter";
279 bool flag2 = id == "version";
280 if (!(typeof(T).GetField(id) == null) || flag2)
281 {
282 list.Add(new FieldInfo
283 {
284 id = id,
285 name = id,
286 isStatic = flag,
287 width = width,
288 column = x
289 });
290 x++;
291 if (!(flag || flag2))
292 {
293 list.Add(new FieldInfo
294 {
295 id = id,
296 name = id + "_EN",
297 isStatic = true,
298 width = width,
299 column = x
300 });
301 x++;
302 list.Add(new FieldInfo
303 {
304 id = id + "_JP",
305 name = id + "_JP",
306 isStatic = true,
307 width = width,
308 column = x
309 });
310 x++;
311 }
312 }
313 }
314 }
315
316 public virtual T GetRow(string id)
317 {
318 return null;
319 }
320
321 public override void ExportTexts(string path, bool update = false)
322 {
323 Debug.Log("Exporting:" + nameSheet + " path:" + path);
324 string text = nameSheet + ".xlsx";
325 XSSFWorkbook xSSFWorkbook = new XSSFWorkbook();
326 List<FieldInfo> fields = GetFields();
327 currentSheet = xSSFWorkbook.CreateSheet(nameSheet);
328 int num = 0;
329 int y = 0;
330 foreach (FieldInfo item in fields)
331 {
332 GetCell(num, y).SetCellValue(item.name);
333 currentSheet.SetColumnWidth(num, item.width);
334 ICellStyle cellStyle = xSSFWorkbook.CreateCellStyle();
335 cellStyle.FillForegroundColor = 44;
336 cellStyle.FillPattern = FillPattern.SolidForeground;
337 if (!item.isStatic && item.id != "version")
338 {
339 GetCell(num, y).CellStyle = cellStyle;
340 }
341 num++;
342 }
343 string cellValue = BaseCore.Instance.version.GetText() ?? "";
344 y = 2;
345 foreach (T row4 in rows)
346 {
347 foreach (FieldInfo item2 in fields)
348 {
349 if (item2.isStatic)
350 {
351 GetCell(item2.column, y).SetCellValue(item2.GetValue(row4));
352 }
353 else if (item2.id == "version")
354 {
355 GetCell(item2.column, y).SetCellValue(cellValue);
356 }
357 }
358 y++;
359 }
360 currentSheet.CreateFreezePane(0, 2);
361 currentSheet.SetAutoFilter(new CellRangeAddress(1, 1, 0, fields.Count - 1));
362 if (update)
363 {
364 Dictionary<string, int> dictionary = new Dictionary<string, int>();
365 if (!File.Exists(path + "_temp/" + text))
366 {
367 return;
368 }
369 XSSFWorkbook xSSFWorkbook2;
370 using (FileStream @is = File.Open(path + "_temp/" + text, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
371 {
372 xSSFWorkbook2 = new XSSFWorkbook((Stream)@is);
373 }
374 ISheet sheetAt = xSSFWorkbook2.GetSheetAt(0);
375 IRow row = sheetAt.GetRow(0);
376 int num2 = 0;
377 foreach (FieldInfo item3 in fields)
378 {
379 if (item3.isStatic)
380 {
381 continue;
382 }
383 int num3 = -1;
384 for (int i = 0; i < row.LastCellNum; i++)
385 {
386 string stringCellValue = row.GetCell(i).StringCellValue;
387 if (stringCellValue.IsEmpty())
388 {
389 break;
390 }
391 if (stringCellValue == item3.id)
392 {
393 num3 = i;
394 break;
395 }
396 }
397 if (num3 == -1)
398 {
399 continue;
400 }
401 dictionary.Add(item3.id, 0);
402 for (y = 2; y <= sheetAt.LastRowNum; y++)
403 {
404 IRow row2 = sheetAt.GetRow(y);
405 if (row2 == null)
406 {
407 if (y > 5)
408 {
409 break;
410 }
411 continue;
412 }
413 ICell cell = row2.GetCell(0);
414 if (cell == null)
415 {
416 continue;
417 }
418 string text2 = ((cell.CellType == CellType.Numeric) ? cell.NumericCellValue.ToString() : cell.StringCellValue);
419 if (text2.IsEmpty())
420 {
421 continue;
422 }
423 for (int j = 0; j <= currentSheet.LastRowNum; j++)
424 {
425 IRow row3 = currentSheet.GetRow(j);
426 if (row3 == null)
427 {
428 if (j > 5)
429 {
430 break;
431 }
432 continue;
433 }
434 ICell cell2 = row3.GetCell(0);
435 if (cell2 == null || cell2.StringCellValue != text2)
436 {
437 continue;
438 }
439 string text3 = row2.GetCell(num3)?.StringCellValue ?? "";
440 if (text3.IsEmpty())
441 {
442 continue;
443 }
444 (row3.GetCell(item3.column) ?? row3.CreateCell(item3.column)).SetCellValue(text3);
445 if (item3.id != "version")
446 {
447 ICell cell3 = row3.GetCell(item3.column + 2);
448 ICell cell4 = row2.GetCell(num3 + 2);
449 if (cell3 == null)
450 {
451 continue;
452 }
453 if (cell4 == null || cell3.StringCellValue != cell4.StringCellValue)
454 {
455 row3.GetCell(1).SetCellValue(cellValue);
456 }
457 num2++;
458 }
459 dictionary[item3.id]++;
460 }
461 }
462 }
463 Log.system = Log.system + ((num2 == 0) ? "(No Changes) " : "(Updated) ") + path + "/" + text + Environment.NewLine;
464 if (num2 != 0)
465 {
466 foreach (KeyValuePair<string, int> item4 in dictionary)
467 {
468 Log.system = Log.system + item4.Key + ":" + item4.Value + " ";
469 }
470 Log.system += Environment.NewLine;
471 }
472 Log.system += Environment.NewLine;
473 }
474 if (!Directory.Exists(path))
475 {
476 Directory.CreateDirectory(path);
477 }
478 using FileStream stream = new FileStream(path + "/" + text, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
479 xSSFWorkbook.Write(stream);
480 }
481
482 public override void ValidateLang()
483 {
484 string langImportMod = CorePath.CorePackage.LangImportMod;
485 string text = nameSheet + ".xlsx";
486 Log.system = Log.system + langImportMod + text + Environment.NewLine;
487 Log.system += Environment.NewLine;
488 }
489
490 public override void ImportTexts(string _nameSheet = null)
491 {
492 string langImportMod = CorePath.CorePackage.LangImportMod;
493 string text = _nameSheet.IsEmpty(nameSheet) + ".xlsx";
494 if (!File.Exists(langImportMod + text))
495 {
496 return;
497 }
498 XSSFWorkbook xSSFWorkbook;
499 using (FileStream @is = File.Open(langImportMod + text, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
500 {
501 xSSFWorkbook = new XSSFWorkbook((Stream)@is);
502 }
503 ISheet sheetAt = xSSFWorkbook.GetSheetAt(0);
504 List<FieldInfo> fields = GetFields();
505 IRow row = sheetAt.GetRow(0);
506 List<FieldMap> list = new List<FieldMap>();
507 foreach (FieldInfo item in fields)
508 {
509 if (item.isStatic)
510 {
511 continue;
512 }
513 for (int i = 0; i < row.LastCellNum; i++)
514 {
515 string stringCellValue = row.GetCell(i).StringCellValue;
516 if (stringCellValue.IsEmpty())
517 {
518 break;
519 }
520 if (stringCellValue == item.id)
521 {
522 list.Add(new FieldMap
523 {
524 field = item,
525 column = i
526 });
527 break;
528 }
529 }
530 }
531 for (int j = 2; j <= sheetAt.LastRowNum; j++)
532 {
533 IRow row2 = sheetAt.GetRow(j);
534 T val = GetRow(row2.GetCell(0).StringCellValue);
535 if (val == null)
536 {
537 Debug.Log(sheetAt.SheetName + ": id to import no longer exist: " + row2.GetCell(0).StringCellValue);
538 break;
539 }
540 foreach (FieldMap item2 in list)
541 {
542 FieldInfo field = item2.field;
543 System.Reflection.FieldInfo field2 = val.GetType().GetField(field.id + "_L");
544 if (field2 == null)
545 {
546 continue;
547 }
548 if (typeof(string[]).IsAssignableFrom(field2.FieldType))
549 {
550 ICell cell = row2.GetCell(item2.column);
551 string[] array = ((cell == null) ? new string[0] : cell.StringCellValue.Split(','));
552 string[] field3 = val.GetField<string[]>(field.id);
553 if (field3 != null)
554 {
555 field2.SetValue(val, (array.Length >= field3.Length) ? array : field3);
556 }
557 }
558 else
559 {
560 ICell cell2 = row2.GetCell(item2.column);
561 if (cell2 != null)
562 {
563 field2.SetValue(val, cell2.StringCellValue.IsEmpty(val.GetField<string>(field.id)));
564 }
565 }
566 }
567 }
568 }
569
570 public static ICell GetCell(int x, int y)
571 {
572 IRow row = currentSheet.GetRow(y) ?? currentSheet.CreateRow(y);
573 return row.GetCell(x) ?? row.CreateCell(x);
574 }
575}
576public class SourceData : ScriptableObject
577{
578 public enum AutoID
579 {
580 None,
581 Auto
582 }
583
584 [Serializable]
585 public class BaseRow
586 {
587 private static readonly Dictionary<Type, Dictionary<string, FieldInfo>> _fieldCache = new Dictionary<Type, Dictionary<string, FieldInfo>>();
588
589 public int _index;
590
591 public virtual bool UseAlias => false;
592
593 public virtual string GetAlias => "";
594
595 public Dictionary<string, FieldInfo> GetRowFields()
596 {
597 Type type = GetType();
598 if (_fieldCache.TryGetValue(type, out var value))
599 {
600 return value;
601 }
602 value = new Dictionary<string, FieldInfo>();
603 FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public);
604 foreach (FieldInfo fieldInfo in fields)
605 {
606 value[fieldInfo.Name] = fieldInfo;
607 }
608 return _fieldCache[type] = value;
609 }
610
611 public virtual string GetName()
612 {
613 return GetText();
614 }
615
616 public string GetDetail()
617 {
618 return GetText("detail");
619 }
620
621 public virtual string GetEditorListName()
622 {
623 return this.GetField<int>("id") + "-" + this.GetField<string>("alias") + "(" + this.GetField<string>("name_JP") + ")";
624 }
625
626 public string GetText(string id = "name", bool returnNull = false)
627 {
628 Dictionary<string, FieldInfo> rowFields = GetRowFields();
629 if (rowFields.TryGetValue(id + LangSuffix, out var value))
630 {
631 string text = value.GetValue(this) as string;
632 if (!text.IsEmpty())
633 {
634 return text;
635 }
636 }
637 if (!Lang.isBuiltin && rowFields.TryGetValue(id, out var value2))
638 {
639 string text2 = value2.GetValue(this) as string;
640 if (!text2.IsEmpty())
641 {
642 return text2;
643 }
644 }
645 if (!returnNull)
646 {
647 return "";
648 }
649 return null;
650 }
651
652 public string[] GetTextArray(string id)
653 {
654 Dictionary<string, FieldInfo> rowFields = GetRowFields();
655 if (rowFields.TryGetValue(id + LangSuffix, out var value) && value.GetValue(this) is string[] { Length: >0 } array)
656 {
657 return array;
658 }
659 if (!Lang.isBuiltin && rowFields.TryGetValue(id, out var value2) && value2.GetValue(this) is string[] { Length: >0 } array2)
660 {
661 return array2;
662 }
663 return Array.Empty<string>();
664 }
665
666 public virtual void SetID(ref int count)
667 {
668 this.SetField("id", count);
669 count++;
670 }
671
672 public virtual void OnImportData(SourceData data)
673 {
674 }
675
676 public virtual IDictionary<string, string> ExportTexts(string idField = "id")
677 {
678 Dictionary<string, FieldInfo> rowFields = GetRowFields();
679 object obj = rowFields.GetValueOrDefault(idField)?.GetValue(this);
680 SortedDictionary<string, string> sortedDictionary = new SortedDictionary<string, string>();
681 if (obj == null)
682 {
683 return sortedDictionary;
684 }
685 string name = GetType().DeclaringType.Name;
686 foreach (var (text2, jp2) in rowFields)
687 {
688 if (!text2.EndsWith("_JP"))
689 {
690 continue;
691 }
692 string text3 = text2[..^3];
693 if (rowFields.TryGetValue(text3, out var value) && rowFields.ContainsKey(text3 + "_L"))
694 {
695 string text4 = GetFieldText(jp2, value);
696 if (!text4.IsEmpty())
697 {
698 sortedDictionary[$"{name}.{obj}.{text3}"] = text4;
699 }
700 }
701 }
702 return sortedDictionary;
703 string GetFieldText(FieldInfo jp, FieldInfo en)
704 {
705 object obj2 = jp.GetValue(this);
706 object obj3 = en.GetValue(this);
707 if (!Lang.isJP)
708 {
709 object obj4 = obj2;
710 object obj5 = obj3;
711 obj3 = obj4;
712 obj2 = obj5;
713 }
714 if (obj2 is string str)
715 {
716 return str.IsEmpty(obj3 as string);
717 }
718 if (obj2 is string[] array)
719 {
720 return string.Join(',', (array.Length != 0) ? array : (obj3 as string[]));
721 }
722 return null;
723 }
724 }
725
726 public virtual void ImportTexts(IReadOnlyDictionary<string, string> texts, string idField = "id")
727 {
728 Dictionary<string, FieldInfo> rowFields = GetRowFields();
729 object obj = rowFields.GetValueOrDefault(idField)?.GetValue(this);
730 if (obj == null)
731 {
732 return;
733 }
734 string name = GetType().DeclaringType.Name;
735 foreach (var (text2, fieldInfo2) in rowFields)
736 {
737 if (!text2.EndsWith("_L"))
738 {
739 continue;
740 }
741 string text3 = text2[..^2];
742 if (rowFields.ContainsKey(text3) && rowFields.ContainsKey(text3 + "_JP"))
743 {
744 fieldInfo2.SetValue(this, null);
745 if (texts.TryGetValue($"{name}.{obj}.{text3}", out var value2) && !value2.IsEmpty())
746 {
747 SetFieldText(fieldInfo2, value2);
748 }
749 }
750 }
751 void SetFieldText(FieldInfo l, string value)
752 {
753 if (l.FieldType == typeof(string))
754 {
755 l.SetValue(this, value);
756 }
757 else if (l.FieldType == typeof(string[]))
758 {
759 l.SetValue(this, value.IsEmpty() ? Array.Empty<string>() : value.Split(','));
760 }
761 }
762 }
763 }
764
765 public static string LangSuffix;
766
767 public static string dataPath;
768
770
771 public bool isNew = true;
772
773 public string nameSheet;
774
775 public string nameBook;
776
777 public virtual string sheetName => "";
778
779 public virtual string sourcePath => "";
780
781 public static IRow row
782 {
783 get
784 {
785 return ExcelParser.row;
786 }
787 set
788 {
789 ExcelParser.row = value;
790 }
791 }
792
793 public static IRow rowDefault
794 {
795 get
796 {
797 return ExcelParser.rowDefault;
798 }
799 set
800 {
801 ExcelParser.rowDefault = value;
802 }
803 }
804
805 public void BuildFlags(string rawText, Dictionary<string, bool> map)
806 {
807 if (!string.IsNullOrEmpty(rawText))
808 {
809 string[] array = rawText.Split(',');
810 foreach (string key in array)
811 {
812 map.Add(key, value: true);
813 }
814 }
815 }
816
817 public virtual void Reset()
818 {
819 }
820
821 public virtual void InsertData(IRow row)
822 {
823 }
824
825 public virtual void Init()
826 {
827 }
828
829 public virtual string[] GetList(string id)
830 {
831 return null;
832 }
833
834 public virtual bool ImportData(ISheet sheet, string bookname, bool overwrite = false)
835 {
836 return false;
837 }
838
839 public virtual int ImportRows(IEnumerable<BaseRow> sourceRows)
840 {
841 return 0;
842 }
843
844 public virtual void BackupSource()
845 {
846 }
847
848 public virtual void RollbackSource()
849 {
850 }
851
852 public virtual void BackupPref()
853 {
854 }
855
856 public virtual void RestorePref()
857 {
858 }
859
860 public virtual void ValidatePref()
861 {
862 }
863
864 public virtual void ExportTexts(string path, bool update = false)
865 {
866 }
867
868 public virtual void ImportTexts(string _nameSheet = null)
869 {
870 }
871
872 public virtual void ValidateLang()
873 {
874 }
875
876 public static bool IsNull(ICell cell)
877 {
878 if (cell != null && cell.CellType != CellType.Blank)
879 {
880 return cell.CellType == CellType.Unknown;
881 }
882 return true;
883 }
884
885 public static int GetInt(int id)
886 {
887 return ExcelParser.GetInt(id);
888 }
889
890 public static bool GetBool(int id)
891 {
892 return ExcelParser.GetBool(id);
893 }
894
895 public static double GetDouble(int id)
896 {
897 return ExcelParser.GetDouble(id);
898 }
899
900 public static float GetFloat(int id)
901 {
902 return ExcelParser.GetFloat(id);
903 }
904
905 public static float[] GetFloatArray(int id)
906 {
907 return ExcelParser.GetFloatArray(id);
908 }
909
910 public static int[] GetIntArray(int id)
911 {
912 return ExcelParser.GetIntArray(id);
913 }
914
915 public static string[] GetStringArray(int id)
916 {
917 return ExcelParser.GetStringArray(id);
918 }
919
920 public static string GetString(int id)
921 {
922 return ExcelParser.GetString(id);
923 }
924
925 public static string GetStr(int id, bool useDefault = false)
926 {
927 return ExcelParser.GetStr(id, useDefault);
928 }
929}
$
Definition: ModManager.cs:85
Version version
Definition: BaseCore.cs:17
static BaseCore Instance
Definition: BaseCore.cs:11
static string LangImportMod
Definition: CorePath.cs:89
static bool GetBool(int id)
Definition: ExcelParser.cs:43
static IRow rowDefault
Definition: ExcelParser.cs:12
static int GetInt(int id)
Definition: ExcelParser.cs:23
static IRow row
Definition: ExcelParser.cs:10
static string GetString(int id)
Definition: ExcelParser.cs:140
static int[] GetIntArray(int id)
Definition: ExcelParser.cs:110
static float GetFloat(int id)
Definition: ExcelParser.cs:76
static double GetDouble(int id)
Definition: ExcelParser.cs:62
static string GetStr(int id, bool useDefault=false)
Definition: ExcelParser.cs:151
static float[] GetFloatArray(int id)
Definition: ExcelParser.cs:90
static string[] GetStringArray(int id)
Definition: ExcelParser.cs:130
Definition: Lang.cs:7
static bool isBuiltin
Definition: Lang.cs:43
static bool isJP
Definition: Lang.cs:39
virtual string GetEditorListName()
Definition: SourceData.cs:621
string GetDetail()
Definition: SourceData.cs:616
string[] GetTextArray(string id)
Definition: SourceData.cs:652
virtual string GetAlias
Definition: SourceData.cs:593
virtual void SetID(ref int count)
Definition: SourceData.cs:666
virtual string GetName()
Definition: SourceData.cs:611
string GetText(string id="name", bool returnNull=false)
Definition: SourceData.cs:626
virtual bool UseAlias
Definition: SourceData.cs:591
virtual IDictionary< string, string > ExportTexts(string idField="id")
Definition: SourceData.cs:676
static readonly Dictionary< Type, Dictionary< string, FieldInfo > > _fieldCache
Definition: SourceData.cs:587
virtual void OnImportData(SourceData data)
Definition: SourceData.cs:672
virtual void ImportTexts(IReadOnlyDictionary< string, string > texts, string idField="id")
Definition: SourceData.cs:726
Dictionary< string, FieldInfo > GetRowFields()
Definition: SourceData.cs:595
string GetValue(T r)
Definition: SourceData.cs:26
static float GetFloat(int id)
Definition: SourceData.cs:900
virtual string[] ImportFields
Definition: SourceData.cs:80
static string[] GetStringArray(int id)
Definition: SourceData.cs:915
virtual void SetRow(T row)
Definition: SourceData.cs:111
override bool ImportData(ISheet sheet, string bookname, bool overwrite=false)
Definition: SourceData.cs:136
static string GetString(int id)
Definition: SourceData.cs:920
static IRow row
Definition: SourceData.cs:782
static bool GetBool(int id)
Definition: SourceData.cs:890
override void RollbackSource()
Definition: SourceData.cs:234
override void ExportTexts(string path, bool update=false)
Definition: SourceData.cs:321
static bool IsNull(ICell cell)
Definition: SourceData.cs:876
virtual string[] GetList(string id)
Definition: SourceData.cs:829
virtual T CreateRow()
Definition: SourceData.cs:171
virtual void Reset()
Definition: SourceData.cs:817
static double GetDouble(int id)
Definition: SourceData.cs:895
static IRow rowDefault
Definition: SourceData.cs:794
virtual void BackupSource()
Definition: SourceData.cs:844
virtual string sheetName
Definition: SourceData.cs:777
static int GetInt(int id)
Definition: SourceData.cs:885
virtual void InsertData(IRow row)
Definition: SourceData.cs:821
virtual string sourcePath
Definition: SourceData.cs:779
virtual void OnInit()
Definition: SourceData.cs:107
AutoID autoID
Definition: SourceData.cs:769
override void BackupSource()
Definition: SourceData.cs:229
string nameBook
Definition: SourceData.cs:775
void BuildFlags(string rawText, Dictionary< string, bool > map)
Definition: SourceData.cs:805
static string GetStr(int id, bool useDefault=false)
Definition: SourceData.cs:925
static ICell GetCell(int x, int y)
Definition: SourceData.cs:570
virtual void OnAfterImportData()
Definition: SourceData.cs:167
virtual bool ImportData(ISheet sheet, string bookname, bool overwrite=false)
Definition: SourceData.cs:834
override void ValidateLang()
Definition: SourceData.cs:482
static float[] GetFloatArray(int id)
Definition: SourceData.cs:905
static ISheet currentSheet
Definition: SourceData.cs:76
virtual void ValidateLang()
Definition: SourceData.cs:872
List< T > _backupRows
Definition: SourceData.cs:71
string nameSheet
Definition: SourceData.cs:773
virtual void RemoveDuplicateRows()
Definition: SourceData.cs:193
static int[] GetIntArray(int id)
Definition: SourceData.cs:910
Dictionary< string, T > alias
Definition: SourceData.cs:65
virtual void ExportTexts(string path, bool update=false)
Definition: SourceData.cs:864
virtual void ValidatePref()
Definition: SourceData.cs:860
override int ImportRows(IEnumerable< BaseRow > sourceRows)
Definition: SourceData.cs:176
virtual void RollbackSource()
Definition: SourceData.cs:848
override void ImportTexts(string _nameSheet=null)
Definition: SourceData.cs:490
virtual void RestorePref()
Definition: SourceData.cs:856
virtual T GetRow(string id)
Definition: SourceData.cs:316
override void Reset()
Definition: SourceData.cs:115
List< string > editorListString
Definition: SourceData.cs:74
static string LangSuffix
Definition: SourceData.cs:765
bool initialized
Definition: SourceData.cs:68
List< FieldInfo > GetFields()
Definition: SourceData.cs:256
List< string > GetListString()
Definition: SourceData.cs:239
SourceData< T, T2 > BuildEditorList()
Definition: SourceData.cs:244
bool isNew
Definition: SourceData.cs:771
virtual void BackupPref()
Definition: SourceData.cs:852
List< T > rows
Definition: SourceData.cs:61
virtual int ImportRows(IEnumerable< BaseRow > sourceRows)
Definition: SourceData.cs:839
static string dataPath
Definition: SourceData.cs:767
override void Init()
Definition: SourceData.cs:82
virtual void ImportTexts(string _nameSheet=null)
Definition: SourceData.cs:868
Dictionary< T2, T > map
Definition: SourceData.cs:63
virtual void Init()
Definition: SourceData.cs:825
virtual bool AllowHotInitialization
Definition: SourceData.cs:78
string GetText()
Definition: Version.cs:16