diff options
| author | Jason <[email protected]> | 2017-07-23 20:35:08 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-07-23 20:35:08 +0200 |
| commit | a852b2c7f2bb372a89e78e805298c33c00ebe924 (patch) | |
| tree | 946806e40f8c7c377cde81bcd79b525d2edd687f /TimeHACK.Engine | |
| parent | d42569b3e37e0a03835c7965d67cdf19e14ad4ba (diff) | |
| parent | eea369f5b5f8883b99a8371036cb09c3dd7ca774 (diff) | |
| download | histacom2-a852b2c7f2bb372a89e78e805298c33c00ebe924.tar.gz histacom2-a852b2c7f2bb372a89e78e805298c33c00ebe924.tar.bz2 histacom2-a852b2c7f2bb372a89e78e805298c33c00ebe924.zip | |
Merge pull request #136 from Alex-TIMEHACK/master
Realistic Desktop
Diffstat (limited to 'TimeHACK.Engine')
| -rw-r--r-- | TimeHACK.Engine/DesktopController.cs | 62 | ||||
| -rw-r--r-- | TimeHACK.Engine/SaveSystem.cs | 17 | ||||
| -rw-r--r-- | TimeHACK.Engine/TimeHACK.Engine.csproj | 1 |
3 files changed, 77 insertions, 3 deletions
diff --git a/TimeHACK.Engine/DesktopController.cs b/TimeHACK.Engine/DesktopController.cs new file mode 100644 index 0000000..f507ab8 --- /dev/null +++ b/TimeHACK.Engine/DesktopController.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.IO; +using Newtonsoft.Json; + +namespace TimeHACK.Engine +{ + public static class DesktopController + { + public static string ReadDataFile(string reqDirectory, bool returnYesIfProtected = false) + { + string Val = ""; + string directoryFileInfo; + directoryFileInfo = File.ReadAllText(Path.Combine(reqDirectory, "_data.info")); + FileSystemFolderInfo toRead = new FileSystemFolderInfo(); + toRead = JsonConvert.DeserializeObject<FileSystemFolderInfo>(directoryFileInfo); + + if (returnYesIfProtected == true) + { + if (toRead.Isprotected == true) + { + return "yes"; + } + } + else + { + return toRead.label; + } + return Val; + } + + public static void RefreshDesktopIcons(ListViewItem[] baseIcons, ref ListView theView, string theDirectory) + { + theView.Items.Clear(); // This resets it to it's default + theView.Items.AddRange(baseIcons); + + foreach (string dir in Directory.GetDirectories(theDirectory)) + { + string label = ReadDataFile(dir); + theView.Items.Add(label ?? Path.GetFileName(dir), 1); + theView.FindItemWithText(Path.GetFileName(dir)).Tag = dir; + } + + foreach (string dir in Directory.GetFiles(theDirectory)) + { + if (Path.GetFileName(dir) != "_data.info") + { + int appIcon = 12; + + if (new FileInfo(dir).Extension == ".exe") appIcon = 8; + + theView.Items.Add(Path.GetFileName(dir), appIcon); + theView.FindItemWithText(Path.GetFileName(dir)).Tag = dir; + } + } + } + } +} diff --git a/TimeHACK.Engine/SaveSystem.cs b/TimeHACK.Engine/SaveSystem.cs index cda4464..2745738 100644 --- a/TimeHACK.Engine/SaveSystem.cs +++ b/TimeHACK.Engine/SaveSystem.cs @@ -86,7 +86,7 @@ namespace TimeHACK.Engine { get { - return Path.Combine(ProfileMyComputerDirectory, "Settings"); + return Path.Combine(ProfileMyComputerDirectory, "Settings"); } } @@ -162,12 +162,18 @@ namespace TimeHACK.Engine SaveDirectoryInfo(ProfileFileSystemDirectory, false, "My Computer", false); SaveDirectoryInfo(ProfileMyComputerDirectory, false, "Win95 (C:)", true); if (CurrentSave.CurrentOS == "95" || CurrentSave.CurrentOS == "98") SaveDirectoryInfo(ProfileDocumentsDirectory, false, "My Documents", true); - if (CurrentSave.CurrentOS == "2000" || CurrentSave.CurrentOS == "ME") SaveDirectoryInfo(ProfileSettingsDirectory, false, "Documents and Settings", true); - SaveDirectoryInfo(Path.Combine(ProfileProgramsDirectory, "Accessories"), false, "Accessories", true); + if (CurrentSave.CurrentOS == "2000" || CurrentSave.CurrentOS == "ME") SaveDirectoryInfo(ProfileSettingsDirectory, false, "Documents and Settings", true); SaveDirectoryInfo(ProfileProgramsDirectory, true, "Program Files", true); + SaveDirectoryInfo(Path.Combine(ProfileProgramsDirectory, "Accessories"), false, "Accessories", true); + SaveDirectoryInfo(Path.Combine(ProfileProgramsDirectory, "Internet Explorer"), true, "Internet Explorer", true); + SaveDirectoryInfo(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"), true, "The Microsoft Network", true); SaveDirectoryInfo(ProfileWindowsDirectory, true, "Windows", true); CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Accessories", "wordpad.exe"), "wordpad"); + CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Internet Explorer", "ie20.exe"), "ie"); + CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Internet Explorer", "lnfinst.exe"), "iebrokeninstaller"); + CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network", "msnver.txt"), "5900"); + CreateWindowsDirectory(); } @@ -179,6 +185,7 @@ namespace TimeHACK.Engine SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Fonts"), true, "Fonts", true); SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Help"), true, "Help", true); SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Temp"), true, "Temp", true); + SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Desktop"), true, "Desktop", true); CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "calc.exe"), "calc"); CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "explorer.exe"), "explorer"); @@ -208,6 +215,10 @@ namespace TimeHACK.Engine SaveDirectoryInfo(Path.Combine(ProfileProgramsDirectory, "Outlook Express"), false, "Outlook Express", true); CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Outlook Express", "WAB.exe"), "addressbook"); + + // There is no "The Microsoft Network" folder! + + if (Directory.Exists(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"))) Directory.Delete(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"), true); } break; } diff --git a/TimeHACK.Engine/TimeHACK.Engine.csproj b/TimeHACK.Engine/TimeHACK.Engine.csproj index 2f4073d..dd6342c 100644 --- a/TimeHACK.Engine/TimeHACK.Engine.csproj +++ b/TimeHACK.Engine/TimeHACK.Engine.csproj @@ -48,6 +48,7 @@ <Compile Include="BSODCreator.cs" /> <None Include="packages.config" /> <None Include="Resources\WinClassic\Window\pjBg6mKP.bin" /> + <Compile Include="DesktopController.cs" /> <Compile Include="FileDialogBoxManager.cs" /> <Compile Include="Paintbrush.cs" /> <Compile Include="SaveSystem.cs" /> |
