better file removal and other smaller things

This commit is contained in:
lempamo 2017-08-27 12:25:52 -04:00
parent 05bbceb109
commit d5d50c6c20
7 changed files with 62 additions and 52 deletions

View file

@ -235,36 +235,46 @@ public static void UpdateDirectoryInfo(string path, THFileInfo newfile)
File.WriteAllText(Path.Combine(path, "_data.info"), toWrite);
}
public static void UpgradeFileSystem(string oldOS, string newOS)
public static void RemoveFileFromDirectory(string path, string filename)
{
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;
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 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
// Add Address Book into existance!
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!
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")
{
// 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!
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!
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;
}
}
fsfi.SubDirs.Remove(dir);
break;
}
break;
}
}
}

View file

@ -218,7 +218,7 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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 @@ private void InitializeComponent()
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;

View file

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

View file

@ -270,7 +270,7 @@ public static async void StartObjective()
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";

View file

@ -107,7 +107,7 @@ private void InitializeComponent()
//
// 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,7 +128,7 @@ private void InitializeComponent()
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
@ -139,52 +139,52 @@ private void InitializeComponent()
this.TextDocumentToolStripMenuItem,
this.BitmapImageToolStripMenuItem});
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.Size = new System.Drawing.Size(154, 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.Size = new System.Drawing.Size(154, 22);
this.BitmapImageToolStripMenuItem.Text = "Bitmap Image";
//
// 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 +196,34 @@ private void InitializeComponent()
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 +232,13 @@ private void InitializeComponent()
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 +248,19 @@ private void InitializeComponent()
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);
//

View file

@ -71,7 +71,7 @@ private void MenuItem_MouseLeave(object sender, EventArgs e)
// 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 843 B