aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Engine/FileDialogBoxManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'TimeHACK.Engine/FileDialogBoxManager.cs')
-rw-r--r--TimeHACK.Engine/FileDialogBoxManager.cs35
1 files changed, 13 insertions, 22 deletions
diff --git a/TimeHACK.Engine/FileDialogBoxManager.cs b/TimeHACK.Engine/FileDialogBoxManager.cs
index 7ed4725..59533fa 100644
--- a/TimeHACK.Engine/FileDialogBoxManager.cs
+++ b/TimeHACK.Engine/FileDialogBoxManager.cs
@@ -38,27 +38,18 @@ namespace TimeHACK.Engine
}
}
- //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 { }
- //}
+ public static void SaveRtfDocument(RichTextBox tbox, string path)
+ {
+ int fileBytes = 0;
+ tbox.SaveFile(path);
+ fileBytes = File.ReadAllText(path).Length;
+
+ THFileInfo info = new THFileInfo();
+ info.Name = Path.GetFileName(path);
+ info.FileIcon = 17;
+ info.ByteSize = fileBytes;
+ SaveSystem.CurrentSave.BytesLeft -= fileBytes;
+ SaveSystem.UpdateDirectoryInfo(new FileInfo(path).Directory.FullName, info);
+ }
}
}