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

AppTypeCollection.cs « Apps - github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a405de3225161b031f1b54d8ef8e82594d055d2a (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
using com.clusterrr.hakchi_gui.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace com.clusterrr.hakchi_gui
{
    static class AppTypeCollection
    {
        //public delegate NesMiniApplication 

        public class AppInfo
        {
            public Type Class;
            public string[] Extensions;
            public string DefaultApp;
            public char Prefix;
            public Image DefaultCover;
        }

        public static AppInfo[] ApplicationTypes = new AppInfo[]
        {
            new AppInfo
            {
                Class = typeof(FdsGame),
                Extensions = new string[] {".fds"},
                DefaultApp = null,
                Prefix = 'D',
                DefaultCover = Resources.blank_fds
            },
            new AppInfo
            {
                Class = typeof(NesUGame),
                Extensions = new string[] {".nes", ".unf", ".unif"},
                DefaultApp = "/bin/nes",
                Prefix = 'I',
                DefaultCover = Resources.blank_jp
            },
            new AppInfo
            {
                Class = typeof(SnesGame),
                Extensions = new string[] { ".sfc", ".smc" },
                DefaultApp = "/bin/snes",
                Prefix = 'U',
                DefaultCover = Resources.blank_snes_us
            },
            new AppInfo
            {
                Class = typeof(N64Game),
                Extensions = new string[] { ".n64", ".z64", ".v64" },
                DefaultApp = "/bin/n64",
                Prefix = '6',
                DefaultCover = Resources.blank_n64
            },
            new AppInfo
            {
                Class = typeof(SmsGame),
                Extensions = new string[] { ".sms" },
                DefaultApp = "/bin/sms",
                Prefix = 'M',
                DefaultCover = Resources.blank_sms
            },
            new AppInfo
            {
                Class = typeof(SmsGame),
                Extensions = new string[] { ".sms" },
                DefaultApp = "/bin/sms",
                Prefix = 'M',
                DefaultCover = Resources.blank_sms
            },
                        new AppInfo
            {
                Class = typeof(GenesisGame),
                Extensions = new string[] { ".gen", ".md", ".smd" },
                DefaultApp = "/bin/md",
                Prefix = 'G',
                DefaultCover = Resources.blank_genesis
            },
                        new AppInfo
            {
                Class = typeof(GbGame),
                Extensions = new string[] { ".gb" },
                DefaultApp = "/bin/gb",
                Prefix = 'B',
                DefaultCover = Resources.blank_gb
            },
            new AppInfo
            {
                Class = typeof(GbcGame),
                Extensions = new string[] {".gbc"},
                DefaultApp = "/bin/gbc",
                Prefix = 'C',
                DefaultCover = Resources.blank_gbc
            },
            new AppInfo
            {
                Class = typeof(GbaGame),
                Extensions = new string[] {".gba"},
                DefaultApp = "/bin/gba",
                Prefix = 'A',
                DefaultCover = Resources.blank_gba
            },
            new AppInfo
            {
                Class = typeof(PceGame),
                Extensions = new string[] {".pce"},
                DefaultApp = "/bin/pce",
                Prefix = 'E',
                DefaultCover = Resources.blank_pce
            },
            new AppInfo
            {
                Class = typeof(GameGearGame),
                Extensions = new string[] {".gg"},
                DefaultApp = "/bin/gg",
                Prefix = 'R',
                DefaultCover = Resources.blank_app // TODO: icon for GameGear
            }
        };

        public static AppInfo GetAppByExtension(string extension)
        {
            foreach (var app in ApplicationTypes)
                if (Array.IndexOf(app.Extensions, extension) >= 0)
                    return app;
            return null;
        }

        public static AppInfo GetAppByExec(string exec)
        {
            foreach (var app in ApplicationTypes)
                if (exec.StartsWith(app.DefaultApp + " "))
                    return app;
            return null;
        }
    }
}