internal static void InitializeGenerator(string inputFolder) { if (_initialized) { throw new InvalidOperationException("Already initialized."); } if (!ObjectApiGenerator.IsInitialized) { throw new InvalidOperationException("Must initialize ObjectApiGenerator first."); } _dataTables = new[] { new TableModel(Path.Combine(inputFolder, PathConstants.UnitAbilityDataPath), DataConstants.UnitAbilityDataKeyColumn, DataConstants.CommentOrCommentsColumn), new TableModel(Path.Combine(inputFolder, PathConstants.UnitBalanceDataPath), DataConstants.UnitBalanceDataKeyColumn, DataConstants.CommentOrCommentsColumn), new TableModel(Path.Combine(inputFolder, PathConstants.UnitDataPath), DataConstants.UnitDataKeyColumn, DataConstants.CommentOrCommentsColumn), new TableModel(Path.Combine(inputFolder, PathConstants.UnitUiDataPath), DataConstants.UnitUiDataKeyColumn, DataConstants.UnitDataNameColumn), new TableModel(Path.Combine(inputFolder, PathConstants.UnitWeaponDataPath), DataConstants.UnitWeaponDataKeyColumn, DataConstants.CommentOrCommentsColumn), } .ToDictionary(table => table.TableName, StringComparer.OrdinalIgnoreCase); _metadataTable = new TableModel(Path.Combine(inputFolder, PathConstants.UnitMetaDataPath)); ObjectApiGenerator.Localize(_metadataTable.Table); _enumModel = new EnumModel(DataConstants.UnitTypeEnumName); var members = new Dictionary <string, string>(StringComparer.Ordinal); _dataTables["unitui"].AddValues(members); _dataTables["unitdata"].AddValues(members); _dataTables["unitabilities"].AddValues(members); _dataTables["unitbalance"].AddValues(members); _dataTables["unitweapons"].AddValues(members); foreach (var member in members) { _enumModel.Members.Add(ObjectApiGenerator.CreateEnumMemberModel(member.Value, member.Key)); } _enumModel.EnsureMemberNamesUnique(); _initialized = true; }
internal static void InitializeGenerator(string inputFolder) { if (_initialized) { throw new InvalidOperationException("Already initialized."); } if (!ObjectApiGenerator.IsInitialized) { throw new InvalidOperationException("Must initialize ObjectApiGenerator first."); } _dataTables = new[] { new TableModel(Path.Combine(inputFolder, PathConstants.DoodadDataPath), DataConstants.DoodadDataKeyColumn, DataConstants.CommentColumn, "DoodadData"), } .ToDictionary(table => table.TableName, StringComparer.OrdinalIgnoreCase); _metadataTable = new TableModel(Path.Combine(inputFolder, PathConstants.DoodadMetaDataPath)); ObjectApiGenerator.Localize(_metadataTable.Table); _enumModel = new EnumModel(DataConstants.DoodadTypeEnumName); var members = new Dictionary <string, string>(StringComparer.Ordinal); foreach (var dataTable in _dataTables.Values) { dataTable.AddValues(members); } foreach (var member in members) { _enumModel.Members.Add(ObjectApiGenerator.CreateEnumMemberModel(member.Value, member.Key)); } _enumModel.EnsureMemberNamesUnique(); _initialized = true; }