Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-05 07:05:16 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-05 07:05:16 +0300
commit01c8b9149f139648ed53fe175bbc955443c2ef01 (patch)
tree5e9ae2af9d2cf2602bbf4ca40ee2348f4af06d2a /Apps/AppTypeCollection.cs
parente0b2f51d15924c3353393072be25f8bb3d3e45d2 (diff)
Huge refactoring. Testing required. But need to sleep.
Diffstat (limited to 'Apps/AppTypeCollection.cs')
-rw-r--r--Apps/AppTypeCollection.cs36
1 files changed, 27 insertions, 9 deletions
diff --git a/Apps/AppTypeCollection.cs b/Apps/AppTypeCollection.cs
index 79061fa3..a43ee78e 100644
--- a/Apps/AppTypeCollection.cs
+++ b/Apps/AppTypeCollection.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
+using System.Text.RegularExpressions;
namespace com.clusterrr.hakchi_gui
{
@@ -24,25 +25,33 @@ namespace com.clusterrr.hakchi_gui
{
new AppInfo
{
- Class = typeof(FdsGame),
- Extensions = new string[] {".fds"},
- DefaultApps = new string[] {},
- Prefix = 'D',
- DefaultCover = Resources.blank_fds
+ Class = typeof(NesGame),
+ Extensions = new string[] {".nes"},
+ DefaultApps = new string[] {"/bin/clover-kachikachi-wr", "/bin/clover-kachikachi", "/bin/nes"},
+ Prefix = 'H',
+ DefaultCover = Resources.blank_nes
},
new AppInfo
{
Class = typeof(NesUGame),
- Extensions = new string[] {".nes", ".unf", ".unif"},
+ Extensions = new string[] {".unf", ".unif", ".nes", ".fds" },
DefaultApps = new string[] {"/bin/nes"},
Prefix = 'I',
DefaultCover = Resources.blank_jp
},
new AppInfo
{
+ Class = typeof(FdsGame),
+ Extensions = new string[] {".fds"},
+ DefaultApps = new string[] {"/bin/clover-kachikachi-wr", "/bin/clover-kachikachi", "/bin/nes"},
+ Prefix = 'D',
+ DefaultCover = Resources.blank_fds
+ },
+ new AppInfo
+ {
Class = typeof(SnesGame),
- Extensions = new string[] { ".sfc", ".smc" },
- DefaultApps = new string[] {"/bin/snes"},
+ Extensions = new string[] { ".sfc", ".smc", ".sfrom" },
+ DefaultApps = new string[] {"/usr/bin/clover-canoe-shvc", "/bin/snes"},
Prefix = 'U',
DefaultCover = Resources.blank_snes_us
},
@@ -146,10 +155,19 @@ namespace com.clusterrr.hakchi_gui
public static AppInfo GetAppByExec(string exec)
{
+ exec = Regex.Replace(exec, "['\\\"]|(\\.7z)", " ")+" ";
foreach (var app in ApplicationTypes)
foreach (var cmd in app.DefaultApps)
if (exec.StartsWith(cmd + " "))
- return app;
+ {
+ if (app.Extensions.Length == 0)
+ return app;
+ foreach (var ext in app.Extensions)
+ {
+ if (exec.Contains(ext + " "))
+ return app;
+ }
+ }
return null;
}
}