diff options
| author | AShifter <[email protected]> | 2017-08-29 12:34:00 -0600 |
|---|---|---|
| committer | AShifter <[email protected]> | 2017-08-29 12:34:00 -0600 |
| commit | b1689dea36e46933280bfcc0d186746dd6210c0f (patch) | |
| tree | 3644ac63218378082e0afa90d4c42d73d6d3980c | |
| parent | f8e657ddbaf3654f102676a0b51e424c005218c3 (diff) | |
| parent | d4d94f85a6424e4d21cecccec21b0e78860431d6 (diff) | |
| download | histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.tar.gz histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.tar.bz2 histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.zip | |
Merge remote-tracking branch 'refs/remotes/Histacom2-Devs/master'
36 files changed, 1268 insertions, 549 deletions
@@ -416,34 +416,34 @@ __pycache__/ # End of https://www.gitignore.io/api/macos,linux,windows,jetbrains,visualstudio,visualstudiocode -### TimeHack Extra ### -TimeHACK.Main\bin\Debug -TimeHACK.Main\bin\Release -TimeHACK.Main\obj\Debug\* -TimeHACK.Main\obj\Release\* -TimeHACK.Engine\bin\Debug -TimeHACK.Engine\bin\Release -TimeHACK.Engine\obj\Debug\* -TimeHACK.Engine\obj\Release\* +### Histacom Extra ### +Histacom2\bin\Debug +Histacom2\bin\Release +Histacom2\obj\Debug\* +Histacom2\obj\Release\* +Histacom2.Engine\bin\Debug +Histacom2.Engine\bin\Release +Histacom2.Engine\obj\Debug\* +Histacom2.Engine\obj\Release\* # The below files keep the Resources working -!TimeHACK.Main\obj\Debug\TempPE -!TimeHACK.Main\obj\Debug\DesignTimeResolveAssemblyReferences.cache -!TimeHACK.Main\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache -!TimeHACK.Main\obj\Debug\CoreCompileInputs.cache -!TimeHACK.Main\obj\Release\TempPE -!TimeHACK.Main\obj\Release\DesignTimeResolveAssemblyReferences.cache -!TimeHACK.Main\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache -!TimeHACK.Main\obj\Release\CoreCompileInputs.cache -!TimeHACK.Engine\obj\Debug\TempPE -!TimeHACK.Engine\obj\Debug\DesignTimeResolveAssemblyReferences.cache -!TimeHACK.Engine\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache -!TimeHACK.Engine\obj\Debug\CoreCompileInputs.cache -!TimeHACK.Engine\obj\Release\TempPE -!TimeHACK.Engine\obj\Release\DesignTimeResolveAssemblyReferences.cache -!TimeHACK.Engine\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache -!TimeHACK.Engine\obj\Release\CoreCompileInputs.cache +!Histacom2\obj\Debug\TempPE +!Histacom2\obj\Debug\DesignTimeResolveAssemblyReferences.cache +!Histacom2\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache +!Histacom2\obj\Debug\CoreCompileInputs.cache +!Histacom2\obj\Release\TempPE +!Histacom2\obj\Release\DesignTimeResolveAssemblyReferences.cache +!Histacom2\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache +!Histacom2\obj\Release\CoreCompileInputs.cache +!Histacom2.Engine\obj\Debug\TempPE +!Histacom2.Engine\obj\Debug\DesignTimeResolveAssemblyReferences.cache +!Histacom2.Engine\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache +!Histacom2.Engine\obj\Debug\CoreCompileInputs.cache +!Histacom2.Engine\obj\Release\TempPE +!Histacom2.Engine\obj\Release\DesignTimeResolveAssemblyReferences.cache +!Histacom2.Engine\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache +!Histacom2.Engine\obj\Release\CoreCompileInputs.cache !packages # Including the .idea directory within repositories is a BAD idea: diff --git a/Histacom2.Engine/FileDialogBoxManager.cs b/Histacom2.Engine/FileDialogBoxManager.cs index a862bc7..161c393 100644 --- a/Histacom2.Engine/FileDialogBoxManager.cs +++ b/Histacom2.Engine/FileDialogBoxManager.cs @@ -13,6 +13,7 @@ namespace Histacom2.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,19 @@ namespace Histacom2.Engine return ""; } } + + 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 = 20; + info.ByteSize = fileBytes; + SaveSystem.CurrentSave.BytesLeft -= fileBytes; + SaveSystem.UpdateDirectoryInfo(new FileInfo(path).Directory.FullName, info); + } } } diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj index beb4aa2..361672e 100644 --- a/Histacom2.Engine/Histacom2.Engine.csproj +++ b/Histacom2.Engine/Histacom2.Engine.csproj @@ -20,6 +20,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -53,6 +54,12 @@ <Compile Include="Paintbrush.cs" /> <Compile Include="SaveSystem.cs" /> <Compile Include="TaskBarController.cs" /> + <Compile Include="Template\ResizeOverlay.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Template\ResizeOverlay.Designer.cs"> + <DependentUpon>ResizeOverlay.cs</DependentUpon> + </Compile> <Compile Include="Template\Win9XBSOD.cs"> <SubType>Form</SubType> </Compile> @@ -101,6 +108,9 @@ <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> + <EmbeddedResource Include="Template\ResizeOverlay.resx"> + <DependentUpon>ResizeOverlay.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Template\Win9XBSOD.resx"> <DependentUpon>Win9XBSOD.cs</DependentUpon> </EmbeddedResource> diff --git a/Histacom2.Engine/SaveSystem.cs b/Histacom2.Engine/SaveSystem.cs index ef98c10..b8c619e 100644 --- a/Histacom2.Engine/SaveSystem.cs +++ b/Histacom2.Engine/SaveSystem.cs @@ -28,6 +28,13 @@ namespace Histacom2.Engine public static Theme currentTheme { get; set; } + public static bool IsBinarySave = +#if BINARY_SAVE + true; +#else + false; +#endif + #if BINARY_SAVE private static readonly byte[] magic = Encoding.UTF8.GetBytes("THSv"); private static readonly IOrderedEnumerable<System.Reflection.PropertyInfo> properties = typeof(Save).GetProperties().OrderBy(p => (p.GetCustomAttributes(typeof(OrderAttribute), false).SingleOrDefault() as OrderAttribute).Order); @@ -207,10 +214,58 @@ namespace Histacom2.Engine public static void UpdateDirectoryInfo(string path, THFileInfo newfile) { - newfile.DOSName = newfile.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", ""); - if (newfile.DOSName.Contains(".")) + SetDOSName(ref newfile); + + if (File.ReadAllText(Path.Combine(path, "_data.info")).Contains(newfile.DOSName)) return; + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + fsfi.Files.Add(newfile); + fsfi.ByteSize += newfile.ByteSize; + + string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); + + File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); + } + + public static void RemoveFileFromDirectory(string path, string filename) + { + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + THFileInfo fi = fsfi.Files.Find((THFileInfo f) => { return f.Name == filename; }); + if (fi == null) return; + + fsfi.ByteSize -= fi.ByteSize; + CurrentSave.BytesLeft += fi.ByteSize; + + fsfi.Files.Remove(fi); + string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); + + File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); + } + + public static void RemoveSubDirFromDirectory(string path, string dirname) + { + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + THDirInfo di = fsfi.SubDirs.Find((THDirInfo f) => { return f.Name == dirname; }); + if (di == null) return; + + // Find the bytesize of the folder + + FileSystemFolderInfo dirfsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + + fsfi.ByteSize -= dirfsfi.ByteSize; + CurrentSave.BytesLeft += dirfsfi.ByteSize; + + fsfi.SubDirs.Remove(di); + string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); + + File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); + } + + public static string SetDOSName(ref THFileInfo file) + { + file.DOSName = file.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", ""); + if (file.DOSName.Contains(".")) { - string[] dos = newfile.DOSName.Split('.'); + string[] dos = file.DOSName.Split('.'); if (dos.Count() > 2) { @@ -221,54 +276,79 @@ namespace Histacom2.Engine dos[1] = dos[1].Substring(0, 3); if (dos[0].Length > 8) dos[0] = dos[0].Substring(0, 6) + "~1"; - newfile.DOSName = dos[0] + "." + dos[1]; + file.DOSName = dos[0] + "." + dos[1]; } - else if (newfile.DOSName.Length > 8) newfile.DOSName = newfile.DOSName.Substring(0, 6) + "~1"; + else if (file.DOSName.Length > 8) file.DOSName = file.DOSName.Substring(0, 6) + "~1"; + return file.DOSName; + } - if (File.ReadAllText(Path.Combine(path, "_data.info")).Contains(newfile.DOSName)) return; + public static void RenameDirectory(string path, string dirname, string newname) + { FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); - fsfi.Files.Add(newfile); - fsfi.ByteSize += newfile.ByteSize; + THDirInfo di = fsfi.SubDirs.Find((THDirInfo f) => { return f.Name == dirname; }); + if (di == null) return; + + THDirInfo newDi = di; + + newDi.Name = newname; + THFileInfo tmpfi = new THFileInfo(); + newDi.DOSName = SetDOSName(ref tmpfi); + fsfi.SubDirs.Remove(di); + fsfi.SubDirs.Add(newDi); string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); } - public static void UpgradeFileSystem(string oldOS, string newOS) + public static void RenameFile(string path, string filename, string newname) { - switch (oldOS) + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + THFileInfo fi = fsfi.Files.Find((THFileInfo f) => { return f.Name == filename; }); + if (fi == null) return; + + THFileInfo newFi = fi; + + newFi.Name = newname; + + THFileInfo tmpfi = new THFileInfo(); + newFi.DOSName = SetDOSName(ref tmpfi); + fsfi.Files.Remove(fi); + fsfi.Files.Add(newFi); + string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); + + File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); + } + + public static void UpgradeFileSystem(string newOS) + { + if (newOS == "98" || newOS == "2000" || newOS == "ME") { - case "95": - if (newOS == "98" || newOS == "2000" || newOS == "ME") - { - // We are upgrading from the old WinClassic file System to the new WinClassic filesystem! - // All the above OSes share basically the same file layout! - // (Excluding Documents And Settings) which is 2000 and ME only + // We are upgrading from the old WinClassic file System to the new WinClassic filesystem! + // All the above OSes share basically the same file layout! + // (Excluding Documents And Settings) which is 2000 and ME only - // Add Address Book into existance! + // Add Address Book into existance! - SaveDirectoryInfo(ProfileProgramsDirectory, "Outlook Express", false, "Outlook Express", true); - CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Outlook Express"), "WAB.exe", "addressbook", 8, 512); + SaveDirectoryInfo(ProfileProgramsDirectory, "Outlook Express", false, "Outlook Express", true); + CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Outlook Express"), "WAB.exe", "addressbook", 8, 512); - // There is no "The Microsoft Network" folder! + // There is no "The Microsoft Network" folder! - if (Directory.Exists(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"))) Directory.Delete(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"), true); - FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(ProfileProgramsDirectory, "_data.info"))); - foreach (THDirInfo dir in fsfi.SubDirs) - { - if (dir.Name == "The Microsoft Network") - { - fsfi.SubDirs.Remove(dir); - break; - } - } + if (Directory.Exists(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"))) Directory.Delete(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"), true); + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(ProfileProgramsDirectory, "_data.info"))); + foreach (THDirInfo dir in fsfi.SubDirs) + { + if (dir.Name == "The Microsoft Network") + { + fsfi.SubDirs.Remove(dir); + break; } - break; + } } } - public static void SaveDirectoryInfo(string parent, string dirname, bool isProtected, string label, bool allowback) + public static void SaveDirectoryInfo(string parent, string dirname, bool isProtected, string label, bool allowback, bool updateParent = true) { if (File.Exists(Path.Combine(parent, dirname, "_data.info")) && Path.Combine(parent, dirname) != ProfileFileSystemDirectory) return; Directory.CreateDirectory(Path.Combine(parent, dirname)); @@ -286,15 +366,18 @@ namespace Histacom2.Engine info.SubDirs = new List<THDirInfo>(256); info.ByteSize = 0; - if (parent != ProfileDirectory) + if (updateParent == true) { - FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(parent, "_data.info"))); - THDirInfo thd = new THDirInfo(); - thd.Name = info.Label; - thd.DOSName = info.DOSLabel; - fsfi.SubDirs.Add(thd); + if ((parent != ProfileDirectory)) + { + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(parent, "_data.info"))); + THDirInfo thd = new THDirInfo(); + thd.Name = info.Label; + thd.DOSName = info.DOSLabel; + fsfi.SubDirs.Add(thd); - File.WriteAllText(Path.Combine(parent, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented)); + File.WriteAllText(Path.Combine(parent, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented)); + } } string toWrite = JsonConvert.SerializeObject(info, Formatting.Indented); diff --git a/Histacom2.Engine/Template/ResizeOverlay.Designer.cs b/Histacom2.Engine/Template/ResizeOverlay.Designer.cs new file mode 100644 index 0000000..8d76c26 --- /dev/null +++ b/Histacom2.Engine/Template/ResizeOverlay.Designer.cs @@ -0,0 +1,78 @@ +namespace Histacom2.Engine.Template +{ + partial class ResizeOverlay + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.outline = new System.Windows.Forms.PictureBox(); + this.tmrMove = new System.Windows.Forms.Timer(this.components); + ((System.ComponentModel.ISupportInitialize)(this.outline)).BeginInit(); + this.SuspendLayout(); + // + // outline + // + this.outline.BackColor = System.Drawing.Color.Transparent; + this.outline.Location = new System.Drawing.Point(194, 158); + this.outline.Name = "outline"; + this.outline.Size = new System.Drawing.Size(300, 158); + this.outline.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.outline.TabIndex = 0; + this.outline.TabStop = false; + this.outline.Paint += new System.Windows.Forms.PaintEventHandler(this.outline_Paint); + // + // tmrMove + // + this.tmrMove.Interval = 20; + this.tmrMove.Tick += new System.EventHandler(this.tmrMove_Tick); + // + // ResizeOverlay + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1))))); + this.ClientSize = new System.Drawing.Size(800, 600); + this.Controls.Add(this.outline); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "ResizeOverlay"; + this.Tag = "ignoreFormOnTaskbar"; + this.Text = "ResizeOverlay"; + this.TopMost = true; + this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1))))); + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + ((System.ComponentModel.ISupportInitialize)(this.outline)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox outline; + public System.Windows.Forms.Timer tmrMove; + } +}
\ No newline at end of file diff --git a/Histacom2.Engine/Template/ResizeOverlay.cs b/Histacom2.Engine/Template/ResizeOverlay.cs new file mode 100644 index 0000000..ca8a5e4 --- /dev/null +++ b/Histacom2.Engine/Template/ResizeOverlay.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Histacom2.Engine.Template +{ + public partial class ResizeOverlay : Form + { + public Rectangle ToDraw = new Rectangle(); + + public ResizeOverlay() + { + InitializeComponent(); + } + + private void tmrMove_Tick(object sender, EventArgs e) + { + outline.Bounds = ToDraw; // Pens.Gray, ToDraw); + } + + private void outline_Paint(object sender, PaintEventArgs e) + { + e.Graphics.FillRectangle(Brushes.Gray, 0, 0, outline.Width, 4); // Top border + e.Graphics.FillRectangle(Brushes.Gray, 0, outline.Height - 4, outline.Width, 4); // Bottom border + e.Graphics.FillRectangle(Brushes.Gray, 0, 0, 4, outline.Height); // Left border + e.Graphics.FillRectangle(Brushes.Gray, outline.Width - 4, 0, 4, outline.Height); // Right border + } + } +} diff --git a/Histacom2.Engine/Template/ResizeOverlay.resx b/Histacom2.Engine/Template/ResizeOverlay.resx new file mode 100644 index 0000000..10340d0 --- /dev/null +++ b/Histacom2.Engine/Template/ResizeOverlay.resx @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="tmrMove.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/Histacom2.Engine/Template/WinClassic.Designer.cs b/Histacom2.Engine/Template/WinClassic.Designer.cs index be76be6..593cfd6 100644 --- a/Histacom2.Engine/Template/WinClassic.Designer.cs +++ b/Histacom2.Engine/Template/WinClassic.Designer.cs @@ -162,6 +162,7 @@ this.toprightcorner.TabIndex = 6; this.toprightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.toprightcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.toprightcorner_MouseMove); + this.toprightcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // bottomrightcorner // @@ -174,6 +175,7 @@ this.bottomrightcorner.TabIndex = 4; this.bottomrightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.bottomrightcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottomrightcorner_MouseMove); + this.bottomrightcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // bottomleftcorner // @@ -186,6 +188,7 @@ this.bottomleftcorner.TabIndex = 2; this.bottomleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.bottomleftcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottomleftcorner_MouseMove); + this.bottomleftcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // topleftcorner // @@ -197,6 +200,7 @@ this.topleftcorner.TabIndex = 1; this.topleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.topleftcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.topleftcorner_MouseMove); + this.topleftcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // left // @@ -209,6 +213,7 @@ this.left.TabIndex = 3; this.left.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.left.MouseMove += new System.Windows.Forms.MouseEventHandler(this.left_MouseMove); + this.left.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // bottom // @@ -222,6 +227,7 @@ this.bottom.TabIndex = 5; this.bottom.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.bottom.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottom_MouseMove); + this.bottom.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // right // @@ -234,6 +240,7 @@ this.right.TabIndex = 7; this.right.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.right.MouseMove += new System.Windows.Forms.MouseEventHandler(this.right_MouseMove); + this.right.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // top // @@ -247,6 +254,7 @@ this.top.TabIndex = 8; this.top.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.top.MouseMove += new System.Windows.Forms.MouseEventHandler(this.top_MouseMove); + this.top.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // WinClassic // @@ -254,11 +262,13 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(300, 300); this.Controls.Add(this.program); + this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "WinClassic"; this.Text = "WinClassic"; this.Activated += new System.EventHandler(this.WinClassic_Activated); this.Deactivate += new System.EventHandler(this.WinClassic_Deactivate); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.WinClassic_Paint); this.program.ResumeLayout(false); this.programtopbar.ResumeLayout(false); this.programtopbar.PerformLayout(); diff --git a/Histacom2.Engine/Template/WinClassic.cs b/Histacom2.Engine/Template/WinClassic.cs index 4c495bc..23ea562 100644 --- a/Histacom2.Engine/Template/WinClassic.cs +++ b/Histacom2.Engine/Template/WinClassic.cs @@ -14,11 +14,13 @@ namespace Histacom2.Engine.Template } public Font fnt; + public ResizeOverlay resizer = new ResizeOverlay(); public bool resizable = true; public bool closeDisabled = false; public bool isActive = true; - + public bool Resizing = false; + public Bitmap ResizingBmp = null; public const int WM_NCLBUTTONDOWN = 0xA1; public const int WM_SYSCOMMAND = 0x0112; public const int HT_CAPTION = 0x2; @@ -72,7 +74,9 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Size = new Size(MousePosition.X - this.Location.X, this.Size.Height); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = MousePosition.X - this.Location.X; + resizer.ToDraw = toDraw; } } @@ -80,8 +84,10 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X); - if (resizable)this.Location = new Point(Cursor.Position.X, this.Location.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = ((this.Width + this.Location.X) - Cursor.Position.X); + if (resizable) toDraw.X = Cursor.Position.X; + resizer.ToDraw = toDraw; } } @@ -89,7 +95,10 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Size = new Size(this.Size.Width, MousePosition.Y - this.Location.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Y = this.Location.Y; + if (resizable) toDraw.Height = MousePosition.Y - this.Location.Y; + resizer.ToDraw = toDraw; } } @@ -97,7 +106,10 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Size = new Size(MousePosition.X - this.Location.X, MousePosition.Y - this.Location.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = MousePosition.X - this.Location.X; + if (resizable) toDraw.Height = MousePosition.Y - this.Location.Y; + resizer.ToDraw = toDraw; } } @@ -105,9 +117,11 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X); - if (resizable) this.Height = (Cursor.Position.Y - this.Location.Y); - if (resizable) this.Location = new Point(Cursor.Position.X, this.Location.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = ((toDraw.Width + toDraw.Location.X) - Cursor.Position.X); + if (resizable) toDraw.Height = Cursor.Position.Y - this.Location.Y; + if (resizable) toDraw.X = Cursor.Position.X; + resizer.ToDraw = toDraw; } } @@ -115,10 +129,12 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X); - if (resizable) this.Location = new Point(Cursor.Position.X, this.Location.Y); - if (resizable) this.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y); - if (resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = ((this.Width + this.Location.X) - Cursor.Position.X); + if (resizable) toDraw.X = Cursor.Position.X; + if (resizable) toDraw.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y); + if (resizable) toDraw.Y = Cursor.Position.Y; + resizer.ToDraw = toDraw; } } @@ -126,8 +142,10 @@ namespace Histacom2.Engine.Template { if(e.Button == MouseButtons.Left) { - if(resizable) this.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y); - if(resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) - Cursor.Position.Y); + if (resizable) toDraw.Y = Cursor.Position.Y; + resizer.ToDraw = toDraw; } } @@ -135,12 +153,58 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Width = (Cursor.Position.X - this.Location.X); - if (resizable) this.Height = ((this.Location.Y - Cursor.Position.Y) + this.Height); - if (resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = MousePosition.X - this.Location.X; + if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) - Cursor.Position.Y); + if (resizable) toDraw.Y = Cursor.Position.Y; + resizer.ToDraw = toDraw; + } + } + + private void WinClassic_Paint(object sender, PaintEventArgs e) + { + if (Resizing) + { + MessageBox.Show("HIT IT"); + e.Graphics.DrawImage(ResizingBmp, 0, 0, this.Width, this.Height); } } + private void border_MouseUp(object sender, MouseEventArgs e) + { + this.Bounds = resizer.ToDraw; + resizer.tmrMove.Stop(); + resizer.Close(); + + resizer = new ResizeOverlay(); + } + + private void border_MouseDown(object sender, MouseEventArgs e) + { + var cursor = this.PointToClient(Cursor.Position); + + if (topleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF004, 0); + else if (toprightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF005, 0); + else if (bottomleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF007, 0); + else if (bottomrightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF008, 0); + + else if (top.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF003, 0); + else if (left.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF001, 0); + else if (right.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF002, 0); + else if (bottom.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF006, 0); + + // Now we need to fix this weird artificating! + + resizer.tmrMove.Start(); + resizer.Show(); + + resizer.ToDraw = this.Bounds; + + // However this defocuses the window which we don't want + + WinClassic_Activated(null, null); + } + public bool max = false; private void maximizebutton_Click(object sender, EventArgs e) @@ -216,20 +280,5 @@ namespace Histacom2.Engine.Template var c = (Button)sender; c.UseVisualStyleBackColor = true; } - - private void border_MouseDown(object sender, EventArgs e) - { - var cursor = this.PointToClient(Cursor.Position); - - if (topleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF004, 0); - else if (toprightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF005, 0); - else if (bottomleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF007, 0); - else if (bottomrightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF008, 0); - - else if (top.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF003, 0); - else if (left.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF001, 0); - else if (right.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF002, 0); - else if (bottom.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF006, 0); - } } } diff --git a/Histacom2.Engine/Template/WinClassic.resx b/Histacom2.Engine/Template/WinClassic.resx index 394031d..6876b17 100644 --- a/Histacom2.Engine/Template/WinClassic.resx +++ b/Histacom2.Engine/Template/WinClassic.resx @@ -118,30 +118,6 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> - <data name="maximizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value> - iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA+SURBVChTY/hP - CmAAAiB1nzjQ0NCA0HDgwAEQBwcAygIBNTRAJNDAqAY0DbgAdg0EAUIDkEUkAGkgDTAwAACYPGiagsMD - PwAAAABJRU5ErkJggg== -</value> - </data> - <data name="minimizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value> - iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA5SURBVChTY/hP - CmAAAiB1nzjQ0NCA0HCACDCqASqGF2DRAOKjAog4BFBDA36A0ABkEQlAGkgDDAwAKPmlWmNluNoAAAAA - SUVORK5CYII= -</value> - </data> - <data name="closebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value> - iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAABcSURBVChTrY/R - DcAgCERvdEbrJh2lPU+SYkINRt+PSN6J4FkBhMddw8y+wFUgCbQ70OtO7OQTJLgRa/L7JWmOt8RsB8mD - TQ5NkFbeQcLwauzMdkjZCLAq0gJrAC8niIXaIK89FAAAAABJRU5ErkJggg== -</value> - </data> <data name="toprightcorner.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -198,4 +174,28 @@ /DTD////wfTh46cBUSgJ/bC/izUAAAAASUVORK5CYII= </value> </data> + <data name="maximizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA+SURBVChTY/hP + CmAAAiB1nzjQ0NCA0HDgwAEQBwcAygIBNTRAJNDAqAY0DbgAdg0EAUIDkEUkAGkgDTAwAACYPGiagsMD + PwAAAABJRU5ErkJggg== +</value> + </data> + <data name="minimizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA5SURBVChTY/hP + CmAAAiB1nzjQ0NCA0HCACDCqASqGF2DRAOKjAog4BFBDA36A0ABkEQlAGkgDDAwAKPmlWmNluNoAAAAA + SUVORK5CYII= +</value> + </data> + <data name="closebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAABcSURBVChTrY/R + DcAgCERvdEbrJh2lPU+SYkINRt+PSN6J4FkBhMddw8y+wFUgCbQ70OtO7OQTJLgRa/L7JWmOt8RsB8mD + TQ5NkFbeQcLwauzMdkjZCLAq0gJrAC8niIXaIK89FAAAAABJRU5ErkJggg== +</value> + </data> </root>
\ No newline at end of file diff --git a/Histacom2.Engine/UI/ClassicButton.resx b/Histacom2.Engine/UI/ClassicButton.resx index 1af7de1..d5494e3 100644 --- a/Histacom2.Engine/UI/ClassicButton.resx +++ b/Histacom2.Engine/UI/ClassicButton.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/Histacom2/GlobalPrograms/WinClassicNotepad.Designer.cs b/Histacom2/GlobalPrograms/WinClassicNotepad.Designer.cs index 113ace9..99c1a2c 100644 --- a/Histacom2/GlobalPrograms/WinClassicNotepad.Designer.cs +++ b/Histacom2/GlobalPrograms/WinClassicNotepad.Designer.cs @@ -1,3 +1,5 @@ +using System; + namespace Histacom2.OS.Win95.Win95Apps { partial class WinClassicNotepad @@ -93,7 +95,7 @@ this.newToolStripMenuItem.BackgroundImage = global::Histacom2.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::Histacom2.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::Histacom2.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::Histacom2.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::Histacom2.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::Histacom2.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::Histacom2.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/Histacom2/GlobalPrograms/WinClassicNotepad.cs b/Histacom2/GlobalPrograms/WinClassicNotepad.cs index 0ed0bb7..e1a4019 100644 --- a/Histacom2/GlobalPrograms/WinClassicNotepad.cs +++ b/Histacom2/GlobalPrograms/WinClassicNotepad.cs @@ -15,6 +15,7 @@ namespace Histacom2.OS.Win95.Win95Apps { public partial class WinClassicNotepad : UserControl { + public string CurrentFilePath = ""; public WinClassicNotepad() { InitializeComponent(); @@ -84,10 +85,9 @@ namespace Histacom2.OS.Win95.Win95Apps { try { - ActivateSaveFileDialog(".txt"); + ActivateOpenFileDialog(".txt"); string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); - MessageBox.Show(selectedPath); if (selectedPath != "") { mainText.Text = ReadTextFile(selectedPath); @@ -100,19 +100,37 @@ namespace Histacom2.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); + } + } + + 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/Histacom2/Histacom2.csproj b/Histacom2/Histacom2.csproj index 6f60226..46750d2 100644 --- a/Histacom2/Histacom2.csproj +++ b/Histacom2/Histacom2.csproj @@ -634,6 +634,9 @@ <None Include="Resources\WinClassicGENERALApplicationToolBoxBackground.png" /> <None Include="Resources\Win2000WebBackground.png" /> <None Include="Resources\Win98WebBackground.png" /> + <None Include="Resources\WinClassicTextFile.png" /> + <None Include="Resources\WinClassicRtfFile.png" /> + <None Include="Resources\WinClassicNotepad.png" /> <Content Include="Resources\WinClassic\16Color.png" /> <Content Include="Resources\WinClassic\256Color.png" /> <None Include="Resources\WinClassic\tada.wav" /> diff --git a/Histacom2/OS/Win95/Win95.Designer.cs b/Histacom2/OS/Win95/Win95.Designer.cs index 753dfd6..40f40ca 100644 --- a/Histacom2/OS/Win95/Win95.Designer.cs +++ b/Histacom2/OS/Win95/Win95.Designer.cs @@ -218,7 +218,7 @@ namespace Histacom2.OS.Win95 this.SuspendToolStripMenuItem, this.ShutdownToolStripMenuItem}); this.startmenuitems.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.VerticalStackWithOverflow; - this.startmenuitems.Location = new System.Drawing.Point(28, 2); + this.startmenuitems.Location = new System.Drawing.Point(26, 2); this.startmenuitems.Margin = new System.Windows.Forms.Padding(0, 0, 5, 0); this.startmenuitems.Name = "startmenuitems"; this.startmenuitems.Padding = new System.Windows.Forms.Padding(6, 2, 0, 0); @@ -930,7 +930,7 @@ namespace Histacom2.OS.Win95 this.ossidestartmenu.Controls.Add(this.osimage); this.ossidestartmenu.Location = new System.Drawing.Point(0, 0); this.ossidestartmenu.Name = "ossidestartmenu"; - this.ossidestartmenu.Size = new System.Drawing.Size(26, 297); + this.ossidestartmenu.Size = new System.Drawing.Size(23, 297); this.ossidestartmenu.TabIndex = 4; // // osimage @@ -939,7 +939,7 @@ namespace Histacom2.OS.Win95 this.osimage.Image = global::Histacom2.Properties.Resources.Win95SideBar; this.osimage.Location = new System.Drawing.Point(0, 0); this.osimage.Name = "osimage"; - this.osimage.Size = new System.Drawing.Size(26, 297); + this.osimage.Size = new System.Drawing.Size(23, 297); this.osimage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.osimage.TabIndex = 0; this.osimage.TabStop = false; diff --git a/Histacom2/OS/Win95/Win95.resx b/Histacom2/OS/Win95/Win95.resx index 25103b3..419e624 100644 --- a/Histacom2/OS/Win95/Win95.resx +++ b/Histacom2/OS/Win95/Win95.resx @@ -374,7 +374,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACO - hAAAAk1TRnQBSQFMAgEBDQEAATQBAgE0AQIBIAEAASABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAGA + hAAAAk1TRnQBSQFMAgEBDQEAAUQBAgFEAQIBIAEAASABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAGA AwABgAMAAQEBAAEgBwABASQAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/ AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH//wChAAOAAf8DwAH/ A8AB/wPAAf8DwAH/A8AB/wPAAf8DwAH/A8AB/wPAAf8DwAH/A8AB/wPAAf8DwAH/A8AB/wPAAf8DwAH/ diff --git a/Histacom2/OS/Win95/Win95Apps/Story/Hack2.cs b/Histacom2/OS/Win95/Win95Apps/Story/Hack2.cs index 1dc99da..b72c576 100644 --- a/Histacom2/OS/Win95/Win95Apps/Story/Hack2.cs +++ b/Histacom2/OS/Win95/Win95Apps/Story/Hack2.cs @@ -270,11 +270,12 @@ namespace Histacom2.OS.Win95.Win95Apps.Story await Task.Delay(2000); sp.Stop(); - SaveSystem.UpgradeFileSystem("95", "98"); + SaveSystem.UpgradeFileSystem("98"); SaveSystem.CurrentSave.CurrentOS = "98"; SaveSystem.currentTheme = new Default98Theme(); SaveSystem.CurrentSave.ThemeName = "default98"; TitleScreen.frm95.distort.ParentForm.Close(); + foreach (Form frm in Application.OpenForms) if (frm is WinClassic) frm.Close(); Program.title.StartGame(); TitleScreen.frm95.Close(); return; diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 3269e83..8939b84 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -30,15 +30,17 @@ { this.components = new System.ComponentModel.Container(); this.program = new System.Windows.Forms.Panel(); + this.pnlSave = new System.Windows.Forms.Panel(); + this.Button1 = new System.Windows.Forms.Button(); + this.Label1 = new System.Windows.Forms.Label(); + this.txtSave = new System.Windows.Forms.TextBox(); this.mainView = new System.Windows.Forms.ListView(); this.diskView = new System.Windows.Forms.TreeView(); this.MenuStrip1 = new System.Windows.Forms.MenuStrip(); this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CreateShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.FolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.TextDocumentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.BitmapImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DeleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.RenameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CloseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -56,14 +58,10 @@ this.bottomrightcorner = new System.Windows.Forms.Panel(); this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); - this.pnlSave = new System.Windows.Forms.Panel(); - this.Button1 = new System.Windows.Forms.Button(); - this.Label1 = new System.Windows.Forms.Label(); - this.txtSave = new System.Windows.Forms.TextBox(); this.refresh = new System.Windows.Forms.Timer(this.components); this.program.SuspendLayout(); - this.MenuStrip1.SuspendLayout(); this.pnlSave.SuspendLayout(); + this.MenuStrip1.SuspendLayout(); this.SuspendLayout(); // // program @@ -83,31 +81,71 @@ this.program.Size = new System.Drawing.Size(704, 517); this.program.TabIndex = 13; // - // mainView + // pnlSave // - this.mainView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.pnlSave.Controls.Add(this.Button1); + this.pnlSave.Controls.Add(this.Label1); + this.pnlSave.Controls.Add(this.txtSave); + this.pnlSave.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pnlSave.Location = new System.Drawing.Point(0, 482); + this.pnlSave.Name = "pnlSave"; + this.pnlSave.Size = new System.Drawing.Size(704, 35); + this.pnlSave.TabIndex = 18; + this.pnlSave.Visible = false; + // + // Button1 + // + this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.Button1.Location = new System.Drawing.Point(629, 1); + this.Button1.Name = "Button1"; + this.Button1.Size = new System.Drawing.Size(75, 23); + this.Button1.TabIndex = 17; + this.Button1.Text = "Save"; + this.Button1.UseVisualStyleBackColor = true; + this.Button1.Click += new System.EventHandler(this.Button1_Click); + // + // Label1 + // + this.Label1.AutoSize = true; + this.Label1.Location = new System.Drawing.Point(3, 6); + this.Label1.Name = "Label1"; + this.Label1.Size = new System.Drawing.Size(57, 13); + this.Label1.TabIndex = 16; + this.Label1.Text = "File Name:"; + // + // txtSave + // + this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.mainView.Location = new System.Drawing.Point(215, 27); + this.txtSave.Location = new System.Drawing.Point(60, 3); + this.txtSave.Name = "txtSave"; + this.txtSave.Size = new System.Drawing.Size(563, 20); + this.txtSave.TabIndex = 15; + // + // mainView + // + this.mainView.Dock = System.Windows.Forms.DockStyle.Fill; + this.mainView.Location = new System.Drawing.Point(213, 24); this.mainView.Name = "mainView"; - this.mainView.Size = new System.Drawing.Size(486, 444); + this.mainView.Size = new System.Drawing.Size(491, 458); this.mainView.TabIndex = 10; this.mainView.UseCompatibleStateImageBehavior = false; this.mainView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.mainView_AfterLabelEdit); this.mainView.DoubleClick += new System.EventHandler(this.mainView_DoubleClick); - this.mainView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mainView_MouseClick); // // diskView // - this.diskView.Location = new System.Drawing.Point(3, 27); + this.diskView.Dock = System.Windows.Forms.DockStyle.Left; + this.diskView.Location = new System.Drawing.Point(0, 24); this.diskView.Name = "diskView"; - this.diskView.Size = new System.Drawing.Size(213, 444); + this.diskView.Size = new System.Drawing.Size(213, 458); this.diskView.TabIndex = 13; this.diskView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.diskView_AfterSelect); // // MenuStrip1 // - this.MenuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200))))); + this.MenuStrip1.BackColor = System.Drawing.Color.Silver; this.MenuStrip1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.MenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.FileToolStripMenuItem, @@ -128,63 +166,50 @@ this.RenameToolStripMenuItem, this.CloseToolStripMenuItem}); this.FileToolStripMenuItem.Name = "FileToolStripMenuItem"; - this.FileToolStripMenuItem.Size = new System.Drawing.Size(40, 20); + this.FileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.FileToolStripMenuItem.Text = "File"; // // CreateShortcutToolStripMenuItem // this.CreateShortcutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.FolderToolStripMenuItem, - this.ShortcutToolStripMenuItem, - this.TextDocumentToolStripMenuItem, - this.BitmapImageToolStripMenuItem}); + this.TextDocumentToolStripMenuItem}); this.CreateShortcutToolStripMenuItem.Name = "CreateShortcutToolStripMenuItem"; - this.CreateShortcutToolStripMenuItem.Size = new System.Drawing.Size(123, 22); + this.CreateShortcutToolStripMenuItem.Size = new System.Drawing.Size(117, 22); this.CreateShortcutToolStripMenuItem.Text = "New"; // // FolderToolStripMenuItem // this.FolderToolStripMenuItem.Name = "FolderToolStripMenuItem"; - this.FolderToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.FolderToolStripMenuItem.Size = new System.Drawing.Size(154, 22); this.FolderToolStripMenuItem.Text = "Folder"; this.FolderToolStripMenuItem.Click += new System.EventHandler(this.FolderToolStripMenuItem_Click); // - // ShortcutToolStripMenuItem - // - this.ShortcutToolStripMenuItem.Name = "ShortcutToolStripMenuItem"; - this.ShortcutToolStripMenuItem.Size = new System.Drawing.Size(166, 22); - this.ShortcutToolStripMenuItem.Text = "Shortcut"; - // // TextDocumentToolStripMenuItem // this.TextDocumentToolStripMenuItem.Name = "TextDocumentToolStripMenuItem"; - this.TextDocumentToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.TextDocumentToolStripMenuItem.Size = new System.Drawing.Size(154, 22); this.TextDocumentToolStripMenuItem.Text = "Text Document"; - // - // BitmapImageToolStripMenuItem - // - this.BitmapImageToolStripMenuItem.Name = "BitmapImageToolStripMenuItem"; - this.BitmapImageToolStripMenuItem.Size = new System.Drawing.Size(166, 22); - this.BitmapImageToolStripMenuItem.Text = "Bitmap Image"; + this.TextDocumentToolStripMenuItem.Click += new System.EventHandler(this.TextDocumentToolStripMenuItem_Click); // // DeleteToolStripMenuItem // this.DeleteToolStripMenuItem.Name = "DeleteToolStripMenuItem"; - this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(123, 22); + this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(117, 22); this.DeleteToolStripMenuItem.Text = "Delete"; this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click); // // RenameToolStripMenuItem // this.RenameToolStripMenuItem.Name = "RenameToolStripMenuItem"; - this.RenameToolStripMenuItem.Size = new System.Drawing.Size(123, 22); + this.RenameToolStripMenuItem.Size = new System.Drawing.Size(117, 22); this.RenameToolStripMenuItem.Text = "Rename"; this.RenameToolStripMenuItem.Click += new System.EventHandler(this.RenameToolStripMenuItem_Click); // // CloseToolStripMenuItem // this.CloseToolStripMenuItem.Name = "CloseToolStripMenuItem"; - this.CloseToolStripMenuItem.Size = new System.Drawing.Size(123, 22); + this.CloseToolStripMenuItem.Size = new System.Drawing.Size(117, 22); this.CloseToolStripMenuItem.Text = "Close"; this.CloseToolStripMenuItem.Click += new System.EventHandler(this.CloseToolStripMenuItem_Click); // @@ -196,34 +221,34 @@ this.PasteToolStripMenuItem, this.SellectAllCtrlAToolStripMenuItem}); this.EditToolStripMenuItem.Name = "EditToolStripMenuItem"; - this.EditToolStripMenuItem.Size = new System.Drawing.Size(43, 20); + this.EditToolStripMenuItem.Size = new System.Drawing.Size(39, 20); this.EditToolStripMenuItem.Text = "Edit"; // // CutCtrlXToolStripMenuItem // this.CutCtrlXToolStripMenuItem.Name = "CutCtrlXToolStripMenuItem"; - this.CutCtrlXToolStripMenuItem.Size = new System.Drawing.Size(206, 22); + this.CutCtrlXToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.CutCtrlXToolStripMenuItem.Text = "Cut Ctrl+X"; this.CutCtrlXToolStripMenuItem.Click += new System.EventHandler(this.CutCtrlXToolStripMenuItem_Click); // // CopyCtrlCToolStripMenuItem // this.CopyCtrlCToolStripMenuItem.Name = "CopyCtrlCToolStripMenuItem"; - this.CopyCtrlCToolStripMenuItem.Size = new System.Drawing.Size(206, 22); + this.CopyCtrlCToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.CopyCtrlCToolStripMenuItem.Text = "Copy Ctrl+C"; this.CopyCtrlCToolStripMenuItem.Click += new System.EventHandler(this.CopyCtrlCToolStripMenuItem_Click); // // PasteToolStripMenuItem // this.PasteToolStripMenuItem.Name = "PasteToolStripMenuItem"; - this.PasteToolStripMenuItem.Size = new System.Drawing.Size(206, 22); + this.PasteToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.PasteToolStripMenuItem.Text = "Paste Ctrl+V"; this.PasteToolStripMenuItem.Click += new System.EventHandler(this.PasteToolStripMenuItem_Click); // // SellectAllCtrlAToolStripMenuItem // this.SellectAllCtrlAToolStripMenuItem.Name = "SellectAllCtrlAToolStripMenuItem"; - this.SellectAllCtrlAToolStripMenuItem.Size = new System.Drawing.Size(206, 22); + this.SellectAllCtrlAToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.SellectAllCtrlAToolStripMenuItem.Text = "Select All Ctrl+A"; this.SellectAllCtrlAToolStripMenuItem.Click += new System.EventHandler(this.SellectAllCtrlAToolStripMenuItem_Click); // @@ -232,13 +257,13 @@ this.ViewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.RefreshToolStripMenuItem}); this.ViewToolStripMenuItem.Name = "ViewToolStripMenuItem"; - this.ViewToolStripMenuItem.Size = new System.Drawing.Size(47, 20); + this.ViewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.ViewToolStripMenuItem.Text = "View"; // // RefreshToolStripMenuItem // this.RefreshToolStripMenuItem.Name = "RefreshToolStripMenuItem"; - this.RefreshToolStripMenuItem.Size = new System.Drawing.Size(121, 22); + this.RefreshToolStripMenuItem.Size = new System.Drawing.Size(113, 22); this.RefreshToolStripMenuItem.Text = "Refresh"; this.RefreshToolStripMenuItem.Click += new System.EventHandler(this.RefreshToolStripMenuItem_Click); // @@ -248,19 +273,19 @@ this.HelpToolStripMenuItem1, this.AboutWindows95ToolStripMenuItem}); this.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem"; - this.HelpToolStripMenuItem.Size = new System.Drawing.Size(46, 20); + this.HelpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.HelpToolStripMenuItem.Text = "Help"; // // HelpToolStripMenuItem1 // this.HelpToolStripMenuItem1.Name = "HelpToolStripMenuItem1"; - this.HelpToolStripMenuItem1.Size = new System.Drawing.Size(188, 22); + this.HelpToolStripMenuItem1.Size = new System.Drawing.Size(174, 22); this.HelpToolStripMenuItem1.Text = "Help Topics"; // // AboutWindows95ToolStripMenuItem // this.AboutWindows95ToolStripMenuItem.Name = "AboutWindows95ToolStripMenuItem"; - this.AboutWindows95ToolStripMenuItem.Size = new System.Drawing.Size(188, 22); + this.AboutWindows95ToolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.AboutWindows95ToolStripMenuItem.Text = "About Windows 95"; this.AboutWindows95ToolStripMenuItem.Click += new System.EventHandler(this.AboutWindows95ToolStripMenuItem_Click); // @@ -296,47 +321,6 @@ this.topleftcorner.Size = new System.Drawing.Size(4, 4); this.topleftcorner.TabIndex = 1; // - // pnlSave - // - this.pnlSave.Controls.Add(this.Button1); - this.pnlSave.Controls.Add(this.Label1); - this.pnlSave.Controls.Add(this.txtSave); - this.pnlSave.Location = new System.Drawing.Point(3, 474); - this.pnlSave.Name = "pnlSave"; - this.pnlSave.Size = new System.Drawing.Size(850, 35); - this.pnlSave.TabIndex = 18; - this.pnlSave.Visible = false; - // - // Button1 - // - this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.Button1.Location = new System.Drawing.Point(608, 1); - this.Button1.Name = "Button1"; - this.Button1.Size = new System.Drawing.Size(75, 23); - this.Button1.TabIndex = 17; - this.Button1.Text = "Save"; - this.Button1.UseVisualStyleBackColor = true; - this.Button1.Click += new System.EventHandler(this.Button1_Click); - // - // Label1 - // - this.Label1.AutoSize = true; - this.Label1.Location = new System.Drawing.Point(3, 6); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(57, 13); - this.Label1.TabIndex = 16; - this.Label1.Text = "File Name:"; - // - // txtSave - // - this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtSave.Location = new System.Drawing.Point(60, 3); - this.txtSave.Name = "txtSave"; - this.txtSave.Size = new System.Drawing.Size(542, 20); - this.txtSave.TabIndex = 15; - // // refresh // this.refresh.Interval = 15000; @@ -352,10 +336,10 @@ this.Load += new System.EventHandler(this.WinClassicWindowsExplorer_Load); this.program.ResumeLayout(false); this.program.PerformLayout(); - this.MenuStrip1.ResumeLayout(false); - this.MenuStrip1.PerformLayout(); this.pnlSave.ResumeLayout(false); this.pnlSave.PerformLayout(); + this.MenuStrip1.ResumeLayout(false); + this.MenuStrip1.PerformLayout(); this.ResumeLayout(false); } @@ -368,9 +352,7 @@ internal System.Windows.Forms.ToolStripMenuItem FileToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem CreateShortcutToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem FolderToolStripMenuItem; - internal System.Windows.Forms.ToolStripMenuItem ShortcutToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem TextDocumentToolStripMenuItem; - internal System.Windows.Forms.ToolStripMenuItem BitmapImageToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem DeleteToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem RenameToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem CloseToolStripMenuItem; diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index a01d044..d7a10a8 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -53,6 +53,8 @@ namespace Histacom2.OS.Win95.Win95Apps mainView.LargeImageList = new ImageList(); mainView.LargeImageList.ImageSize = new Size(32, 32); + // Icons 17, 18, 19 reserved for exclusive apps + mainView.LargeImageList.Images.AddRange(new Bitmap[] { Properties.Resources.Win95Computer, // 0 Properties.Resources.WinClassicFolder, Properties.Resources.WinClassicIE4, @@ -70,9 +72,10 @@ namespace Histacom2.OS.Win95.Win95Apps Properties.Resources.WinClassicNotepadBig, Properties.Resources.WinClassicRegedit, // 15 Properties.Resources.WinClassicWordpad, - Properties.Resources.TimeDistorter1, + Properties.Resources.TimeDistorter1, Properties.Resources.WinClassicGTN, - Properties.Resources.WinClassicFTP }); + Properties.Resources.WinClassicFTP, + Properties.Resources.WinClassicRtfFile}); //20 program.BringToFront(); @@ -126,7 +129,8 @@ namespace Histacom2.OS.Win95.Win95Apps private void RefreshAll() { - //try { + //try + //{ this.mainView.Items.Clear(); foreach (string str in Directory.GetDirectories(CurrentDirectory)) @@ -140,10 +144,10 @@ namespace Histacom2.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)); @@ -220,10 +224,19 @@ namespace Histacom2.OS.Win95.Win95Apps case 1: WinClassicNotepad np = new WinClassicNotepad(); np.mainText.Text = FileDialogBoxManager.ReadTextFile(fileDir); + np.CurrentFilePath = fileDir; WinClassic app = wm.StartWin95(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true); Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad); break; + case 2: + WinClassicWordPad wp = new WinClassicWordPad(); + wp.mainText.LoadFile(fileDir); + wp.CurrentFilePath = fileDir; + WinClassic app2 = wm.StartWin95(wp, "Wordpad", Properties.Resources.Win95IconWordpad, true, true); + + Program.AddTaskbarItem(app2, app2.Tag.ToString(), "Wordpad", Properties.Resources.Win95IconWordpad); + break; case 12: OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir); break; @@ -576,13 +589,16 @@ namespace Histacom2.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 - GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); + if (mainView.FocusedItem.Text == "C:") + GoToDir(Path.Combine(CurrentDirectory, "CDrive")); + else + GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); } else { // If it is a file - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (IsFileOpenDialog || IsFileSaveDialog) { if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) { @@ -600,9 +616,7 @@ namespace Histacom2.OS.Win95.Win95Apps OpenFile(mainView.FocusedItem.Tag.ToString()); } } - } catch (Exception ex) { - MessageBox.Show(ex.Message); - } + } catch { /* TODO: Illegal operation */ } } void diskView_AfterSelect(object sender, EventArgs e) @@ -654,7 +668,7 @@ namespace Histacom2.OS.Win95.Win95Apps } else { - SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true); + SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true, false); RefreshAll(); OldLabelText = "New Folder"; @@ -707,10 +721,26 @@ namespace Histacom2.OS.Win95.Win95Apps } else { - if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) Directory.Delete(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text), true); - else File.Delete(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); + if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) + { + Directory.Delete(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text), true); + + // Remove the directory now from the _data.info + + SaveSystem.RemoveSubDirFromDirectory(CurrentDirectory, mainView.FocusedItem.Text); + } + else + { + File.Delete(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); + + // Remove the file now from the _data.info + + RemoveFileFromDirectory(CurrentDirectory, mainView.FocusedItem.Text); + + } RefreshAll(); + RefreshTreeNode(); } } catch { @@ -751,37 +781,48 @@ namespace Histacom2.OS.Win95.Win95Apps private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e) { - string setText = e.Label; - if (setText == "") wm.StartInfobox95("Rename", "You must type a filename.", InfoboxType.Error, InfoboxButtons.OK); - else + try { - if (Directory.Exists(setText)) wm.StartInfobox95("Error Renaming File", $"Cannot rename {new DirectoryInfo(setText).Name}: A file with the name you specified already exists. Specify a different filename.", InfoboxType.Error, InfoboxButtons.OK); + string setText = e.Label; + if (setText == "") wm.StartInfobox95("Rename", "You must type a filename.", InfoboxType.Error, InfoboxButtons.OK); else { - if (File.Exists(setText)) wm.StartInfobox95("Error Renaming File", $"Cannot rename {new FileInfo(setText).Name}: A file with the name you specified already exists. Specify a different filename.", InfoboxType.Error, InfoboxButtons.OK); + if (Directory.Exists(setText)) wm.StartInfobox95("Error Renaming File", $"Cannot rename {new DirectoryInfo(setText).Name}: A file with the name you specified already exists. Specify a different filename.", InfoboxType.Error, InfoboxButtons.OK); else { - if (Directory.Exists((string)mainView.FocusedItem.Tag)) + if (File.Exists(setText)) wm.StartInfobox95("Error Renaming File", $"Cannot rename {new FileInfo(setText).Name}: A file with the name you specified already exists. Specify a different filename.", InfoboxType.Error, InfoboxButtons.OK); + else { - // It was a directory + if (Directory.Exists(Path.Combine(CurrentDirectory, OldLabelText))) + { + // It was a directory - Directory.Move((string)mainView.FocusedItem.Tag, Path.Combine(CurrentDirectory, setText)); + Directory.Move(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText)); - File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info")); - SaveDirectoryInfo(CurrentDirectory, setText, false, setText, true); - } - else - { - // It was a file + File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info")); + SaveDirectoryInfo(CurrentDirectory, setText, false, setText, true, true); - File.Copy((string)mainView.FocusedItem.Tag, Path.Combine(CurrentDirectory, setText)); - File.Delete((string)mainView.FocusedItem.Tag); + // Rename the directory now in the _data.info + + RenameDirectory(CurrentDirectory, OldLabelText, setText); + } + else + { + // It was a file + + File.Copy(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText)); + File.Delete(Path.Combine(CurrentDirectory, OldLabelText)); + + // Rename the file now in the _data.info + + RenameFile(CurrentDirectory, OldLabelText, setText); + } } } } - } - RefreshAll(); - RefreshTreeNode(); + RefreshAll(); + RefreshTreeNode(); + } catch { } } private TreeNode[] createSubDirNodes(DirectoryInfo folder) @@ -948,9 +989,24 @@ namespace Histacom2.OS.Win95.Win95Apps foreach (ListViewItem item in mainView.Items) item.Selected = true; } - private void mainView_MouseClick(object sender, MouseEventArgs e) + private void TextDocumentToolStripMenuItem_Click(object sender, EventArgs e) { + if (File.Exists(CurrentDirectory + "\\New Text Document.txt")) + { + //wm.StartInfobox95("Windows Explorer", "This directory already exists", Properties.Resources.Win95Info); + //TODO: add making "New Text Document (2)" + } + else + { + CreateWindowsFile(CurrentDirectory, "New Text Document.txt", "", 12, 0); + RefreshAll(); + OldLabelText = "New Folder"; + mainView.LabelEdit = true; + mainView.FindItemWithText("New Text Document.txt").BeginEdit(); + } + + RefreshTreeNode(); } } } diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.Designer.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.Designer.cs index 3aeb254..c393579 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.Designer.cs @@ -31,6 +31,9 @@ this.topmenu = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.sendToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -57,6 +60,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 +82,15 @@ 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.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 +114,60 @@ // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripMenuItem, + this.openToolStripMenuItem1, + this.saveToolStripMenuItem, + this.saveAsToolStripMenuItem, this.toolStripSeparator1, 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"; // + // 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); + // + // saveToolStripMenuItem + // + 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); + // + // 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); + // // 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 +183,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 +240,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 +249,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 +258,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 +267,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 +276,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 +291,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(152, 22); this.bulletStyleToolStripMenuItem.Text = "Bullet style"; // // helpToolStripMenuItem @@ -282,24 +309,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 +358,16 @@ this.pnlToolbar.Size = new System.Drawing.Size(593, 28); this.pnlToolbar.TabIndex = 2; // + // pictureBox5 + // + this.pictureBox5.BackgroundImage = global::Histacom2.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::Histacom2.Properties.Resources.wordpad_find; @@ -374,6 +411,7 @@ this.btnSave.Size = new System.Drawing.Size(23, 22); this.btnSave.TabIndex = 3; this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // btnOpen // @@ -385,6 +423,7 @@ this.btnOpen.Size = new System.Drawing.Size(23, 22); this.btnOpen.TabIndex = 2; this.btnOpen.UseVisualStyleBackColor = true; + this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click); // // btnPaste // @@ -429,6 +468,7 @@ this.btnNew.Size = new System.Drawing.Size(23, 22); this.btnNew.TabIndex = 1; this.btnNew.UseVisualStyleBackColor = true; + this.btnNew.Click += new System.EventHandler(this.btnNew_Click); // // pictureBox1 // @@ -595,16 +635,6 @@ this.pictureBox4.TabIndex = 6; this.pictureBox4.TabStop = false; // - // pictureBox5 - // - this.pictureBox5.BackgroundImage = global::Histacom2.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; - // // WinClassicWordPad // this.BackColor = System.Drawing.Color.Silver; @@ -620,6 +650,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 +658,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(); @@ -645,7 +675,7 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem sendToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; - private System.Windows.Forms.RichTextBox mainText; + public System.Windows.Forms.RichTextBox mainText; private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; @@ -685,5 +715,8 @@ 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 openToolStripMenuItem1; } } diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs index f1f5245..91d9368 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs @@ -8,6 +8,8 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Drawing.Text; +using static Histacom2.Engine.FileDialogBoxManager; +using System.IO; using Histacom2.Engine; namespace Histacom2.OS.Win95.Win95Apps @@ -20,6 +22,8 @@ namespace Histacom2.OS.Win95.Win95Apps bool doItalic = false; bool doUnderline = false; + public string CurrentFilePath = ""; + public WinClassicWordPad() { InitializeComponent(); @@ -169,5 +173,111 @@ namespace Histacom2.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); + CurrentFilePath = 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); } + } + + private void btnNew_Click(object sender, EventArgs e) + { + + } + + private void btnOpen_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 btnSave_Click(object sender, EventArgs e) + { + if (CurrentFilePath == "") + { + // We aren't in a file right now + + SaveAs(); + } + else + { + File.Delete(CurrentFilePath); + SaveRtfDocument(mainText, CurrentFilePath); + } + } } }
\ No newline at end of file diff --git a/Histacom2/OS/Win98/Win98.cs b/Histacom2/OS/Win98/Win98.cs index 3f75af7..146aa3c 100644 --- a/Histacom2/OS/Win98/Win98.cs +++ b/Histacom2/OS/Win98/Win98.cs @@ -71,7 +71,7 @@ namespace Histacom2.OS.Win98 // When New Game is clicked in TitleScreen.cs private void Desktop_Load(object sender, EventArgs e) { - UpgradeFileSystem("95", "98"); + UpgradeFileSystem( "98"); if (currentTheme.defaultWallpaper != null) desktopicons.BackgroundImage = new Bitmap(currentTheme.defaultWallpaper, Width, Height); //Start Menu Color - Commented until it works reliably diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs index ff0f32d..af2570c 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs @@ -29,7 +29,6 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WinClassicWindowsExplorer)); this.program = new System.Windows.Forms.Panel(); this.mainView = new System.Windows.Forms.ListView(); this.pnlInfo = new System.Windows.Forms.Panel(); @@ -60,7 +59,6 @@ this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CreateShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.FolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.TextDocumentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.BitmapImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DeleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -117,7 +115,6 @@ this.mainView.Size = new System.Drawing.Size(308, 458); this.mainView.TabIndex = 10; this.mainView.UseCompatibleStateImageBehavior = false; - this.mainView.View = System.Windows.Forms.View.List; this.mainView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.mainView_AfterLabelEdit); this.mainView.SelectedIndexChanged += new System.EventHandler(this.mainView_SelectedIndexChanged); this.mainView.DoubleClick += new System.EventHandler(this.mainView_DoubleClick); @@ -139,6 +136,7 @@ // pictureBox1 // this.pictureBox1.BackColor = System.Drawing.Color.Transparent; + this.pictureBox1.Image = global::Histacom2.Properties.Resources.WinClassicFolderSmall; this.pictureBox1.Location = new System.Drawing.Point(15, 18); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(30, 30); @@ -282,7 +280,7 @@ // btnFolderClose // this.btnFolderClose.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200))))); - this.btnFolderClose.Image = ((System.Drawing.Image)(resources.GetObject("btnFolderClose.Image"))); + this.btnFolderClose.Image = global::Histacom2.Properties.Resources.XCross; this.btnFolderClose.Location = new System.Drawing.Point(172, 3); this.btnFolderClose.Name = "btnFolderClose"; this.btnFolderClose.Size = new System.Drawing.Size(21, 16); @@ -339,7 +337,7 @@ // // Button1 // - this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.Button1.Location = new System.Drawing.Point(626, 3); this.Button1.Name = "Button1"; @@ -396,7 +394,6 @@ // this.CreateShortcutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.FolderToolStripMenuItem, - this.ShortcutToolStripMenuItem, this.TextDocumentToolStripMenuItem, this.BitmapImageToolStripMenuItem}); this.CreateShortcutToolStripMenuItem.Name = "CreateShortcutToolStripMenuItem"; @@ -410,12 +407,6 @@ this.FolderToolStripMenuItem.Text = "Folder"; this.FolderToolStripMenuItem.Click += new System.EventHandler(this.FolderToolStripMenuItem_Click); // - // ShortcutToolStripMenuItem - // - this.ShortcutToolStripMenuItem.Name = "ShortcutToolStripMenuItem"; - this.ShortcutToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.ShortcutToolStripMenuItem.Text = "Shortcut"; - // // TextDocumentToolStripMenuItem // this.TextDocumentToolStripMenuItem.Name = "TextDocumentToolStripMenuItem"; @@ -538,7 +529,7 @@ // refresh // this.refresh.Enabled = true; - this.refresh.Interval = 15000; + this.refresh.Interval = 4000; this.refresh.Tick += new System.EventHandler(this.refresh_Tick); // // WinClassicWindowsExplorer @@ -577,7 +568,6 @@ internal System.Windows.Forms.ToolStripMenuItem FileToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem CreateShortcutToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem FolderToolStripMenuItem; - internal System.Windows.Forms.ToolStripMenuItem ShortcutToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem TextDocumentToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem BitmapImageToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem DeleteToolStripMenuItem; diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index 2d82f75..8fbe14c 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -11,6 +11,7 @@ using static Histacom2.Engine.SaveSystem; using System.IO; using Histacom2.Engine; using Newtonsoft.Json; +using System.Diagnostics; using Histacom2.Engine.Template; namespace Histacom2.OS.Win95.Win95Apps @@ -54,8 +55,31 @@ namespace Histacom2.OS.Win95.Win95Apps diskView.ImageList.Images.Add(Properties.Resources.Win95NetworkIcon); diskView.ImageList.Images.Add(Properties.Resources.Win95RecycleIcon); + mainView.LargeImageList = new ImageList(); + mainView.LargeImageList.ImageSize = new Size(32, 32); + + mainView.LargeImageList.Images.AddRange(new Bitmap[] { Properties.Resources.Win95Computer, // 0 + Properties.Resources.WinClassicFolder, + Properties.Resources.WinClassicIE4, + Properties.Resources.WinClassicInbox, + Properties.Resources.WinClassicMSN, + Properties.Resources.WinClassicNetworking, // 5 + Properties.Resources.WinClassicOutlook, + Properties.Resources.WinClassicRecycle, + Properties.Resources.Win95File, + Properties.Resources.WinClassicFolder, + Properties.Resources.WinClassicApp, // 10 + Properties.Resources.WinClassicSetup, + Properties.Resources.WinClassicNotepad, + Properties.Resources.WinClassicCalcBig, + Properties.Resources.WinClassicNotepadBig, + Properties.Resources.WinClassicRegedit, // 15 + Properties.Resources.WinClassicWordpad, + Properties.Resources.WinClassicRtfFile}); + program.BringToFront(); + //diskView.Items.Add("My Computer", 0); Application.DoEvents(); @@ -123,81 +147,54 @@ namespace Histacom2.OS.Win95.Win95Apps } void RefreshAll() { - try { - - this.mainView.Items.Clear(); - - // Update the WebView - - if (CurrentDirectory == SaveSystem.ProfileMyComputerDirectory) - { - pictureBox1.Image = Properties.Resources.Win95HardDiskIcon; - } else if (CurrentDirectory == SaveSystem.ProfileFileSystemDirectory) { - pictureBox1.Image = Properties.Resources.Win95Computer; - } else { - pictureBox1.Image = Properties.Resources.WinClassicFolder; - } + //try { + this.mainView.Items.Clear(); - txtInfoTip.Show(); - InfoDesc.Hide(); - - string weblabel = ReadDataFile(CurrentDirectory, false); + foreach (string str in Directory.GetDirectories(CurrentDirectory)) + { + string label = ReadDataFile(str, false); + ListViewItem itm = this.mainView.Items.Add(label ?? Path.GetFileName(str)); + itm.ImageIndex = 1; + itm.Tag = str; + } + foreach (string str in Directory.GetFiles(CurrentDirectory)) + { + ListViewItem itm; - txtInfoTitle.Text = weblabel ?? new FileInfo(CurrentDirectory).Name; - foreach (string str in Directory.GetDirectories(CurrentDirectory)) + if (IsFileOpenDialog || IsFileSaveDialog) { - string label = ReadDataFile(str, false); - ListViewItem itm = this.mainView.Items.Add(label ?? Path.GetFileName(str)); - itm.ImageKey = str; - } - foreach (string str in Directory.GetFiles(CurrentDirectory)) - { - // Get the app Icon - - //int AppIcon = 2; - - //switch (new FileInfo(str).Extension) - //{ - // case ".exe": - // string contents; - - // contents = File.ReadAllText(str); - - // switch (contents.ToLower()) - // { - // case "calc": - // AppIcon = 3; - // break; - // case "explorer": - // AppIcon = 4; - // break; - // } - // break; - //} - - - - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (!(Path.GetFileName(str) == "_data.info")) { - if (!(Path.GetFileName(str) == "_data.info")) + if (new FileInfo(str).Extension == onlyViewExtension) { - if (new FileInfo(str).Extension == onlyViewExtension) - { - ListViewItem itm = this.mainView.Items.Add(Path.GetFileName(str)); - itm.Tag = str; - } - } - } else { - if (!(Path.GetFileName(str) == "_data.info")) { - ListViewItem itm = this.mainView.Items.Add(Path.GetFileName(str)); + itm = this.mainView.Items.Add(Path.GetFileName(str)); itm.Tag = str; } + else break; } + else break; + } + else + { + if (!(Path.GetFileName(str) == "_data.info")) + { + itm = this.mainView.Items.Add(Path.GetFileName(str)); + itm.Tag = str; + } + else break; + } + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info"))); + foreach (var item in fsfi.Files) + { + Debug.Print(item.Name + " " + Path.GetFileName(str)); + if (item.Name == Path.GetFileName(str)) { itm.ImageIndex = item.FileIcon; break; } } - } catch (Exception ex) { - //wm.StartInfobox95("Exploring - C:", "Error with the file explorer \n" + ex.Message, Properties.Resources.Win95Info); add illegal operation dialog here later - ((Form)this.TopLevelControl).Close(); } + /* + } catch (Exception ex) { + //wm.StartInfobox95("Exploring - C:", "Error with the file explorer \n" + ex.Message, Properties.Resources.Win95Info); add illegal operation dialog here later + ((Form)this.TopLevelControl).Close(); + }*/ } void RefreshTreeNode() @@ -246,30 +243,40 @@ namespace Histacom2.OS.Win95.Win95Apps case 1: WinClassicNotepad np = new WinClassicNotepad(); np.mainText.Text = FileDialogBoxManager.ReadTextFile(fileDir); + np.CurrentFilePath = fileDir; WinClassic app = wm.StartWin95(np, "Notepad", Properties.Resources.Win95IconNotepad, true, true); Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad); + break; + case 2: + WinClassicWordPad wp = new WinClassicWordPad(); + wp.mainText.LoadFile(fileDir); + wp.CurrentFilePath = fileDir; + WinClassic app2 = wm.StartWin95(wp, "Wordpad", Properties.Resources.Win95IconWordpad, true, true); + Program.AddTaskbarItem(app2, app2.Tag.ToString(), "Wordpad", Properties.Resources.Win95IconWordpad); break; case 12: - OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir)); + OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir); break; } - } catch { } - + catch + { + } + } - void OpenApplication(string appname) + void OpenApplication(string appname, string path) { switch (appname.ToLower()) - { + { case "explorer": - Engine.Template.WinClassic app = wm.StartWin95(new Win95WindowsExplorer(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true); + WinClassic app = wm.StartWin95(new Win95WindowsExplorer(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true); Program.AddTaskbarItem(app, app.Tag.ToString(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer); break; case "calc": - Engine.Template.WinClassic appCalc = wm.StartWin95(new WinClassicCalculator(), "Calculator", Properties.Resources.WinClassicCalc, true, true); + WinClassic appCalc = wm.StartWin95(new WinClassicCalculator(), "Calculator", Properties.Resources.WinClassicCalc, true, true); Program.AddTaskbarItem(appCalc, appCalc.Tag.ToString(), "Calculator", Properties.Resources.WinClassicCalc); Program.nonimportantapps.Add(appCalc); @@ -277,30 +284,68 @@ namespace Histacom2.OS.Win95.Win95Apps Program.nonimportantapps[Program.nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(Program.NonImportantApp_Closing); break; + case "notepad": + WinClassic appNP = wm.StartWin95(new WinClassicNotepad(), "Notepad", Properties.Resources.Win95IconNotepad_2, true, true); + Program.AddTaskbarItem(appNP, appNP.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad_2); + + Program.nonimportantapps.Add(appNP); + Program.nonimportantapps[Program.nonimportantapps.Count - 1].BringToFront(); + Program.nonimportantapps[Program.nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(Program.NonImportantApp_Closing); + + break; case "wordpad": - Engine.Template.WinClassic appWP = wm.StartWin95(new WinClassicWordPad(), "Wordpad", Properties.Resources.WinClassicWordpad, true, true); - Program.AddTaskbarItem(appWP, appWP.Tag.ToString(), "Wordpad", Properties.Resources.WinClassicWordpad); + WinClassic appWP = wm.StartWin95(new WinClassicWordPad(), "Wordpad", Properties.Resources.Win95WordpadIcon2, true, true); + Program.AddTaskbarItem(appWP, appWP.Tag.ToString(), "Wordpad", Properties.Resources.Win95WordpadIcon2); Program.nonimportantapps.Add(appWP); Program.nonimportantapps[Program.nonimportantapps.Count - 1].BringToFront(); Program.nonimportantapps[Program.nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(Program.NonImportantApp_Closing); break; - case "iebrokeninstaller": - wm.StartInfobox95("Internet Explorer Installer", "Installation Failed: The INF file was not found", InfoboxType.Error, InfoboxButtons.OK); + case "ie": + if (TitleScreen.frm95.ie != null) { wm.StartInfobox95("Error Opening Internet Explorer", "An instance of Internet Explorer 4 is already open.", InfoboxType.Warning, InfoboxButtons.OK); return; } + TitleScreen.frm95.ie = wm.StartWin95(new WinClassicIE3(), "Internet Explorer 4", Properties.Resources.Win95IconIE4, true, true); + Program.AddTaskbarItem(TitleScreen.frm95.ie, TitleScreen.frm95.ie.Tag.ToString(), "Internet Explorer 4", Properties.Resources.Win95IconIE4); + TitleScreen.frm95.ie.BringToFront(); + TitleScreen.frm95.ie.FormClosing += new FormClosingEventHandler(TitleScreen.frm95.InternetExplorer4_Closing); break; - case "addressbook": - WinClassic appAdBk = wm.StartWin95(new WinClassicAddressBook(), "Address Book", Properties.Resources.WinClassicAddressBook, true, true); - Program.AddTaskbarItem(appAdBk, appAdBk.Tag.ToString(), "Address Book", Properties.Resources.WinClassicAddressBook); + case "web chat setup": + Win95Installer inst = new Win95Installer("Web Chat 1998"); + inst.InstallCompleted += (sendr, args) => TitleScreen.frm95.WebChatToolStripMenuItem.Visible = true; + WinClassic appInstaller = wm.StartWin95(inst, "Web Chat Setup", null, true, true); + Program.AddTaskbarItem(appInstaller, appInstaller.Tag.ToString(), "Web Chat Setup", null); + appInstaller.BringToFront(); - Program.nonimportantapps.Add(appAdBk); - Program.nonimportantapps[Program.nonimportantapps.Count - 1].BringToFront(); - Program.nonimportantapps[Program.nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(Program.NonImportantApp_Closing); + break; + case "ftp client setup": + Win95Installer instFtp = new Win95Installer("FTP Client"); + instFtp.InstallCompleted += (sendr, args) => TitleScreen.frm95.FTPClientToolStripMenuItem.Visible = true; + WinClassic appFtp = wm.StartWin95(instFtp, "FTP Client Setup", null, true, true); + Program.AddTaskbarItem(appFtp, appFtp.Tag.ToString(), "FTP Client Setup", null); + appFtp.BringToFront(); break; + case "time distorter setup": + Win95Installer instTd = new Win95Installer("Time Distorter 0.1"); + instTd.InstallCompleted += (sendr, args) => + { + TitleScreen.frm95.TimeDistorterToolStripMenuItem.Visible = true; + }; + WinClassic appTd = wm.StartWin95(instTd, "Time Distorter Setup", null, true, true); + Program.AddTaskbarItem(appTd, appTd.Tag.ToString(), "Time Distorter Setup", null); + appTd.BringToFront(); + + break; + case "iebrokeninstaller": + wm.StartInfobox95("Internet Explorer Installer", "Installation Failed: The INF file was not found", InfoboxType.Error, InfoboxButtons.OK); + + break; + default: + wm.StartInfobox95(path.Replace(ProfileMyComputerDirectory, "C:"), $"{path.Replace(ProfileMyComputerDirectory, "C:")} is not a valid Win32 application.", InfoboxType.Error, InfoboxButtons.OK); + break; } - } + } string ReturnType(string extension) { string returnVal = ""; @@ -602,33 +647,34 @@ namespace Histacom2.OS.Win95.Win95Apps { try { - if (mainView.FocusedItem.Tag == null) + if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { // If it isn't a file - GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.ImageKey.ToString())); + if (mainView.FocusedItem.Text == "C:") + GoToDir(Path.Combine(CurrentDirectory, "CDrive")); + else + GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); } else { // If it is a file - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (IsFileOpenDialog == true || IsFileSaveDialog == true) + { + if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) - { - Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); - } + Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); + } - FileDialogBoxManager.IsInOpenDialog = false; - FileDialogBoxManager.IsInSaveDialog = false; + FileDialogBoxManager.IsInOpenDialog = false; + FileDialogBoxManager.IsInSaveDialog = false; - ((Form)this.TopLevelControl).Close(); - } - else - { - OpenFile(mainView.FocusedItem.Tag.ToString()); - } + ((Form)this.TopLevelControl).Close(); + } + else + { + OpenFile(mainView.FocusedItem.Tag.ToString()); + } } - } catch (Exception ex) { - MessageBox.Show(ex.Message); - } + } catch { /* TODO: Illegal operation */ } } void diskView_AfterSelect(object sender, EventArgs e) @@ -730,23 +776,40 @@ namespace Histacom2.OS.Win95.Win95Apps { try { - if (!FileOrDirectoryExists(mainView.FocusedItem.ImageKey)) + if (!FileOrDirectoryExists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { wm.StartInfobox95("Windows Explorer", "This directory doesn't exist", InfoboxType.Info, InfoboxButtons.OK); } else { - if (Directory.Exists(mainView.FocusedItem.ImageKey)) Directory.Delete(mainView.FocusedItem.ImageKey, true); - else File.Delete(mainView.FocusedItem.ImageKey); + if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) + { + Directory.Delete(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text), true); + + // Remove the directory now from the _data.info + + SaveSystem.RemoveSubDirFromDirectory(CurrentDirectory, mainView.FocusedItem.Text); + } + else + { + File.Delete(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); + + // Remove the file now from the _data.info + + RemoveFileFromDirectory(CurrentDirectory, mainView.FocusedItem.Text); + + } RefreshAll(); RefreshTreeNode(); } - } catch + } + catch { RefreshAll(); } - + + RefreshTreeNode(); } internal static bool FileOrDirectoryExists(string path) @@ -780,53 +843,49 @@ namespace Histacom2.OS.Win95.Win95Apps private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e) { - try { - string setText; - setText = e.Label; - if (setText == "") - { - wm.StartInfobox95("Windows Explorer", "Please enter a new directory name", InfoboxType.Info, InfoboxButtons.OK); - } + try + { + string setText = e.Label; + if (setText == "") wm.StartInfobox95("Rename", "You must type a filename.", InfoboxType.Error, InfoboxButtons.OK); else { - if (Directory.Exists(setText)) - { - wm.StartInfobox95("Windows Explorer", "That directory already exists.", InfoboxType.Info, InfoboxButtons.OK); - } + if (Directory.Exists(setText)) wm.StartInfobox95("Error Renaming File", $"Cannot rename {new DirectoryInfo(setText).Name}: A file with the name you specified already exists. Specify a different filename.", InfoboxType.Error, InfoboxButtons.OK); else { - if (File.Exists(setText)) - { - wm.StartInfobox95("Windows Explorer", "That file already exists.", InfoboxType.Info, InfoboxButtons.OK); - } + if (File.Exists(setText)) wm.StartInfobox95("Error Renaming File", $"Cannot rename {new FileInfo(setText).Name}: A file with the name you specified already exists. Specify a different filename.", InfoboxType.Error, InfoboxButtons.OK); else { - if (Directory.Exists(mainView.FocusedItem.ImageKey)) + if (Directory.Exists(Path.Combine(CurrentDirectory, OldLabelText))) { // It was a directory - Directory.Move(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText)); + Directory.Move(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText)); File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info")); + SaveDirectoryInfo(CurrentDirectory, setText, false, setText, true, true); + + // Rename the directory now in the _data.info - SaveDirectoryInfo(CurrentDirectory, setText, false, $"{setText}", true); + RenameDirectory(CurrentDirectory, OldLabelText, setText); } else { - // It was a file + // It was a file + + File.Copy(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText)); + File.Delete(Path.Combine(CurrentDirectory, OldLabelText)); - File.Copy(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText)); - File.Delete(mainView.FocusedItem.ImageKey); + // Rename the file now in the _data.info + + RenameFile(CurrentDirectory, OldLabelText, setText); } } - } } RefreshAll(); RefreshTreeNode(); - } catch { } - + catch { } } private TreeNode[] createSubDirNodes(DirectoryInfo folder) diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx index d9ff80c..e1edd06 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx @@ -120,18 +120,6 @@ <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> - <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> - <data name="btnFolderClose.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value> - iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xNkRpr/UAAABCSURBVChThYox - CgAwCAP9/8scHfqgklI0sUKDQ+6irfDv3Sc7SdtMDWKpA7MBKOIZwM8HpABFfDXauANH24wM84VvNpDG - mcWXeFkAAAAASUVORK5CYII= -</value> - </data> - <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>17, 17</value> - </metadata> <metadata name="refresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>132, 17</value> </metadata> diff --git a/Histacom2/Properties/Resources.resx b/Histacom2/Properties/Resources.resx index c58cdda..6c51cf6 100644 --- a/Histacom2/Properties/Resources.resx +++ b/Histacom2/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> @@ -1924,4 +1921,10 @@ <data name="WinClassicWebchat" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\WinClassic\WinClassicWebchat.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\WinClassicNotepad.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="WinClassicRtfFile" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\WinClassicRtfFile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root>
\ No newline at end of file diff --git a/Histacom2/Properties/Resources1.Designer.cs b/Histacom2/Properties/Resources1.Designer.cs index 6b2342b..3ef5f6c 100644 --- a/Histacom2/Properties/Resources1.Designer.cs +++ b/Histacom2/Properties/Resources1.Designer.cs @@ -1796,6 +1796,16 @@ namespace Histacom2.Properties { /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> + public static System.Drawing.Bitmap WinClassicRtfFile { + get { + object obj = ResourceManager.GetObject("WinClassicRtfFile", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> public static System.Drawing.Bitmap WinClassicRun { get { object obj = ResourceManager.GetObject("WinClassicRun", resourceCulture); diff --git a/Histacom2/Resources/WinClassic/Win95SideBar.png b/Histacom2/Resources/WinClassic/Win95SideBar.png Binary files differindex 2f0e77b..f0ae5ab 100644 --- a/Histacom2/Resources/WinClassic/Win95SideBar.png +++ b/Histacom2/Resources/WinClassic/Win95SideBar.png diff --git a/Histacom2/Resources/WinClassicNotepad.png b/Histacom2/Resources/WinClassicNotepad.png Binary files differnew file mode 100644 index 0000000..937d8ca --- /dev/null +++ b/Histacom2/Resources/WinClassicNotepad.png diff --git a/Histacom2/Resources/WinClassicRtfFile.png b/Histacom2/Resources/WinClassicRtfFile.png Binary files differnew file mode 100644 index 0000000..ad714c6 --- /dev/null +++ b/Histacom2/Resources/WinClassicRtfFile.png diff --git a/Histacom2/Resources/WinClassicTextFile.png b/Histacom2/Resources/WinClassicTextFile.png Binary files differnew file mode 100644 index 0000000..7bfca4b --- /dev/null +++ b/Histacom2/Resources/WinClassicTextFile.png diff --git a/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs b/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs index 4c11576..85c04fb 100644 --- a/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs +++ b/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs @@ -30,9 +30,9 @@ { this.label1 = new System.Windows.Forms.Label(); this.pnlResolved = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.pnlResolved.SuspendLayout(); @@ -59,19 +59,22 @@ this.pnlResolved.Controls.Add(this.label2); this.pnlResolved.Location = new System.Drawing.Point(12, 38); this.pnlResolved.Name = "pnlResolved"; - this.pnlResolved.Size = new System.Drawing.Size(589, 146); + this.pnlResolved.Size = new System.Drawing.Size(589, 275); this.pnlResolved.TabIndex = 1; this.pnlResolved.Visible = false; // - // label2 + // textBox1 // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(8, 11); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(210, 20); - this.label2.TabIndex = 0; - this.label2.Text = "The issue has been resolved"; + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(10, 55); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBox1.Size = new System.Drawing.Size(567, 208); + this.textBox1.TabIndex = 3; // // label3 // @@ -82,24 +85,22 @@ this.label3.TabIndex = 2; this.label3.Text = "log:"; // - // textBox1 + // label2 // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(10, 55); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(567, 79); - this.textBox1.TabIndex = 3; + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(8, 11); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(210, 20); + this.label2.TabIndex = 0; + this.label2.Text = "The issue has been resolved"; // // panel2 // - this.panel2.BackColor = System.Drawing.SystemColors.ControlDark; + this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.panel2.Controls.Add(this.btnClose); this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel2.Location = new System.Drawing.Point(0, 217); + this.panel2.Location = new System.Drawing.Point(0, 315); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(612, 30); this.panel2.TabIndex = 2; @@ -119,7 +120,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(612, 247); + this.ClientSize = new System.Drawing.Size(612, 345); this.Controls.Add(this.panel2); this.Controls.Add(this.pnlResolved); this.Controls.Add(this.label1); diff --git a/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs b/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs index f094640..af105f0 100644 --- a/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs +++ b/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs @@ -16,7 +16,6 @@ namespace Histacom2.SaveDialogs { public string log; Save savedata; - string json; public SaveFileTroubleShooter() { InitializeComponent(); @@ -44,6 +43,7 @@ namespace Histacom2.SaveDialogs // Check if the main.save file exists string savefile = Path.Combine(SaveSystem.ProfileDirectory, "main.save"); + string oldsavefile = Path.Combine(SaveSystem.ProfileDirectory, "oldmain.save"); if (!File.Exists(savefile)) { @@ -59,54 +59,111 @@ namespace Histacom2.SaveDialogs return; } else { WriteToLog("File main.save does exist - checking contents"); + bool readable = false; try { savedata = SaveSystem.ReadSave(savefile); - + readable = true; } catch { - WriteToLog("ISSUE FOUND! File main.save is unreadable"); + WriteToLog("Save file cannot be read - scanning each line and examining them..."); + // Take a little look at the file? - WriteToLog("Sorry, there is no repairing it easily, your data will be lost"); + // But first let's just create a measure of how the JSON SHOULD look + if (!SaveSystem.IsBinarySave) + { + if (File.Exists(oldsavefile)) File.Delete(oldsavefile); + File.Copy(savefile, oldsavefile); - string backupfile = Path.Combine(SaveSystem.ProfileDirectory, "main.backup"); + SaveSystem.NewGame(); + string[] fileLines = File.ReadAllText(oldsavefile).Split('\n'); + string[] shouldBeLines = File.ReadAllText(savefile).Split('\n'); + int i = 0; - if (Directory.Exists(backupfile)) Directory.Delete(backupfile); + string newJson = ""; - File.Copy(savefile, backupfile); - SaveSystem.NewGame(); + foreach (string element in fileLines) + { + element.Replace("\n", "").Replace("\r", ""); + } - // Make sure the username is set + foreach (string line in fileLines) + { + if (!line.StartsWith("{")) + { + if (!line.StartsWith("}")) + { + try { + // We will attempt to deserialize this line - SaveSystem.CurrentSave.Username = SaveSystem.ProfileName; + Newtonsoft.Json.JsonConvert.DeserializeObject("{" + $"{Environment.NewLine}{line}{Environment.NewLine}" + "}"); - WriteToLog($"The corrupt file has been stored in {backupfile}"); + // It worked! This line is not the problem! - EndScan(true); - } - + newJson += $"{Environment.NewLine}{fileLines[i]}"; - // Check the values + WriteToLog($"The line {fileLines[i]} is fine!"); + } catch { + // If it failed to read this line the this is the line that's causing problems! - if (savedata.CurrentOS == null || savedata.CurrentOS == "") - { - WriteToLog("ISSUE FOUND! Data for CurrentOS is null! Giving default value..."); - savedata.CurrentOS = "95"; - EndScan(true); - } + try { newJson += $"{Environment.NewLine}{shouldBeLines[i]}"; + WriteToLog($"ISSUE FOUND! The line {fileLines[i]} was corrupt - it has been reset to default settings!"); + } catch { WriteToLog($"ISSUE FOUND! A line was unneeded - it has been removed as it should!"); } // The reason I'm catching that is in case someone adds a line at the end of the file or something + } + } + } + i++; + } - if (savedata.ExperiencedStories == null) - { - WriteToLog("ISSUE FOUND! Data for ExperiencedStories is null! Giving default value..."); - savedata.ExperiencedStories = new List<string>(); - } + // After all that let's see if we fixed the file - but first, add the "{" and "}" in! - if (savedata.ThemeName == null || savedata.ThemeName == "") - { - WriteToLog("ISSUE FOUND! Data for ThemeName is null! Giving default value..."); - savedata.ThemeName = "95normal"; + newJson = "{" + $"{Environment.NewLine}{newJson}{Environment.NewLine}" + "}"; + + // Now let's test it + + try + { + savedata = Newtonsoft.Json.JsonConvert.DeserializeObject<Save>(newJson); + + WriteToLog("Save file successfully recovered!"); + + File.WriteAllText(savefile, newJson); + readable = true; + + if (File.Exists(oldsavefile)) File.Delete(oldsavefile); + EndScan(true); + } catch { + // It's unusable... + + WriteToLog("ISSUE FOUND! File main.save is unreadable"); + + WriteToLog("Sorry, there is no repairing it easily, your data will be lost"); + + string backupfile = Path.Combine(SaveSystem.ProfileDirectory, "main.backup"); + + if (Directory.Exists(backupfile)) Directory.Delete(backupfile); + + File.Copy(savefile, backupfile); + SaveSystem.NewGame(); + + // Make sure the username is set + + SaveSystem.CurrentSave.Username = SaveSystem.ProfileName; + SaveSystem.SaveGame(); + + WriteToLog($"The corrupt file has been stored in {backupfile}"); + + EndScan(true); + } + } } + + + // Check the values if it was readable + + if (readable) CheckValues(); + } string folderspath = Path.Combine(SaveSystem.ProfileDirectory, "folders"); @@ -118,26 +175,29 @@ namespace Histacom2.SaveDialogs SaveSystem.CheckFiles(); } + } + private void CheckValues() + { + foreach (var field in typeof(Save).GetFields()) + { + if (field.GetValue(savedata) is string) if (field.GetValue(savedata).ToString() == null) { field.SetValue(savedata, ""); continue; } + if (field.GetValue(savedata) is Theme) if (field.GetValue(savedata) == null) { field.SetValue(savedata, new Default95Theme()); continue; } + if (field.GetValue(savedata) is List<string>) if (field.GetValue(savedata) == null) { field.SetValue(savedata, new List<string>()); } + } } void EndScan(bool successful) { pnlResolved.Visible = true; + label1.Hide(); if (successful == true) { label2.Text = "The issue has been resolved."; - // Set CurrentSave to the resolved one - - SaveSystem.CurrentSave = savedata; - - // Set the main.save file to the resolved one - - SaveSystem.WriteSave(Path.Combine(SaveSystem.ProfileDirectory, "main.save"), savedata); textBox1.Text = log; } else { - label2.Text = "The issue has not been resolved, sorry"; + label2.Text = "The issue has not been resolved, sorry."; textBox1.Text = log; } } diff --git a/Histacom2/TitleScreen.Designer.cs b/Histacom2/TitleScreen.Designer.cs index 07bbc54..e29c283 100644 --- a/Histacom2/TitleScreen.Designer.cs +++ b/Histacom2/TitleScreen.Designer.cs @@ -244,7 +244,7 @@ this.startmenuitems.Name = "startmenuitems"; this.startmenuitems.Padding = new System.Windows.Forms.Padding(1, 2, 0, 0); this.startmenuitems.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.startmenuitems.Size = new System.Drawing.Size(140, 220); + this.startmenuitems.Size = new System.Drawing.Size(140, 239); this.startmenuitems.TabIndex = 0; this.startmenuitems.Text = "StartMenu"; // diff --git a/Histacom2/TitleScreen.cs b/Histacom2/TitleScreen.cs index 1cefa9c..e29c67c 100644 --- a/Histacom2/TitleScreen.cs +++ b/Histacom2/TitleScreen.cs @@ -55,7 +55,6 @@ namespace Histacom2 public void StartGame() { - //TODO: You may want to handle story stuff to decide what OS to boot here. if (Convert.ToInt32(VM_Width.Text) == 1337 && Convert.ToInt32(VM_Height.Text) == 1337) leet(); else { @@ -208,8 +207,6 @@ namespace Histacom2 } catch { } - - // If VM Mode is not enabled if (vm_mode.Checked != true) @@ -1,35 +1,34 @@ <a href="https://ci.appveyor.com/project/timehack/timehack"><img src="https://ci.appveyor.com/api/projects/status/8x34p8b0i2idblgd?svg=true" style="border: 0;" alt="AppVeyor Badge"></a> +[](https://discord.gg/ffuXR9k) -[](https://discord.gg/ffuXR9k) - -# TimeHACK +# Histacom 2 ## The remake of the original hacking simulator! -TimeHACK is a C# version of the PC game Histacom, released by 12padams in 2010. Here are some of our goals: -* Get TimeHACK to the same playable state that Histacom's in and beyond. +Histacom 2 is a C# version of the PC game Histacom, released by 12padams in 2010. Here are some of our goals: +* Get Histacom 2 to the same playable state that the original Histacom's in and beyond. * Add more applications to the operating systems. * Add more story elements. ## Building -TimeHACK is currently being developed in Microsoft Visual Studio 2017. Visual Studio 2015 has also been proven to work. If you are using a different IDE, please do so with caution. We cannot guarantee the stability of other IDEs. +Histacom 2 is currently being developed in Microsoft Visual Studio 2017. Visual Studio 2015 has also been proven to work. If you are using a different IDE, please do so with caution. We cannot guarantee the stability of other IDEs. Load the ``.sln`` project file into Visual Studio and compile. No further steps are required. This list may grow in the future. ## Links -TimeHACK has a forum at https://www.ashifter.ml/timehack/forum +Histacom 2 has a forum at https://www.ashifter.ml/timehack/forum -TimeHACK has a Discord server at https://discord.gg/FZgQMDe (You can also click on the dark blue Discord Badge) +Histacom 2 has a Discord server at https://discord.gg/FZgQMDe (You can also click on the dark blue Discord Badge) -TimeHACK has an AppVeyor project at https://ci.appveyor.com/project/timehack/timehack (You can also use the AppVeyor badge) +Histacom 2 has an AppVeyor project at https://ci.appveyor.com/project/timehack/timehack (You can also use the AppVeyor badge) -TimeHACK has a YouTube channel at https://www.youtube.com/channel/UCU3uiIgHdLaNvPYEB1hWPsg (We have a tutorial on how to contribute over there) +Histacom 2 has a YouTube channel at https://www.youtube.com/channel/UCU3uiIgHdLaNvPYEB1hWPsg (We have a tutorial on how to contribute over there) ## Documentation -TimeHACK's documentation can be found on the TimeHACK Wiki: https://github.com/TimeHACKDevs/TimeHACK/wiki +Histacom 2's documentation can be found on the Histacom 2 Wiki: https://github.com/Histacom2-Devs/Histacom2 ## Other Repositories * An unofficial project called "Histacom.AU". -This is a rewrite of Histacom in Python, and has a place [here](https://github.com/TimeHACKDevs/histacom-au). +This is a rewrite of Histacom in Python, and has a place [here](https://github.com/Histacom2-Devs/histacom-au). ## License -TimeHACK is licensed under the [MIT license](https://github.com/TimeHACKDevs/TimeHACK/blob/master/LICENSE). All code committed to the TimeHACK repository becomes the property of the TimeHACK Development Team, and will **not** be removed upon request. +Histacom 2 is licensed under the [MIT license](https://github.com/Histacom2-Devs/Histacom2/blob/master/LICENSE). All code committed to the Histacom 2 repository becomes the property of the Histacom 2 Development Team, and will **not** be removed upon request. |
