aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs
diff options
context:
space:
mode:
authorAlex-TIMEHACK <[email protected]>2017-08-18 16:03:13 +0100
committerAlex-TIMEHACK <[email protected]>2017-08-18 16:03:13 +0100
commitbd3612eadf3181856d5033d3e47b97357d88c345 (patch)
treeb137f4b624135588af1a55b6ff1d3e490e56ca39 /TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs
parentf56e9b6232f34dec7693a1cf8968e50136a096ff (diff)
downloadhistacom2-bd3612eadf3181856d5033d3e47b97357d88c345.tar.gz
histacom2-bd3612eadf3181856d5033d3e47b97357d88c345.tar.bz2
histacom2-bd3612eadf3181856d5033d3e47b97357d88c345.zip
Quite Big revamp on Explorer part 2
Diffstat (limited to 'TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs')
-rw-r--r--TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs34
1 files changed, 27 insertions, 7 deletions
diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs b/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs
index 8e3726d..3c9ac2f 100644
--- a/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs
+++ b/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs
@@ -15,6 +15,7 @@ namespace TimeHACK.OS.Win95.Win95Apps
{
public partial class WinClassicNotepad : UserControl
{
+ string CurrentFilePath = "";
public WinClassicNotepad()
{
InitializeComponent();
@@ -36,7 +37,7 @@ namespace TimeHACK.OS.Win95.Win95Apps
private void aboutNotepadToolStripMenuItem_Click(object sender, EventArgs e)
{
WindowManager wm = new WindowManager();
- wm.StartAboutBox95("Notepad", "Microsoft Notepad", Properties.Resources.WinClassicNotepad);
+ wm.StartAboutBox95("Notepad", "Microsoft Notepad", Properties.Resources.WinClassicNotepadBig);
}
private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e)
@@ -100,19 +101,38 @@ namespace TimeHACK.OS.Win95.Win95Apps
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
+ if (CurrentFilePath == "")
+ {
+ // We aren't in a file right now
+
+ SaveAs();
+ } else {
+
+ File.Delete(CurrentFilePath);
+ SaveSystem.CreateWindowsFile(new FileInfo(CurrentFilePath).Directory.FullName, CurrentFilePath.Split('\\').Last(), mainText.Text, 12, mainText.Text.Length);
+ }
+ }
+
+ // TO LEMPAMO: THIS FUCTION IS A FUNCTION ON IT'S OWN BECUASE TWO THINGS CALL IT - OK?
+ void SaveAs()
+ {
try
{
ActivateSaveFileDialog(".txt");
string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
- List<string> pathList = selectedPath.Split('\\').ToList();
- pathList.RemoveAt(selectedPath.Split('\\').Count() - 1);
if (selectedPath != "")
{
- SaveSystem.CreateWindowsFile(pathList.ToString(), selectedPath.Split('\\').Last(), mainText.Text, 12, mainText.Text.Length);
- }
- } catch {
- }
+ SaveSystem.CreateWindowsFile(new FileInfo(selectedPath).Directory.FullName, selectedPath.Split('\\').Last(), mainText.Text, 12, mainText.Text.Length);
+ CurrentFilePath = selectedPath;
+ }
+ }
+ catch { }
+ }
+
+ private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ SaveAs();
}
}
}