-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
64 lines (56 loc) · 2.84 KB
/
Program.cs
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
using Microsoft.Win32;
using ScriptNET.Runtime;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Forms;
using System.Security.Principal;
using System.IO;
namespace MapleShark
{
internal static class Program
{
public const bool CRACKCRYPTO = true;
[STAThread]
private static void Main(string[] pArgs)
{
RegisterFileAssociation(".msb", "MapleShark", "MapleShark Binary File", Assembly.GetExecutingAssembly().Location, string.Empty, 0);
//FileStream fs = new FileStream("Log.txt", FileMode.Create);
//StreamWriter sw = new StreamWriter(fs);
//Console.SetOut(sw);
RuntimeHost.Initialize();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm(pArgs));
}
internal static string AssemblyVersion { get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } }
internal static string AssemblyCopyright { get { return ((AssemblyCopyrightAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0]).Copyright; } }
private static void RegisterFileAssociation(string pExtension, string pProgramId, string pDescription, string pEXE, string pIconPath, int pIconIndex)
{
try
{
if (pExtension.Length != 0)
{
if (pExtension[0] != '.') pExtension = "." + pExtension;
using (RegistryKey key = Registry.ClassesRoot.OpenSubKey(pExtension)) if (key == null) using (RegistryKey extKey = Registry.ClassesRoot.CreateSubKey(pExtension)) extKey.SetValue(string.Empty, pProgramId);
using (RegistryKey extKey = Registry.ClassesRoot.OpenSubKey(pExtension))
{
using (RegistryKey key = extKey.OpenSubKey(pProgramId))
{
if (key == null)
{
using (RegistryKey progIdKey = Registry.ClassesRoot.CreateSubKey(pProgramId))
{
progIdKey.SetValue(string.Empty, pDescription);
using (RegistryKey defaultIcon = progIdKey.CreateSubKey("DefaultIcon")) defaultIcon.SetValue(string.Empty, String.Format("\"{0}\",{1}", pIconPath, pIconIndex));
using (RegistryKey command = progIdKey.CreateSubKey("shell\\open\\command")) command.SetValue(string.Empty, String.Format("\"{0}\" \"%1\"", pEXE));
}
}
}
}
}
}
catch (Exception) { }
}
}
}