private void FixSoundReference_Promotion(int originalIndex, IWriter buffer) { var promo = _container.FindSoundPromotion(originalIndex); int newIndex; if (!_soundPromotions.TryGetValue(promo, out newIndex)) { newIndex = _soundResources.Promotions.FindIndex(c => c.Equals(promo.Source)); if (newIndex == -1) { newIndex = _soundResources.Promotions.Count; _soundResources.Promotions.Add(promo.Source); } _soundPromotions[promo] = newIndex; } buffer.SeekTo(_soundLayout.GetFieldOffset("promotion index")); buffer.WriteSByte((sbyte)newIndex); }