diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-08-18 20:41:45 +0100 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-08-18 20:41:45 +0100 |
| commit | 943b4dcb5fa597264f13f2d0cfa305f4dd542dbe (patch) | |
| tree | 3da3edb5249c5e338724859740838a7b4de7c652 | |
| parent | bd3612eadf3181856d5033d3e47b97357d88c345 (diff) | |
| download | histacom2-943b4dcb5fa597264f13f2d0cfa305f4dd542dbe.tar.gz histacom2-943b4dcb5fa597264f13f2d0cfa305f4dd542dbe.tar.bz2 histacom2-943b4dcb5fa597264f13f2d0cfa305f4dd542dbe.zip | |
Wordpad Save, Open and Save As
7 files changed, 165 insertions, 74 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); + } } } diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs b/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs index 3c9ac2f..f9382e3 100644 --- a/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs +++ b/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.cs @@ -85,10 +85,9 @@ namespace TimeHACK.OS.Win95.Win95Apps { try { - ActivateSaveFileDialog(".txt"); + ActivateOpenFileDialog(".txt"); string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); - MessageBox.Show(selectedPath); if (selectedPath != "") { mainText.Text = ReadTextFile(selectedPath); @@ -113,7 +112,6 @@ namespace TimeHACK.OS.Win95.Win95Apps } } - // TO LEMPAMO: THIS FUCTION IS A FUNCTION ON IT'S OWN BECUASE TWO THINGS CALL IT - OK? void SaveAs() { try @@ -125,7 +123,7 @@ namespace TimeHACK.OS.Win95.Win95Apps { SaveSystem.CreateWindowsFile(new FileInfo(selectedPath).Directory.FullName, selectedPath.Split('\\').Last(), mainText.Text, 12, mainText.Text.Length); CurrentFilePath = selectedPath; - } + } } catch { } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index acb491f..151dfd5 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -138,18 +138,18 @@ namespace TimeHACK.OS.Win95.Win95Apps { ListViewItem itm; - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (IsFileOpenDialog || IsFileSaveDialog) { if (!(Path.GetFileName(str) == "_data.info")) - { + { if (new FileInfo(str).Extension == onlyViewExtension) { itm = this.mainView.Items.Add(Path.GetFileName(str)); itm.Tag = str; } - else break; + else continue; } - else break; + else continue; } else { if (!(Path.GetFileName(str) == "_data.info")) @@ -157,7 +157,7 @@ namespace TimeHACK.OS.Win95.Win95Apps itm = this.mainView.Items.Add(Path.GetFileName(str)); itm.Tag = str; } - else break; + else continue; } FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info"))); foreach (var item in fsfi.Files) @@ -604,7 +604,7 @@ namespace TimeHACK.OS.Win95.Win95Apps { try { - if (new DirectoryInfo((string)mainView.FocusedItem.Tag).Extension == null || new DirectoryInfo((string)mainView.FocusedItem.Tag).Extension == "") + if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { // If it isn't a file if (mainView.FocusedItem.Text == "C:") GoToDir(Path.Combine(CurrentDirectory, "CDrive")); @@ -613,7 +613,7 @@ namespace TimeHACK.OS.Win95.Win95Apps } else { // If it is a file - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (IsFileOpenDialog || IsFileSaveDialog) { if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) { diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.Designer.cs index fab5fb9..85ad4b9 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.Designer.cs @@ -57,6 +57,7 @@ this.aboutWordpadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mainText = new System.Windows.Forms.RichTextBox(); this.pnlToolbar = new System.Windows.Forms.Panel(); + this.pictureBox5 = new System.Windows.Forms.PictureBox(); this.btnFind = new System.Windows.Forms.Button(); this.btnPrintPreview = new System.Windows.Forms.Button(); this.btnPrint = new System.Windows.Forms.Button(); @@ -78,16 +79,19 @@ this.lblStatus = new System.Windows.Forms.Label(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.pictureBox4 = new System.Windows.Forms.PictureBox(); - this.pictureBox5 = new System.Windows.Forms.PictureBox(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.topmenu.SuspendLayout(); this.pnlToolbar.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.pnlFormatBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.statusBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); this.SuspendLayout(); // // topmenu @@ -111,36 +115,40 @@ // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripMenuItem, + this.openToolStripMenuItem1, + this.saveToolStripMenuItem, + this.saveAsToolStripMenuItem, this.toolStripSeparator1, + this.openToolStripMenuItem, this.sendToolStripMenuItem, this.exitToolStripMenuItem}); - this.fileToolStripMenuItem.Font = new System.Drawing.Font("Contemporary", 9.75F); + this.fileToolStripMenuItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.fileToolStripMenuItem.Size = new System.Drawing.Size(33, 19); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 24); this.fileToolStripMenuItem.Text = "File"; // // newToolStripMenuItem // this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.Size = new System.Drawing.Size(108, 22); + this.newToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.newToolStripMenuItem.Text = "New"; // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(105, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // sendToolStripMenuItem // this.sendToolStripMenuItem.Name = "sendToolStripMenuItem"; - this.sendToolStripMenuItem.Size = new System.Drawing.Size(108, 22); + this.sendToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.sendToolStripMenuItem.Text = "Send..."; // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(108, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exitToolStripMenuItem.Text = "Exit"; // // editToolStripMenuItem @@ -156,53 +164,53 @@ this.selectAllToolStripMenuItem}); this.editToolStripMenuItem.Name = "editToolStripMenuItem"; this.editToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.editToolStripMenuItem.Size = new System.Drawing.Size(36, 19); + this.editToolStripMenuItem.Size = new System.Drawing.Size(32, 24); this.editToolStripMenuItem.Text = "Edit"; // // undoToolStripMenuItem // this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; - this.undoToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.undoToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.undoToolStripMenuItem.Text = "Undo"; // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(126, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(119, 6); // // cutToolStripMenuItem // this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; - this.cutToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.cutToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.cutToolStripMenuItem.Text = "Cut"; // // copyToolStripMenuItem // this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; - this.copyToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.copyToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.copyToolStripMenuItem.Text = "Copy"; // // pasteToolStripMenuItem // this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; - this.pasteToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.pasteToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.pasteToolStripMenuItem.Text = "Paste"; // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(126, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(119, 6); // // clearToolStripMenuItem // this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; - this.clearToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.clearToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.clearToolStripMenuItem.Text = "Clear"; // // selectAllToolStripMenuItem // this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; - this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(122, 22); this.selectAllToolStripMenuItem.Text = "Select All"; // // viewToolStripMenuItem @@ -213,7 +221,7 @@ this.statusBarToolStripMenuItem}); this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.viewToolStripMenuItem.Size = new System.Drawing.Size(40, 19); + this.viewToolStripMenuItem.Size = new System.Drawing.Size(37, 24); this.viewToolStripMenuItem.Text = "View"; // // toolbarToolStripMenuItem @@ -222,7 +230,7 @@ this.toolbarToolStripMenuItem.CheckOnClick = true; this.toolbarToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.toolbarToolStripMenuItem.Name = "toolbarToolStripMenuItem"; - this.toolbarToolStripMenuItem.Size = new System.Drawing.Size(143, 22); + this.toolbarToolStripMenuItem.Size = new System.Drawing.Size(132, 22); this.toolbarToolStripMenuItem.Text = "Toolbar"; // // formatBarToolStripMenuItem @@ -231,7 +239,7 @@ this.formatBarToolStripMenuItem.CheckOnClick = true; this.formatBarToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.formatBarToolStripMenuItem.Name = "formatBarToolStripMenuItem"; - this.formatBarToolStripMenuItem.Size = new System.Drawing.Size(143, 22); + this.formatBarToolStripMenuItem.Size = new System.Drawing.Size(132, 22); this.formatBarToolStripMenuItem.Text = "Format Bar"; // // statusBarToolStripMenuItem @@ -240,7 +248,7 @@ this.statusBarToolStripMenuItem.CheckOnClick = true; this.statusBarToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.statusBarToolStripMenuItem.Name = "statusBarToolStripMenuItem"; - this.statusBarToolStripMenuItem.Size = new System.Drawing.Size(143, 22); + this.statusBarToolStripMenuItem.Size = new System.Drawing.Size(132, 22); this.statusBarToolStripMenuItem.Text = "Status Bar"; // // insertToolStripMenuItem @@ -249,13 +257,13 @@ this.dateTimeToolStripMenuItem}); this.insertToolStripMenuItem.Name = "insertToolStripMenuItem"; this.insertToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.insertToolStripMenuItem.Size = new System.Drawing.Size(47, 19); + this.insertToolStripMenuItem.Size = new System.Drawing.Size(41, 24); this.insertToolStripMenuItem.Text = "Insert"; // // dateTimeToolStripMenuItem // this.dateTimeToolStripMenuItem.Name = "dateTimeToolStripMenuItem"; - this.dateTimeToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.dateTimeToolStripMenuItem.Size = new System.Drawing.Size(130, 22); this.dateTimeToolStripMenuItem.Text = "Date/Time"; // // formatToolStripMenuItem @@ -264,14 +272,14 @@ this.bulletStyleToolStripMenuItem}); this.formatToolStripMenuItem.Name = "formatToolStripMenuItem"; this.formatToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.formatToolStripMenuItem.Size = new System.Drawing.Size(57, 19); + this.formatToolStripMenuItem.Size = new System.Drawing.Size(50, 24); this.formatToolStripMenuItem.Text = "Format"; // // bulletStyleToolStripMenuItem // this.bulletStyleToolStripMenuItem.CheckOnClick = true; this.bulletStyleToolStripMenuItem.Name = "bulletStyleToolStripMenuItem"; - this.bulletStyleToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.bulletStyleToolStripMenuItem.Size = new System.Drawing.Size(131, 22); this.bulletStyleToolStripMenuItem.Text = "Bullet style"; // // helpToolStripMenuItem @@ -282,24 +290,24 @@ this.aboutWordpadToolStripMenuItem}); this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; this.helpToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.helpToolStripMenuItem.Size = new System.Drawing.Size(39, 19); + this.helpToolStripMenuItem.Size = new System.Drawing.Size(37, 24); this.helpToolStripMenuItem.Text = "Help"; // // helpTopicsToolStripMenuItem // this.helpTopicsToolStripMenuItem.Name = "helpTopicsToolStripMenuItem"; - this.helpTopicsToolStripMenuItem.Size = new System.Drawing.Size(169, 22); + this.helpTopicsToolStripMenuItem.Size = new System.Drawing.Size(159, 22); this.helpTopicsToolStripMenuItem.Text = "Help Topics"; // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(166, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(156, 6); // // aboutWordpadToolStripMenuItem // this.aboutWordpadToolStripMenuItem.Name = "aboutWordpadToolStripMenuItem"; - this.aboutWordpadToolStripMenuItem.Size = new System.Drawing.Size(169, 22); + this.aboutWordpadToolStripMenuItem.Size = new System.Drawing.Size(159, 22); this.aboutWordpadToolStripMenuItem.Text = "About Wordpad"; // // mainText @@ -331,6 +339,16 @@ this.pnlToolbar.Size = new System.Drawing.Size(593, 28); this.pnlToolbar.TabIndex = 2; // + // pictureBox5 + // + this.pictureBox5.BackgroundImage = global::TimeHACK.Properties.Resources.ie4_vsplitter; + this.pictureBox5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.pictureBox5.Location = new System.Drawing.Point(297, 0); + this.pictureBox5.Name = "pictureBox5"; + this.pictureBox5.Size = new System.Drawing.Size(2, 28); + this.pictureBox5.TabIndex = 7; + this.pictureBox5.TabStop = false; + // // btnFind // this.btnFind.BackgroundImage = global::TimeHACK.Properties.Resources.wordpad_find; @@ -595,15 +613,32 @@ this.pictureBox4.TabIndex = 6; this.pictureBox4.TabStop = false; // - // pictureBox5 + // saveToolStripMenuItem // - this.pictureBox5.BackgroundImage = global::TimeHACK.Properties.Resources.ie4_vsplitter; - this.pictureBox5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.pictureBox5.Location = new System.Drawing.Point(297, 0); - this.pictureBox5.Name = "pictureBox5"; - this.pictureBox5.Size = new System.Drawing.Size(2, 28); - this.pictureBox5.TabIndex = 7; - this.pictureBox5.TabStop = false; + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.saveToolStripMenuItem.Text = "Save..."; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.openToolStripMenuItem.Text = "Open..."; + // + // saveAsToolStripMenuItem + // + this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; + this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.saveAsToolStripMenuItem.Text = "Save As..."; + this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); + // + // openToolStripMenuItem1 + // + this.openToolStripMenuItem1.Name = "openToolStripMenuItem1"; + this.openToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); + this.openToolStripMenuItem1.Text = "Open..."; + this.openToolStripMenuItem1.Click += new System.EventHandler(this.openToolStripMenuItem1_Click); // // WinClassicWordPad // @@ -620,6 +655,7 @@ this.topmenu.ResumeLayout(false); this.topmenu.PerformLayout(); this.pnlToolbar.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.pnlFormatBar.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); @@ -627,7 +663,6 @@ this.statusBar.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -685,5 +720,9 @@ private System.Windows.Forms.Button btnPrintPreview; private System.Windows.Forms.Button btnFind; private System.Windows.Forms.PictureBox pictureBox5; + private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem1; } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs index 7d7956a..f8a927e 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs @@ -9,6 +9,8 @@ using System.Threading.Tasks; using System.Windows.Forms; using System.Drawing.Text; using TimeHACK.Engine; +using static TimeHACK.Engine.FileDialogBoxManager; +using System.IO; namespace TimeHACK.OS.Win95.Win95Apps { @@ -20,6 +22,8 @@ namespace TimeHACK.OS.Win95.Win95Apps bool doItalic = false; bool doUnderline = false; + string CurrentFilePath = ""; + public WinClassicWordPad() { InitializeComponent(); @@ -169,5 +173,65 @@ namespace TimeHACK.OS.Win95.Win95Apps if (doUnderline) Underline = FontStyle.Underline; mainText.SelectionFont = new Font(mainText.SelectionFont.FontFamily, mainText.SelectionFont.Size, Bold | Italic | Underline); } + + private void openToolStripMenuItem1_Click(object sender, EventArgs e) + { + try + { + ActivateOpenFileDialog(".rtf"); + string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + + if (selectedPath != null) + { + try + { + mainText.LoadFile(selectedPath); + } catch + { + (new WindowManager()).StartInfobox95("Wordpad", "An error occured opening the file.", Engine.Template.InfoboxType.Error, Engine.Template.InfoboxButtons.OK); + } + + } + } + catch + { + } + } + + private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveAs(); + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + if (CurrentFilePath == "") + { + // We aren't in a file right now + + SaveAs(); + } + else + { + File.Delete(CurrentFilePath); + SaveRtfDocument(mainText, CurrentFilePath); + } + } + + void SaveAs() + { + try + { + ActivateSaveFileDialog(".rtf"); + string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + + if (selectedPath != "") + { + SaveRtfDocument(mainText, selectedPath); + CurrentFilePath = selectedPath; + } + } + catch (Exception ex) { MessageBox.Show(ex.Message); } + } } }
\ No newline at end of file diff --git a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index d111fbe..04f0405 100644 --- a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -161,7 +161,7 @@ namespace TimeHACK.OS.Win95.Win95Apps { ListViewItem itm; - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (IsFileOpenDialog || IsFileSaveDialog) { if (!(Path.GetFileName(str) == "_data.info")) { @@ -637,7 +637,7 @@ namespace TimeHACK.OS.Win95.Win95Apps { try { - if (new DirectoryInfo((string)mainView.FocusedItem.Tag).Extension == null || new DirectoryInfo((string)mainView.FocusedItem.Tag).Extension == "") + if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { // If it isn't a file if (mainView.FocusedItem.Text == "C:") GoToDir(Path.Combine(CurrentDirectory, "CDrive")); diff --git a/TimeHACK.Main/SaveDialogs/SaveFileTroubleShooter.cs b/TimeHACK.Main/SaveDialogs/SaveFileTroubleShooter.cs index 410d2d6..4a593b0 100644 --- a/TimeHACK.Main/SaveDialogs/SaveFileTroubleShooter.cs +++ b/TimeHACK.Main/SaveDialogs/SaveFileTroubleShooter.cs @@ -16,7 +16,6 @@ namespace TimeHACK.SaveDialogs { public string log; Save savedata; - string json; public SaveFileTroubleShooter() { InitializeComponent(); |
