public TableUpdateViewer(uint updateID) { InitializeComponent(); string filePath = System.IO.Path.Combine(AppPaths.DataUpdateFolder, updateID.ToString("X")); IEnumerable <TableUpdate> updates = UpdateEngin.LoadTablesUpdate(filePath, AppContext.DatumFactory); m_lbTables.Items.AddRange(updates.Select(update => new ListBoxData(update)).ToArray()); if (m_lbTables.Items.Count > 0) { m_lbTables.SelectedIndex = 0; } }
static void ApplyUpdate(string updateFile) { IEnumerable <TableUpdate> updates = UpdateEngin.LoadTablesUpdate(updateFile, Program.TablesManager.DataFactory); foreach (TableUpdate update in updates) { IDBTable table = Program.TablesManager.Tables[update.TableID]; //TODO: traiter le cas ou une version de table est manquante ex: 1,2 ,4 if (table.Version != update.PreGeneration) { continue; } using (new AutoReleaser(() => EndTableUpdate?.Invoke(table.ID))) { BeginTableUpdate?.Invoke(table.ID); if (update.DatumMaxSize > table.DatumSize) { Program.TablesManager.ResizeTable(table.ID, update.DatumMaxSize); } using (var ndxer = new DBKeyIndexer(Program.TablesManager, update.TableID)) { ndxer.Connect(); foreach (IUpdateAction action in update.Actions) { ApplyAction(action, ndxer); } } table.Version = update.PostGeneration; } } }