internal DbcStringReference(DbcTable owner, int position) { if (owner == null) { throw new ArgumentNullException("owner"); } if (position < 0) { throw new ArgumentException("position"); } pointer = new WeakReference <DbcTable>(owner); pos = position; val = new Lazy <string>(() => { DbcTable table; if (!pointer.TryGetTarget(out table)) { throw new ObjectDisposedException("DbcTable"); } return(table.GetString(pos)); }); }
public void SetValue <TTarget>(TTarget target, int inputVal, DbcTable table) where TTarget : class { switch (Type) { case TargetType.Int32: SetValue(target, inputVal); break; case TargetType.Float32: byte[] bits = BitConverter.GetBytes(inputVal); SetValue(target, BitConverter.ToSingle(bits, 0)); break; case TargetType.String: string tmp = table.GetString(inputVal); SetValue(target, tmp); break; case TargetType.StringReference: DbcStringReference sref = new DbcStringReference(table, inputVal); SetValue(target, sref); break; } }
public static void LoadFiles() { string dbc_path = Properties.Settings.Default.DBC_Path; Map = LoadFile($"{dbc_path}Map.dbc"); Spell = LoadFile($"{dbc_path}Spell.dbc"); Area = LoadFile($"{dbc_path}AreaTable.dbc"); Family = LoadFile($"{dbc_path}CreatureFamily.dbc"); Faction = LoadFile($"{dbc_path}Faction.dbc"); Emote = LoadFile($"{dbc_path}Emotes.dbc"); TotemCategory = LoadFile($"{dbc_path}TotemCategory.dbc"); Language = LoadFile($"{dbc_path}Languages.dbc"); PageMaterial = LoadFile($"{dbc_path}PageTextMaterial.dbc"); Holiday = LoadFile($"{dbc_path}Holidays.dbc"); HolidayNames = LoadFile($"{dbc_path}HolidayNames.dbc"); SkillLine = LoadFile($"{dbc_path}SkillLine.dbc"); }
internal DbcRecord(int position, int startIndex, DbcTable owner) { pos = position; index = startIndex; pointer = new WeakReference <DbcTable>(owner); }