From 414133b35d39b84537f4375e27e3e5f206655c5a Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Fri, 18 Aug 2017 14:56:56 +0100 Subject: Quite Big revamp on Explorer Part 1 --- TimeHACK.Engine/FileDialogBoxManager.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'TimeHACK.Engine/FileDialogBoxManager.cs') diff --git a/TimeHACK.Engine/FileDialogBoxManager.cs b/TimeHACK.Engine/FileDialogBoxManager.cs index f6d30ae..3bffe30 100644 --- a/TimeHACK.Engine/FileDialogBoxManager.cs +++ b/TimeHACK.Engine/FileDialogBoxManager.cs @@ -13,6 +13,7 @@ namespace TimeHACK.Engine public static bool IsInOpenDialog = false; public static bool IsInSaveDialog = false; public static string OnlyViewExtension = ""; + public static void ActivateOpenFileDialog(string ExtensionToView) { IsInOpenDialog = true; @@ -36,5 +37,28 @@ namespace TimeHACK.Engine return ""; } } + + public static void SaveTextFile(string path, string contents, int fileIcon) + { + try + { + File.WriteAllText(path, contents); + FileSystemFolderInfo theDir = Newtonsoft.Json.JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(Path.GetPathRoot(path), "_data.info"))); + + + + using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) + { + theDir.Files.Add(new THFileInfo() + { + Name = Path.GetFileName(path), + ByteSize = (int)fs.Length, + FileIcon = fileIcon + }); + } + + + } catch { } + } } } -- cgit v1.2.3