private void FixSoundReference_ExtraInfo(int originalIndex, IWriter buffer, IStream stream) { var extra = _container.FindSoundExtraInfo(originalIndex); int newIndex; if (!_soundExtraInfos.TryGetValue(extra, out newIndex)) { newIndex = _soundResources.ExtraInfos.Count; if (extra.Source.Datums != null) { for (int i = 0; i < extra.Source.Datums.Length; i++) { if (extra.Source.Datums[i] != DatumIndex.Null) { DatumIndex newRes = InjectResource(extra.Source.Datums[i], stream); extra.Source.Datums[i] = newRes; } } } _soundResources.ExtraInfos.Add(extra.Source); _soundExtraInfos[extra] = newIndex; } buffer.SeekTo(_soundLayout.GetFieldOffset("extra info index")); buffer.WriteInt16((short)newIndex); }