Merge pull request #152 from Alex-TIMEHACK/master

Wordpad saves files + Windows Explorer overhawl
This commit is contained in:
lempamo 2017-08-27 15:46:36 -04:00 committed by GitHub
commit d2006a3cf6
21 changed files with 712 additions and 372 deletions

50
.gitignore vendored
View file

@ -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:

View file

@ -13,6 +13,7 @@ public static class FileDialogBoxManager
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 @@ public static string ReadTextFile(string path)
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);
}
}
}

View file

@ -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>

View file

@ -207,23 +207,7 @@ public static void CreateWindowsFile(string filepath, string filename, string co
public static void UpdateDirectoryInfo(string path, THFileInfo newfile)
{
newfile.DOSName = newfile.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", "");
if (newfile.DOSName.Contains("."))
{
string[] dos = newfile.DOSName.Split('.');
if (dos.Count() > 2)
{
List<string> dosb = dos.ToList();
dosb.RemoveRange(1, dos.Count() - 2);
dos = dosb.ToArray();
}
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];
}
else if (newfile.DOSName.Length > 8) newfile.DOSName = newfile.DOSName.Substring(0, 6) + "~1";
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")));
@ -250,6 +234,85 @@ public static void RemoveFileFromDirectory(string path, string filename)
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 = file.DOSName.Split('.');
if (dos.Count() > 2)
{
List<string> dosb = dos.ToList();
dosb.RemoveRange(1, dos.Count() - 2);
dos = dosb.ToArray();
}
dos[1] = dos[1].Substring(0, 3);
if (dos[0].Length > 8) dos[0] = dos[0].Substring(0, 6) + "~1";
file.DOSName = dos[0] + "." + dos[1];
}
else if (file.DOSName.Length > 8) file.DOSName = file.DOSName.Substring(0, 6) + "~1";
return file.DOSName;
}
public static void RenameDirectory(string path, string dirname, string newname)
{
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;
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 RenameFile(string path, string filename, string newname)
{
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")
@ -278,7 +341,7 @@ public static void UpgradeFileSystem(string newOS)
}
}
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));
@ -296,15 +359,18 @@ public static void SaveDirectoryInfo(string parent, string dirname, bool isProte
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);

View file

@ -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>

View file

@ -1,3 +1,5 @@
using System;
namespace Histacom2.OS.Win95.Win95Apps
{
partial class WinClassicNotepad
@ -93,7 +95,7 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
// 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;

View file

@ -15,6 +15,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
public partial class WinClassicNotepad : UserControl
{
public string CurrentFilePath = "";
public WinClassicNotepad()
{
InitializeComponent();
@ -84,10 +85,9 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
ActivateSaveFileDialog(".txt");
ActivateOpenFileDialog(".txt");
string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
MessageBox.Show(selectedPath);
if (selectedPath != "")
{
mainText.Text = ReadTextFile(selectedPath);
@ -99,20 +99,38 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
}
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();
}
}
}

View file

@ -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" />

View file

@ -30,15 +30,17 @@ private void InitializeComponent()
{
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,19 +58,16 @@ private void InitializeComponent()
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
//
this.program.BackColor = System.Drawing.Color.Silver;
this.program.Controls.Add(this.pnlSave);
this.program.Controls.Add(this.mainView);
this.program.Controls.Add(this.diskView);
this.program.Controls.Add(this.MenuStrip1);
@ -76,13 +75,53 @@ private void InitializeComponent()
this.program.Controls.Add(this.bottomrightcorner);
this.program.Controls.Add(this.bottomleftcorner);
this.program.Controls.Add(this.topleftcorner);
this.program.Controls.Add(this.pnlSave);
this.program.Dock = System.Windows.Forms.DockStyle.Fill;
this.program.Location = new System.Drawing.Point(0, 0);
this.program.Name = "program";
this.program.Size = new System.Drawing.Size(704, 517);
this.program.TabIndex = 13;
//
// 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;
//
// mainView
//
this.mainView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -95,10 +134,12 @@ private void InitializeComponent()
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.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.diskView.Location = new System.Drawing.Point(3, 27);
this.diskView.Name = "diskView";
this.diskView.Size = new System.Drawing.Size(213, 444);
@ -135,9 +176,7 @@ private void InitializeComponent()
//
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(117, 22);
this.CreateShortcutToolStripMenuItem.Text = "New";
@ -149,23 +188,12 @@ private void InitializeComponent()
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";
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(154, 22);
this.BitmapImageToolStripMenuItem.Text = "Bitmap Image";
this.TextDocumentToolStripMenuItem.Click += new System.EventHandler(this.TextDocumentToolStripMenuItem_Click);
//
// DeleteToolStripMenuItem
//
@ -296,47 +324,6 @@ private void InitializeComponent()
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 +339,10 @@ private void InitializeComponent()
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 +355,7 @@ private void InitializeComponent()
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;

View file

@ -70,9 +70,10 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e)
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});
program.BringToFront();
@ -126,7 +127,8 @@ string ReadDataFile(string reqDirectory, bool returnYesIfProtected = false) {
private void RefreshAll()
{
//try {
//try
//{
this.mainView.Items.Clear();
foreach (string str in Directory.GetDirectories(CurrentDirectory))
@ -140,10 +142,10 @@ private void RefreshAll()
{
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 +222,19 @@ public void OpenFile(string fileDir)
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 +587,16 @@ void mainView_DoubleClick(object sender, EventArgs e)
{
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 +614,7 @@ void mainView_DoubleClick(object sender, EventArgs e)
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 +666,7 @@ private void FolderToolStripMenuItem_Click(object sender, EventArgs e)
}
else
{
SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true);
SaveDirectoryInfo(CurrentDirectory, "New Folder", false, "New Folder", true, false);
RefreshAll();
OldLabelText = "New Folder";
@ -707,10 +719,26 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
}
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 +779,48 @@ private void RenameToolStripMenuItem_Click(object sender, EventArgs e)
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))
{
// It was a directory
Directory.Move((string)mainView.FocusedItem.Tag, Path.Combine(CurrentDirectory, setText));
File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info"));
SaveDirectoryInfo(CurrentDirectory, setText, false, setText, true);
}
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 file
if (Directory.Exists(Path.Combine(CurrentDirectory, OldLabelText)))
{
// It was a directory
File.Copy((string)mainView.FocusedItem.Tag, Path.Combine(CurrentDirectory, setText));
File.Delete((string)mainView.FocusedItem.Tag);
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
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 +987,24 @@ private void SellectAllCtrlAToolStripMenuItem_Click(object sender, EventArgs e)
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 Folder (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();
}
}
}

