private void FixSoundReference_Playback(int originalIndex, IWriter buffer) { var playback = _container.FindSoundPlayback(originalIndex); int newIndex; if (!_soundPlaybacks.TryGetValue(playback, out newIndex)) { newIndex = _soundResources.Playbacks.FindIndex(c => c.Equals(playback.Source)); if (newIndex == -1) { newIndex = _soundResources.Playbacks.Count; _soundResources.Playbacks.Add(playback.Source); } _soundPlaybacks[playback] = newIndex; } buffer.SeekTo(_soundLayout.GetFieldOffset("playback index")); buffer.WriteInt16((short)newIndex); }