8 changed files with 43 additions and 42 deletions
@ -1,34 +1,28 @@ |
|||||||
using System; |
using System.Collections.Generic; |
||||||
using System.Linq; |
|
||||||
using Sirenix.Utilities; |
|
||||||
|
|
||||||
namespace Tools.ExcelResolver.Editor |
namespace Tools.ExcelResolver.Editor |
||||||
{ |
{ |
||||||
internal class ClassCodeData : IDisposable |
internal class ClassCodeData |
||||||
{ |
{ |
||||||
public readonly TableType tableType; |
public readonly TableType tableType; |
||||||
public readonly string className; |
public readonly string className; |
||||||
public readonly FieldData[] fields; |
public readonly Dictionary<int, FieldData> fields = new(); |
||||||
|
// public readonly FieldData[] fields; |
||||||
public readonly int[] keyIndex; |
public readonly int[] keyIndex; |
||||||
public readonly FieldData[] keyField; |
// public readonly FieldData[] keyField; |
||||||
|
|
||||||
public ClassCodeData(TableType tableType, string className, FieldData[] fields, int[] keyIndex) |
public ClassCodeData(TableType tableType, string className, Dictionary<int, FieldData> fields, int[] keyIndex) |
||||||
{ |
{ |
||||||
this.tableType = tableType; |
this.tableType = tableType; |
||||||
this.className = $"{char.ToUpper(className[0])}{className.Substring(1)}"; |
this.className = $"{char.ToUpper(className[0])}{className.Substring(1)}"; |
||||||
this.fields = fields; |
this.fields = fields; |
||||||
this.keyIndex = keyIndex; |
this.keyIndex = keyIndex; |
||||||
|
|
||||||
keyField = new FieldData[keyIndex.Length]; |
// keyField = new FieldData[keyIndex.Length]; |
||||||
for (int i = 0; i < keyIndex.Length; i++) |
// for (int i = 0; i < keyIndex.Length; i++) |
||||||
{ |
// { |
||||||
keyField[i] = fields.First(f => f.colIndex == keyIndex[i]); |
// keyField[i] = fields.First(f => f.colIndex == keyIndex[i]); |
||||||
} |
// } |
||||||
} |
|
||||||
|
|
||||||
public void Dispose() |
|
||||||
{ |
|
||||||
fields.ForEach(field => field.Dispose()); |
|
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
Loading…
Reference in new issue