View file

@ -31,6 +31,9 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
//
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 void InitializeComponent()
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 void InitializeComponent()
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;
}
}

View file

@ -8,6 +8,8 @@
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 @@ public partial class WinClassicWordPad : UserControl
bool doItalic = false;
bool doUnderline = false;
public string CurrentFilePath = "";
public WinClassicWordPad()
{
InitializeComponent();
@ -169,5 +173,111 @@ void DoFontStyles()
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);
}
}
}
}

View file

@ -29,7 +29,6 @@ protected override void Dispose(bool disposing)
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
// 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 @@ private void InitializeComponent()
// 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);
@ -396,7 +394,6 @@ private void InitializeComponent()
//
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
// 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 @@ private void InitializeComponent()
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;

View file

@ -11,6 +11,7 @@
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 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e)
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 @@ string ReadDataFile(string reqDirectory, bool returnYesIfProtected = false) {
}
void RefreshAll() {
try {
//try {
this.mainView.Items.Clear();
this.mainView.Items.Clear();
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;
// Update the WebView
if (CurrentDirectory == SaveSystem.ProfileMyComputerDirectory)
if (IsFileOpenDialog || IsFileSaveDialog)
{
pictureBox1.Image = Properties.Resources.Win95HardDiskIcon;
} else if (CurrentDirectory == SaveSystem.ProfileFileSystemDirectory) {
pictureBox1.Image = Properties.Resources.Win95Computer;
} else {
pictureBox1.Image = Properties.Resources.WinClassicFolder;
}
txtInfoTip.Show();
InfoDesc.Hide();
string weblabel = ReadDataFile(CurrentDirectory, false);
txtInfoTitle.Text = weblabel ?? new FileInfo(CurrentDirectory).Name;
foreach (string str in Directory.GetDirectories(CurrentDirectory))
{
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,61 +243,109 @@ public void OpenFile(string fileDir)
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);
Program.nonimportantapps[Program.nonimportantapps.Count - 1].BringToFront();
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 "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 "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();
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;
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);
Program.nonimportantapps.Add(appAdBk);
Program.nonimportantapps[Program.nonimportantapps.Count - 1].BringToFront();
Program.nonimportantapps[Program.nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(Program.NonImportantApp_Closing);
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 @@ void mainView_DoubleClick(object sender, EventArgs e)
{
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);
}
FileDialogBoxManager.IsInOpenDialog = false;
FileDialogBoxManager.IsInSaveDialog = false;
((Form)this.TopLevelControl).Close();
}
else
{
OpenFile(mainView.FocusedItem.Tag.ToString());
Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text);
}
FileDialogBoxManager.IsInOpenDialog = false;
FileDialogBoxManager.IsInSaveDialog = false;
((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 @@ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
{
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 @@ private void RenameToolStripMenuItem_Click(object sender, EventArgs e)
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);
SaveDirectoryInfo(CurrentDirectory, setText, false, $"{setText}", true);
// Rename the directory now in the _data.info
RenameDirectory(CurrentDirectory, OldLabelText, setText);
}
else
{
// It was a file
// It was a file
File.Copy(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText));
File.Delete(mainView.FocusedItem.ImageKey);
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();
} catch {
}
catch { }
}
private TreeNode[] createSubDirNodes(DirectoryInfo folder)

View file

@ -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>

View file

@ -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>

View file

@ -1793,6 +1793,16 @@ public static System.Drawing.Bitmap WinClassicRegedit {
}
}
/// <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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

View file

@ -16,7 +16,6 @@ public partial class SaveFileTroubleShooter : Form
{
public string log;
Save savedata;
string json;
public SaveFileTroubleShooter()
{
InitializeComponent();