forked from usb2snes/LiveSplit.USB2SNESSplitter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactory.cs
More file actions
42 lines (36 loc) · 1.43 KB
/
Factory.cs
File metadata and controls
42 lines (36 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Reflection;
using LiveSplit.Model;
using LiveSplit.UI.Components;
[assembly: ComponentFactory(typeof(Factory))]
namespace LiveSplit.UI.Components
{
public class Factory : IComponentFactory
{
public string ComponentName => "USB2SNES Auto Splitter";
public string Description => "Uses the SD2SNES USB2SNES firmware to monitor RAM for auto splitting.";
public ComponentCategory Category => ComponentCategory.Control;
public Version Version => Version.Parse("1.0.0");
public string UpdateName => ComponentName;
public string UpdateURL => "";
public string XMLURL => "";
public IComponent Create(LiveSplitState state) => new USB2SNESComponent(state);
static Factory()
{
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
string resourceName = "LiveSplit." + new AssemblyName(args.Name).Name + ".dll";
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
if (stream != null)
{
byte[] assemblyData = new byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
}
}
return null;
};
}
}
}