public virtual void BackUpSound() { if ((DlcUtils.InstalledDlcs & this.RequiredDlc) != this.RequiredDlc) { return; } try { var sound = this.GetSoundInstance(); this.OldSound = SoundPatchUtils.GetAudioInfo(sound); if (this.OldSound == null) { throw new SoundBackupException(string.Format("{0}.{1}", this.CategoryId, this.Id), "AudioInfo is null"); } } catch (Exception ex) { if (ex is SoundBackupException) { throw ex; } else { throw new SoundBackupException(string.Format("{0}.{1}", this.CategoryId, this.Id), ex); } } }
public virtual void BackUpVolume() { if ((DlcUtils.InstalledDlcs & this.RequiredDlc) != this.RequiredDlc) { return; } try { var sound = this.GetSoundInstance(); float?volume = SoundPatchUtils.GetVolume(sound); if (!volume.HasValue) { throw new SoundBackupException(string.Format("{0}.{1}", this.CategoryId, this.Id), "Sound has no volume set"); } this.OldVolume = volume.Value; } catch (Exception ex) { if (ex is SoundBackupException) { throw ex; } else { throw new SoundBackupException(string.Format("{0}.{1}", this.CategoryId, this.Id), ex); } } }
public virtual void PatchVolume(float volume) { if ((DlcUtils.InstalledDlcs & this.RequiredDlc) != this.RequiredDlc) { return; } try { var sound = this.GetSoundInstance(); if (!SoundPatchUtils.SetVolume(sound, volume)) { throw new SoundPatchException(string.Format("{0}.{1}"), "Failed to set volume"); } } catch (Exception ex) { if (ex is SoundPatchException) { throw ex; } else { throw new SoundPatchException(string.Format("{0}.{1}"), ex); } } }
public virtual void PatchSound(SoundPack.Migration.SoundPacksFileV1.Audio newSound) { if ((DlcUtils.InstalledDlcs & this.RequiredDlc) != this.RequiredDlc) { return; } try { var sound = this.GetSoundInstance(); if (!SoundPatchUtils.SetAudioInfo(sound, newSound)) { throw new SoundPatchException(string.Format("{0}.{1}"), "Failed to set AudioInfo"); } } catch (Exception ex) { if (ex is SoundPatchException) { throw ex; } else { throw new SoundPatchException(string.Format("{0}.{1}"), ex); } } }