/// <summary>Loads the specified table.</summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public ITable <T> LoadTable <T>() where T : struct { if (Database != null) { ITable <T> table = Database.GetTable <T>(TableFlags.AllowCreate); this.LogInfo("Loaded {0} from {1}", table, Database); return(table); } IMemoryTable <T> memoryTable = new ConcurrentMemoryTable <T>(); string fullPath = FileSystem.Combine(DataBasePath, memoryTable.Name + ".dat"); lock (memoryTable) { memoryTable.Clear(); lock (m_Tables) { m_Tables[memoryTable] = 0; } if (File.Exists(fullPath)) { try { DatReader.ReadTable(memoryTable, fullPath); this.LogInfo("Loaded {0} from file.", memoryTable); lock (m_Tables) { m_Tables[memoryTable] = memoryTable.SequenceNumber; } } catch (Exception ex) { this.LogWarning(ex, "Could not load {0}.", memoryTable); } } } return(memoryTable); }