diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-08-18 16:03:13 +0100 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-08-18 16:03:13 +0100 |
| commit | bd3612eadf3181856d5033d3e47b97357d88c345 (patch) | |
| tree | b137f4b624135588af1a55b6ff1d3e490e56ca39 | |
| parent | f56e9b6232f34dec7693a1cf8968e50136a096ff (diff) | |
| download | histacom2-bd3612eadf3181856d5033d3e47b97357d88c345.tar.gz histacom2-bd3612eadf3181856d5033d3e47b97357d88c345.tar.bz2 histacom2-bd3612eadf3181856d5033d3e47b97357d88c345.zip | |
Quite Big revamp on Explorer part 2
8 files changed, 61 insertions, 50 deletions
diff --git a/TimeHACK.Engine/FileDialogBoxManager.cs b/TimeHACK.Engine/FileDialogBoxManager.cs index 3bffe30..7ed4725 100644 --- a/TimeHACK.Engine/FileDialogBoxManager.cs +++ b/TimeHACK.Engine/FileDialogBoxManager.cs @@ -38,27 +38,27 @@ 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"))); + //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 - }); - } + // 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 { } - } + // } catch { } + //} } } diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.Designer.cs b/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.Designer.cs index bd614eb..cf1d570 100644 --- a/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.Designer.cs +++ b/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.Designer.cs @@ -1,4 +1,6 @@ -namespace TimeHACK.OS.Win95.Win95Apps +using System; + +namespace TimeHACK.OS.Win95.Win95Apps { partial class WinClassicNotepad { @@ -93,7 +95,7 @@ this.newToolStripMenuItem.BackgroundImage = global::TimeHACK.Properties.Resources.sliversilver; this.newToolStripMenuItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.newToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.newToolStripMenuItem.Text = "New"; // // openToolStripMenuItem @@ -102,7 +104,7 @@ this.openToolStripMenuItem.BackgroundImage = global::TimeHACK.Properties.Resources.sliversilver; this.openToolStripMenuItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.openToolStripMenuItem.Text = "Open..."; this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // @@ -112,7 +114,7 @@ this.saveToolStripMenuItem.BackgroundImage = global::TimeHACK.Properties.Resources.sliversilver; this.saveToolStripMenuItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.saveToolStripMenuItem.Text = "Save"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); // @@ -122,8 +124,9 @@ this.saveAsToolStripMenuItem.BackgroundImage = global::TimeHACK.Properties.Resources.sliversilver; this.saveAsToolStripMenuItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; - this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.saveAsToolStripMenuItem.Text = "Save As..."; + this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); // // pageSetupToolStripMenuItem // @@ -131,7 +134,7 @@ this.pageSetupToolStripMenuItem.BackgroundImage = global::TimeHACK.Properties.Resources.sliversilver; this.pageSetupToolStripMenuItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.pageSetupToolStripMenuItem.Name = "pageSetupToolStripMenuItem"; - this.pageSetupToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.pageSetupToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.pageSetupToolStripMenuItem.Text = "Page Setup..."; // // printToolStripMenuItem @@ -140,7 +143,7 @@ this.printToolStripMenuItem.BackgroundImage = global::TimeHACK.Properties.Resources.sliversilver; this.printToolStripMenuItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.printToolStripMenuItem.Name = "printToolStripMenuItem"; - this.printToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.printToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.printToolStripMenuItem.Text = "Print"; // // exitToolStripMenuItem @@ -149,7 +152,7 @@ this.exitToolStripMenuItem.BackgroundImage = global::TimeHACK.Properties.Resources.sliversilver; this.exitToolStripMenuItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -320,7 +323,7 @@ // mainText // this.mainText.Dock = System.Windows.Forms.DockStyle.Fill; - this.mainText.Font = new System.Drawing.Font("Courier", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.mainText.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.mainText.Location = new System.Drawing.Point(0, 24); this.mainText.MaxLength = 131072; this.mainText.Multiline = true; 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(); } } } diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.resx b/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.resx index 1af7de1..d5494e3 100644 --- a/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.resx +++ b/TimeHACK.Main/GlobalPrograms/WinClassicNotepad.resx @@ -117,4 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root>
\ No newline at end of file diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index ab7dd49..acb491f 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -65,12 +65,11 @@ namespace TimeHACK.OS.Win95.Win95Apps Properties.Resources.WinClassicFolder, Properties.Resources.WinClassicApp, // 10 Properties.Resources.WinClassicSetup, - Properties.Resources.WinClassicNotepad, + Properties.Resources.WinClassicTextFile, Properties.Resources.WinClassicCalcBig, Properties.Resources.WinClassicNotepadBig, Properties.Resources.WinClassicRegedit, // 15 Properties.Resources.WinClassicWordpad, - Properties.Resources.WinClassicTextFile, Properties.Resources.WinClassicRtfFile}); program.BringToFront(); diff --git a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index 425cff5..d111fbe 100644 --- a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -70,12 +70,11 @@ namespace TimeHACK.OS.Win95.Win95Apps Properties.Resources.WinClassicFolder, Properties.Resources.WinClassicApp, // 10 Properties.Resources.WinClassicSetup, - Properties.Resources.WinClassicNotepad, + Properties.Resources.WinClassicTextFile, Properties.Resources.WinClassicCalcBig, Properties.Resources.WinClassicNotepadBig, Properties.Resources.WinClassicRegedit, // 15 Properties.Resources.WinClassicWordpad, - Properties.Resources.WinClassicTextFile, Properties.Resources.WinClassicRtfFile}); program.BringToFront(); diff --git a/TimeHACK.Main/Properties/Resources.Designer.cs b/TimeHACK.Main/Properties/Resources.Designer.cs index 09a8c3b..1cc8733 100644 --- a/TimeHACK.Main/Properties/Resources.Designer.cs +++ b/TimeHACK.Main/Properties/Resources.Designer.cs @@ -1493,16 +1493,6 @@ namespace TimeHACK.Properties { /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> - internal static System.Drawing.Bitmap WinClassicNotepad { - get { - object obj = ResourceManager.GetObject("WinClassicNotepad", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> internal static System.Drawing.Bitmap WinClassicNotepadBig { get { object obj = ResourceManager.GetObject("WinClassicNotepadBig", resourceCulture); diff --git a/TimeHACK.Main/Properties/Resources.resx b/TimeHACK.Main/Properties/Resources.resx index 23c3c3f..3acdf99 100644 --- a/TimeHACK.Main/Properties/Resources.resx +++ b/TimeHACK.Main/Properties/Resources.resx @@ -615,9 +615,6 @@ <data name="WinClassicFind" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\resources\winclassic\winclassicfind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> - <data name="WinClassicNotepad" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\resources\winclassic\winclassicnotepad.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> - </data> <data name="WinClassicPaste" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\WinClassic\WinClassicPaste.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> |
