using System.ComponentModel; using System.Linq; namespace JD.Serialization { public partial class SoundSetClip { private SoundComponent_Template _soundSet; private string _loadedSoundSet; [Category("SoundSet")] [Description("The actor to use to localize the sound")] [ReadOnly(true)] [Browsable(true)] public SoundComponent_Template SoundSet { get { if (_soundSet == null && SoundSetPath?.getAbsolute() != null && SoundSetPath.getAbsolute() != _loadedSoundSet) { try { var actor = (Actor_Template)new LuaSerializer().LoadObjectFromFile(SoundSetPath.getAbsolute()); _soundSet = actor.COMPONENTS.OfType().FirstOrDefault(); _loadedSoundSet = SoundSetPath.getAbsolute(); } catch { // Ignore any loading failures (missing file, invalid lua, ...). } } return _soundSet; } } } }