From e24709f8fb4c980dd7b01f7ba591613ca481908d Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sat, 23 Jan 2021 17:12:31 +1000 Subject: [PATCH] Remove redundant attr class VideoWriterIgnoreAttribute --- src/BizHawk.Client.EmuHawk/AVOut/AVSync.cs | 2 -- src/BizHawk.Client.EmuHawk/AVOut/IVideoWriter.cs | 14 +++++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/AVOut/AVSync.cs b/src/BizHawk.Client.EmuHawk/AVOut/AVSync.cs index 8e1cb12609..6aa7d7b58d 100644 --- a/src/BizHawk.Client.EmuHawk/AVOut/AVSync.cs +++ b/src/BizHawk.Client.EmuHawk/AVOut/AVSync.cs @@ -5,7 +5,6 @@ using BizHawk.Emulation.Common; namespace BizHawk.Client.EmuHawk { - [VideoWriterIgnore] public class AudioStretcher : AVStretcher { public AudioStretcher(IVideoWriter w) @@ -45,7 +44,6 @@ namespace BizHawk.Client.EmuHawk } } - [VideoWriterIgnore] public class VideoStretcher : AVStretcher { public VideoStretcher(IVideoWriter w) diff --git a/src/BizHawk.Client.EmuHawk/AVOut/IVideoWriter.cs b/src/BizHawk.Client.EmuHawk/AVOut/IVideoWriter.cs index 6059f80fbc..ba47b1e06a 100644 --- a/src/BizHawk.Client.EmuHawk/AVOut/IVideoWriter.cs +++ b/src/BizHawk.Client.EmuHawk/AVOut/IVideoWriter.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; -using System.Windows.Forms; +using System.Linq; + using BizHawk.Client.Common; using BizHawk.Emulation.Common; @@ -115,11 +116,6 @@ namespace BizHawk.Client.EmuHawk } } - [AttributeUsage(AttributeTargets.Class)] - public sealed class VideoWriterIgnoreAttribute : Attribute - { - } - public class VideoWriterInfo { public VideoWriterAttribute Attribs { get; } @@ -149,10 +145,10 @@ namespace BizHawk.Client.EmuHawk { if (!t.IsInterface && typeof(IVideoWriter).IsAssignableFrom(t) - && !t.IsAbstract - && t.GetCustomAttributes(typeof(VideoWriterIgnoreAttribute), false).Length == 0) + && !t.IsAbstract) { - var a = (VideoWriterAttribute)t.GetCustomAttributes(typeof(VideoWriterAttribute), false)[0]; + var a = t.GetCustomAttributes(typeof(VideoWriterAttribute), false).Cast().FirstOrDefault(); + if (a == null) continue; VideoWriters.Add(a.ShortName, new VideoWriterInfo(a, t)); } }