mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* Removed unused using statements
* Removed redudnant ToString()'s
* Removed some redundant type casts
* Removed redundant bool comparisons
* remove redundant initializers
* xml summary in invalid place switched to comments
* Use string interpolation
* use format separators
* Removed redundant parenths
* remove redundant else
* direct cast when safe
* redundant string interpolation
* xml summary fixes
* removed empty ctors
* fix modifier order
* Convert to auto property
* Convert some getters to method bodies
* use format separators
* changelog
* Auto-properties that can made to get-only
* fixed some references in XML comments
* remove redundant base()
* Revert "Auto-properties that can made to get-only"
This reverts commit 32a1225ce8.
* fix starter gear json
* Use collections count property
* simplify conditional ternary expression
* remove redundant return statements
* Constructors for abstract classes changed to protected
* Moved declarations to inner scopes
* Join declaration and assignments
* inline out variables
* Use enum extension methods instead of static methods
* inline out more variables
* more unused usings
* Remove specifying enums as ints
50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using System.IO;
|
|
|
|
using log4net;
|
|
|
|
namespace ACE.DatLoader
|
|
{
|
|
public static class DatManager
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
private static string datFile;
|
|
|
|
private static int count;
|
|
|
|
public static CellDatDatabase CellDat { get; private set; }
|
|
|
|
public static PortalDatDatabase PortalDat { get; private set; }
|
|
|
|
public static void Initialize(string datFileDirectory)
|
|
{
|
|
var datDir = Path.GetFullPath(Path.Combine(datFileDirectory));
|
|
|
|
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}");
|
|
}
|
|
}
|
|
}
|
|
}
|