2 using System.ComponentModel.Composition;
4 using System.Reflection;
5 using HyperpinPluginInterface;
11 namespace DirectOutputHyperpinPlugin
17 [Export(typeof(IHyperpinPlugin))]
26 #region IHyperpinPlugin Members
39 Version V = typeof(
Pinball).Assembly.GetName().Version;
40 DateTime BuildDate =
new DateTime(2000, 1, 1).AddDays(V.Build).AddSeconds(V.Revision * 2);
41 return "DirectOutput (V: {0} as of {1})".Build(V.ToString(), BuildDate.ToString(
"yyyy.MM.dd HH:mm"));
88 FileInfo F =
new FileInfo(Path.Combine(
new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName,
"config",
"GlobalConfig_Hyperpin.xml"));
92 FileInfo LnkFile =
new FileInfo(Path.Combine(
new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName,
"config",
"GlobalConfig_Hyperpin.lnk"));
95 string ConfigDirPath = ResolveShortcut(LnkFile);
96 if (Directory.Exists(ConfigDirPath))
98 F =
new FileInfo(Path.Combine(ConfigDirPath,
"GlobalConfig_Hyperpin.xml"));
104 Pinball.
Init(F.FullName, Path.Combine(
new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName,
"config",
"Hyperpin.tmp"),
"Hyperpin");
109 private string ResolveShortcut(FileInfo ShortcutFile)
111 string TargetPath =
"";
114 Type WScriptShell = Type.GetTypeFromProgID(
"WScript.Shell");
115 object Shell = Activator.CreateInstance(WScriptShell);
116 object Shortcut = WScriptShell.InvokeMember(
"CreateShortcut", BindingFlags.InvokeMethod, null, Shell,
new object[] { ShortcutFile.FullName });
117 TargetPath = (string)Shortcut.GetType().InvokeMember(
"TargetPath", BindingFlags.GetProperty, null, Shortcut, null);
128 if (Directory.Exists(TargetPath))
132 else if (File.Exists(TargetPath))
164 get {
return _Pinball; }
165 set { _Pinball = value; }