mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* Change >> 1) & 1 to & 2 Cosmetic change pointed out by Rawaho. * Better fix of the Portal Flags in the dat code * ACE.DatLoader refactoring This new code format uses extention methods to re-use code. It allows decouples object unpacking from DatReader and reduces the dependancy to a simple BinaryReader. * Forgot to remove the temp StarterAreas code from the transition * Some files were ignored, not sure why. This should fix
57 lines
2 KiB
C#
57 lines
2 KiB
C#
using System.Linq;
|
|
using System.IO;
|
|
|
|
using ACE.Common;
|
|
|
|
using log4net;
|
|
|
|
namespace ACE.DatLoader
|
|
{
|
|
public static class DatManager
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
private static CellDatDatabase cellDat;
|
|
|
|
private static PortalDatDatabase portalDat;
|
|
|
|
private static string datFile;
|
|
|
|
private static int count;
|
|
|
|
public static CellDatDatabase CellDat => cellDat;
|
|
|
|
public static PortalDatDatabase PortalDat => portalDat;
|
|
|
|
public static void Initialize()
|
|
{
|
|
var datDir = Path.GetFullPath(Path.Combine(ConfigManager.Config.Server.DatFilesDirectory));
|
|
|
|
try
|
|
{
|
|
datFile = Path.Combine(datDir, "client_cell_1.dat");
|
|
cellDat = new CellDatDatabase(datFile);
|
|
count = cellDat.AllFiles.Count();
|
|
log.Info($"Successfully opened {datFile} file, containing {count} records");
|
|
}
|
|
catch (FileNotFoundException ex)
|
|
{
|
|
log.Info($"An exception occured while attempting to open {datFile} file! This needs to be corrected in order for Landblocks to load!");
|
|
log.Info($"Exception: {ex.Message}");
|
|
}
|
|
|
|
try
|
|
{
|
|
datFile = Path.Combine(datDir, "client_portal.dat");
|
|
portalDat = new PortalDatDatabase(datFile);
|
|
count = portalDat.AllFiles.Count();
|
|
log.Info($"Successfully opened {datFile} file, containing {count} records");
|
|
}
|
|
catch (FileNotFoundException ex)
|
|
{
|
|
log.Info($"An exception occured while attempting to open {datFile} file!\n\n *** Please check your 'DatFilesDirectory' setting in the config.json file. ***\n *** ACE will not run properly without this properly configured! ***\n");
|
|
log.Info($"Exception: {ex.Message}");
|
|
}
|
|
}
|
|
}
|
|
}
|