diff options
Diffstat (limited to 'TimeHACK.Engine/FileDialogBoxManager.cs')
| -rw-r--r-- | TimeHACK.Engine/FileDialogBoxManager.cs | 24 |
1 files changed, 24 insertions, 0 deletions
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<FileSystemFolderInfo>(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 { } + } } } |
