/// <summary> /// Lazy initialization of handle fields. They are initialized on the first access. /// because the mpq storage may not have finished loading and thus, the referenced sno may not be found /// </summary> private void Initialize() { // Look up the group if it is not set. Maybe one big // asset dictionary would be more convenient here _isInitialized = true; if (!_group.HasValue) { foreach (var pair in MPQStorage.Data.Assets) { if (pair.Value.ContainsKey(Id)) { _group = pair.Key; break; } } } if (_group.HasValue) { if (MPQStorage.Data != null && MPQStorage.Data.Assets.ContainsKey(_group.Value)) { if (MPQStorage.Data.Assets[_group.Value].ContainsKey(Id)) { _isValid = true; _target = MPQStorage.Data.Assets[_group.Value][Id].Data; _name = MPQStorage.Data.Assets[_group.Value][Id].Name; } } } }
public SNOHandle(int snoId) { Id = snoId; if (snoId == NO_ID) { _group = SNOGroup.None; } }
/// <summary> /// Parses SNOName from given GameBitBuffer. /// </summary> /// <param name="buffer">The GameBitBuffer to parse from.</param> public void Parse(GameBitBuffer buffer) { _group = (SNOGroup)buffer.ReadInt(32); Id = buffer.ReadInt(32); }
/// <summary> /// Reads SNOName from given MPQFileStream. /// </summary> /// <param name="stream">The MPQFileStream to read from.</param> public SNOHandle(MpqFileStream stream) { _group = (SNOGroup)stream.ReadValueS32(); Id = stream.ReadValueS32(); }
public SNOHandle(SNOGroup group, int id) { _group = group; Id = id; }
/// <summary> /// Lazy initialization of handle fields. They are initialized on the first access. /// because the mpq storage may not have finished loading and thus, the referenced sno may not be found /// </summary> private void Initialize() { // Look up the group if it is not set. Maybe one big // asset dictionary would be more convenient here _isInitialized = true; if (!_group.HasValue) { foreach (var pair in MPQStorage.Data.Assets) if (pair.Value.ContainsKey(Id)) { _group = pair.Key; break; } } if (_group.HasValue) if (MPQStorage.Data != null && MPQStorage.Data.Assets.ContainsKey(_group.Value)) if (MPQStorage.Data.Assets[_group.Value].ContainsKey(Id)) { _isValid = true; _target = MPQStorage.Data.Assets[_group.Value][Id].Data; _name = MPQStorage.Data.Assets[_group.Value][Id].Name; } }
public SNOHandle(int snoId) { Id = snoId; if (snoId == NO_ID) _group = SNOGroup.None; }