aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Engine
diff options
context:
space:
mode:
authorAlex-TIMEHACK <[email protected]>2017-07-21 18:10:05 +0100
committerAlex-TIMEHACK <[email protected]>2017-07-21 18:10:05 +0100
commit10dce4105839265a835ecd99b656616a2335e314 (patch)
treea696d830d487f930ca2b400742902203167fa5f3 /TimeHACK.Engine
parent55e49fdaad9835c489d687736b3de0857d9c7a34 (diff)
downloadhistacom2-10dce4105839265a835ecd99b656616a2335e314.tar.gz
histacom2-10dce4105839265a835ecd99b656616a2335e314.tar.bz2
histacom2-10dce4105839265a835ecd99b656616a2335e314.zip
Made the File Explorer open EXE files
Not real ones though
Diffstat (limited to 'TimeHACK.Engine')
-rw-r--r--TimeHACK.Engine/FileAssociation.cs50
-rw-r--r--TimeHACK.Engine/SaveSystem.cs8
-rw-r--r--TimeHACK.Engine/TimeHACK.Engine.csproj1
3 files changed, 3 insertions, 56 deletions
diff --git a/TimeHACK.Engine/FileAssociation.cs b/TimeHACK.Engine/FileAssociation.cs
deleted file mode 100644
index 25fe895..0000000
--- a/TimeHACK.Engine/FileAssociation.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Runtime.InteropServices;
-using Microsoft.Win32;
-
-namespace TimeHACK.Engine
-{
- public class FileAssociation
- {
- // Associate file extension with progID, description, icon and application
- public static void Associate(string extension,
- string progID, string description, string icon, string application)
- {
- Registry.ClassesRoot.CreateSubKey(extension).SetValue("", progID);
- if (progID != null && progID.Length > 0)
- using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(progID))
- {
- if (description != null)
- key.SetValue("", description);
- if (icon != null)
- key.CreateSubKey("DefaultIcon").SetValue("", ToShortPathName(icon));
- if (application != null)
- key.CreateSubKey(@"Shell\Open\Command").SetValue("",
- ToShortPathName(application) + " \"%1\"");
- }
- }
-
- // Return true if extension already associated in registry
- public static bool IsAssociated(string extension)
- {
- return (Registry.ClassesRoot.OpenSubKey(extension, false) != null);
- }
-
- [DllImport("Kernel32.dll")]
- private static extern uint GetShortPathName(string lpszLongPath,
- [Out] StringBuilder lpszShortPath, uint cchBuffer);
-
- // Return short path format of a file name
- private static string ToShortPathName(string longName)
- {
- StringBuilder s = new StringBuilder(1000);
- uint iSize = (uint)s.Capacity;
- uint iRet = GetShortPathName(longName, s, iSize);
- return s.ToString();
- }
- }
-}
diff --git a/TimeHACK.Engine/SaveSystem.cs b/TimeHACK.Engine/SaveSystem.cs
index cd8bb2f..6450fcb 100644
--- a/TimeHACK.Engine/SaveSystem.cs
+++ b/TimeHACK.Engine/SaveSystem.cs
@@ -15,8 +15,6 @@ namespace TimeHACK.Engine
public static FileSystemFolderInfo filesystemflinfo { get; set; }
public static bool DevMode = false;
- public static FileAssociation IconChanger = new FileAssociation();
-
public static Theme currentTheme { get; set; }
public static string GameDirectory
@@ -161,7 +159,7 @@ namespace TimeHACK.Engine
Directory.CreateDirectory(ProfileFileSystemDirectory);
SaveDirectoryInfo(ProfileFileSystemDirectory, false, "My Computer", false);
- SaveDirectoryInfo(ProfileMyComputerDirectory, false, "Win95", true);
+ SaveDirectoryInfo(ProfileMyComputerDirectory, false, "Win95 (C:)", true);
if (CurrentSave.CurrentOS == "95") SaveDirectoryInfo(ProfileDocumentsDirectory, false, "My Documents", true);
if (CurrentSave.CurrentOS != "95") SaveDirectoryInfo(ProfileSettingsDirectory, false, "Documents and Settings", true);
SaveDirectoryInfo(ProfileProgramsDirectory, true, "Program Files", true);
@@ -179,8 +177,8 @@ namespace TimeHACK.Engine
SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Help"), true, "Help", true);
SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Temp"), true, "Temp", true);
- CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "calc.exe"), "Calculator");
- CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "explorer.exe"), "windowsexplorer");
+ CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "calc.exe"), "calc");
+ CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "explorer.exe"), "explorer");
}
public static void CreateWindowsFile(string filepath, string contents)
diff --git a/TimeHACK.Engine/TimeHACK.Engine.csproj b/TimeHACK.Engine/TimeHACK.Engine.csproj
index 64867d5..a2352c2 100644
--- a/TimeHACK.Engine/TimeHACK.Engine.csproj
+++ b/TimeHACK.Engine/TimeHACK.Engine.csproj
@@ -48,7 +48,6 @@
<Compile Include="BSODCreator.cs" />
<None Include="packages.config" />
<None Include="Resources\WinClassic\Window\pjBg6mKP.bin" />
- <Compile Include="FileAssociation.cs" />
<Compile Include="FileDialogBoxManager.cs" />
<Compile Include="Paintbrush.cs" />
<Compile Include="SaveSystem.cs" />