mirror of
https://github.com/NexusForever/NexusForever
synced 2026-08-14 00:26:05 -04:00
* Feature implementations and performance improvements Game table speedup. Langauge file loading suppport Go teleport command (Requires language file, rename to lang.bin) Added resharper style file. Removed DI Leakage outside of ASP.NET Core. Web server startup returns IDisposable to prevent any temptation to leak it by making it more challenging to leak. WorldSessionCommandContext updated to send command output on System channel. Web socket command console implementation. The web page is crappy I know. Improved command constructor to use params string[] instead of having aliases first. Changed command logging to NLog, instead of ASP.NET Core abstractions. Added parallel loading of game tables. Added JSON cache to lang.bin. Added buffered stream to improve performance when loading game tables. Changed random implementation to use RNGCryptoService provider to generate cryptographically acceptable random data, instead of using the PRNG. * Style cleanup. * Build fix * Removed performace session trash VS added. * Style cleanup and small reworks to game tables.
30 lines
No EOL
982 B
C#
30 lines
No EOL
982 B
C#
using System;
|
|
using System.IO;
|
|
using Microsoft.Extensions.Configuration;
|
|
using NexusForever.Shared.Configuration;
|
|
|
|
namespace NexusForever.Shared.GameTable
|
|
{
|
|
public static class GameTableFactory
|
|
{
|
|
public static object LoadGameTable(Type type, string fileName)
|
|
{
|
|
string path = SharedConfiguration.Configuration.GetValue("GameTablePath", "tbl");
|
|
string filePath = Path.Combine(path, fileName);
|
|
|
|
Type table = typeof(GameTable<>).MakeGenericType(type);
|
|
return Activator.CreateInstance(table, filePath);
|
|
}
|
|
|
|
public static TextTable LoadTextTable(string fileName)
|
|
{
|
|
string path = SharedConfiguration.Configuration.GetValue("GameTablePath", "tbl");
|
|
string filePath = Path.Combine(path, fileName);
|
|
|
|
if (!File.Exists(filePath))
|
|
return null;
|
|
|
|
return FileCache.LoadWithCache(filePath, file => new TextTable(file));
|
|
}
|
|
}
|
|
} |