mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* ACE.DatLoader DatDirectory reading cleaned up * ACE.DatLoader: Removed the pointless cached list in DatDirectory * MySql.Data upgraded from 6.10.4 to 6.10.6 This also fixes 3 build warnings regarding a security dll. * ACE.DatLoader: All data loaded data objects now reside in ACE.DatLoader, not ACE.Entity. * ACE.DatLoader performance improvements * ACE.DatLoader improvements * conflicts * conflicts * conflicts * conflicts
54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
using ACE.DatLoader.FileTypes;
|
|
|
|
namespace ACE.DatLoader
|
|
{
|
|
public class PortalDatDatabase : DatDatabase
|
|
{
|
|
public PortalDatDatabase(string filename) : base(filename)
|
|
{
|
|
}
|
|
|
|
|
|
public ContractTable ContractTable => ReadFromDat<ContractTable>(ContractTable.FILE_ID);
|
|
|
|
public CharGen CharGen => ReadFromDat<CharGen>(CharGen.FILE_ID);
|
|
|
|
public GeneratorTable GeneratorTable => ReadFromDat<GeneratorTable>(GeneratorTable.FILE_ID);
|
|
|
|
public RegionDesc RegionDesc => ReadFromDat<RegionDesc>(RegionDesc.FILE_ID);
|
|
|
|
public SpellComponentsTable SpellComponentsTable => ReadFromDat<SpellComponentsTable>(SpellComponentsTable.FILE_ID);
|
|
|
|
public SpellTable SpellTable => ReadFromDat<SpellTable>(SpellTable.FILE_ID);
|
|
|
|
public XpTable XpTable => ReadFromDat<XpTable>(XpTable.FILE_ID);
|
|
|
|
|
|
public void ExtractCategorizedContents(string path)
|
|
{
|
|
foreach (KeyValuePair<uint, DatFile> entry in AllFiles)
|
|
{
|
|
string thisFolder;
|
|
|
|
if (entry.Value.GetFileType(DatDatabaseType.Portal) != null)
|
|
thisFolder = Path.Combine(path, entry.Value.GetFileType(DatDatabaseType.Portal).ToString());
|
|
else
|
|
thisFolder = Path.Combine(path, "UnknownType");
|
|
|
|
if (!Directory.Exists(thisFolder))
|
|
Directory.CreateDirectory(thisFolder);
|
|
|
|
string hex = entry.Value.ObjectId.ToString("X8");
|
|
string thisFile = Path.Combine(thisFolder, hex + ".bin");
|
|
|
|
// Use the DatReader to get the file data
|
|
DatReader dr = GetReaderForFile(entry.Value.ObjectId);
|
|
|
|
File.WriteAllBytes(thisFile, dr.Buffer);
|
|
}
|
|
}
|
|
}
|
|
}
|