diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-07-23 16:22:32 +0100 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-07-23 16:22:32 +0100 |
| commit | 110089e0d7fcbc454dc55c0619ec4ccebc1a7e85 (patch) | |
| tree | 96f88795cdc73417b49abe1f77bce94b6731005b /TimeHACK.Engine | |
| parent | c3ad5be7444664be6a1f7ba023067eb32cb5d231 (diff) | |
| download | histacom2-110089e0d7fcbc454dc55c0619ec4ccebc1a7e85.tar.gz histacom2-110089e0d7fcbc454dc55c0619ec4ccebc1a7e85.tar.bz2 histacom2-110089e0d7fcbc454dc55c0619ec4ccebc1a7e85.zip | |
Realistic Desktop is finished!
Diffstat (limited to 'TimeHACK.Engine')
| -rw-r--r-- | TimeHACK.Engine/DesktopController.cs | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/TimeHACK.Engine/DesktopController.cs b/TimeHACK.Engine/DesktopController.cs index 6ccc4c1..a22df95 100644 --- a/TimeHACK.Engine/DesktopController.cs +++ b/TimeHACK.Engine/DesktopController.cs @@ -5,12 +5,34 @@ 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 @@ -18,14 +40,18 @@ namespace TimeHACK.Engine foreach (string dir in Directory.GetDirectories(theDirectory)) { - theView.Items.Add(Path.GetFileName(dir)); - theView.FindItemWithText(Path.GetFileName(dir)).ImageIndex = 1; + 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)) { - theView.Items.Add(Path.GetFileName(dir)); - theView.FindItemWithText(Path.GetFileName(dir)).ImageIndex = 12; + if (Path.GetFileName(dir) != "_data.info") + { + theView.Items.Add(Path.GetFileName(dir), 12); + theView.FindItemWithText(Path.GetFileName(dir)).Tag = dir; + } } } } |
