Skip to content

Commit b8a0720

Browse files
committed
Remove old ext. tool attributes and the code using them
it just detected old tools and displayed a specialised error message
1 parent db71506 commit b8a0720

File tree

3 files changed

+3
-39
lines changed

3 files changed

+3
-39
lines changed

src/BizHawk.Client.Common/Api/BizHawkExternalToolAttribute.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/BizHawk.Client.Common/Api/ExternalToolAttributes.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,7 @@ public ExternalToolAttribute(string name)
107107
Name = string.IsNullOrWhiteSpace(name) ? Guid.NewGuid().ToString() : name;
108108
}
109109

110-
public class MissingException : Exception
111-
{
112-
public readonly bool OldAttributeFound;
113-
114-
public MissingException(bool oldAttributeFound)
115-
{
116-
OldAttributeFound = oldAttributeFound;
117-
}
118-
}
110+
public class MissingException : Exception {}
119111
}
120112

121113
[AttributeUsage(AttributeTargets.Class)]

src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ private ToolStripMenuItem GenerateToolTipFromFileName(string fileName)
7474
var externalToolFile = Assembly.LoadFrom(fileName);
7575
var entryPoint = externalToolFile.GetTypes()
7676
.SingleOrDefault(t => typeof(IExternalToolForm).IsAssignableFrom(t) && t.GetCustomAttributes().OfType<ExternalToolAttribute>().Any());
77-
#pragma warning disable CS0618
78-
if (entryPoint == null) throw new ExternalToolAttribute.MissingException(externalToolFile.GetCustomAttributes().OfType<BizHawkExternalToolAttribute>().Any());
79-
#pragma warning restore CS0618
77+
if (entryPoint == null) throw new ExternalToolAttribute.MissingException();
8078

8179
var allAttrs = entryPoint.GetCustomAttributes().ToList();
8280
var applicabilityAttrs = allAttrs.OfType<ExternalToolApplicabilityAttributeBase>().ToList();
@@ -128,9 +126,7 @@ private ToolStripMenuItem GenerateToolTipFromFileName(string fileName)
128126
{
129127
BadImageFormatException => "This assembly can't be loaded, probably because it's corrupt or targets an incompatible .NET runtime.",
130128
ExternalToolApplicabilityAttributeBase.DuplicateException => "The IExternalToolForm has conflicting applicability attributes.",
131-
ExternalToolAttribute.MissingException e1 => e1.OldAttributeFound
132-
? "The assembly doesn't contain a class implementing IExternalToolForm and annotated with [ExternalTool].\nHowever, the assembly itself is annotated with [BizHawkExternalTool], which is now deprecated. Has the tool been updated since BizHawk 2.4?"
133-
: "The assembly doesn't contain a class implementing IExternalToolForm and annotated with [ExternalTool].",
129+
ExternalToolAttribute.MissingException => "The assembly doesn't contain a class implementing IExternalToolForm and annotated with [ExternalTool].",
134130
ReflectionTypeLoadException => "Something went wrong while trying to load the assembly.",
135131
_ => $"An exception of type {e.GetType().FullName} was thrown while trying to load the assembly and look for an IExternalToolForm:\n{e.Message}"
136132
};

0 commit comments

Comments
 (0)