Histacom2/Histacom2.Engine/SaveSystem.cs

587 lines
23 KiB
C#
Raw Permalink Normal View History

// Define BINARY_SAVE before release so the player has
// to put some effort into cheating ;)
// During development, leave it undefined to use the
// easily modifiable JSON serialised format
2017-11-05 09:52:48 -05:00
//#define BINARY_SAVE
using System;
2017-05-07 20:04:31 -04:00
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
2017-07-04 17:12:25 -04:00
using System.Diagnostics;
2017-07-21 17:14:23 -04:00
using System.Windows.Forms;
using System.Runtime.CompilerServices;
2017-07-27 00:25:37 -04:00
using System.Drawing;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
2017-05-07 20:04:31 -04:00
2017-11-05 09:49:59 -05:00
#if BINARY_SAVE
using Whoa;
#endif
2017-08-23 13:38:40 -04:00
namespace Histacom2.Engine
2017-05-07 20:04:31 -04:00
{
public static class SaveSystem
{
public static Save CurrentSave { get; set; }
2017-07-05 14:41:23 -04:00
public static bool DevMode = false;
2017-07-21 17:14:23 -04:00
public static Form troubleshooter;
2017-05-07 20:04:31 -04:00
2017-07-05 14:41:23 -04:00
public static Theme currentTheme { get; set; }
2017-08-29 09:00:58 -04:00
public static bool IsBinarySave =
#if BINARY_SAVE
true;
#else
false;
#endif
#if BINARY_SAVE
2017-11-05 09:49:59 -05:00
private static readonly int magic = 0x76534854; // 'THSv'
#endif
2017-05-07 20:04:31 -04:00
public static string GameDirectory
{
get
{
2017-08-23 13:38:40 -04:00
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Histacom2");
2017-05-07 20:04:31 -04:00
}
}
2017-07-22 15:35:30 -04:00
public static string DataDirectory
{
get
{
return Path.Combine(GameDirectory, "Data");
}
}
2017-05-20 08:33:32 -04:00
public static string AllProfilesDirectory
2017-05-07 20:04:31 -04:00
{
get
{
return Path.Combine(GameDirectory, "Profiles");
}
}
2017-05-20 08:33:32 -04:00
public static string ProfileName = "";
2017-11-05 09:49:59 -05:00
#if BINARY_SAVE
public static string ProfileFile = "main.whoa";
#else
public static string ProfileFile = "main.json";
#endif
2017-05-20 08:33:32 -04:00
public static string ProfileDirectory
2017-05-07 20:04:31 -04:00
{
2017-05-20 08:33:32 -04:00
get
2017-05-07 20:04:31 -04:00
{
2017-05-20 08:33:32 -04:00
return Path.Combine(GameDirectory, Path.Combine("Profiles", ProfileName));
2017-05-07 20:04:31 -04:00
}
}
public static string ProfileFileSystemDirectory
{
get
{
return Path.Combine(ProfileDirectory, "folders");
}
}
public static string ProfileMyComputerDirectory
{
get
{
2017-07-22 06:41:27 -04:00
return Path.Combine(ProfileFileSystemDirectory, "CDrive");
}
}
public static string ProfileSettingsDirectory
{
get
{
2017-08-01 10:28:47 -04:00
return Path.Combine(ProfileMyComputerDirectory, "Documents and Settings");
}
}
public static string ProfileDocumentsDirectory
{
get
{
2017-08-01 10:28:47 -04:00
return Path.Combine(ProfileMyComputerDirectory, "My Documents");
}
}
public static string ProfileProgramsDirectory
{
get
{
2017-08-01 10:28:47 -04:00
return Path.Combine(ProfileMyComputerDirectory, "Program Files");
}
}
public static string ProfileWindowsDirectory
{
get
{
2017-08-01 10:28:47 -04:00
return Path.Combine(ProfileMyComputerDirectory, "Windows");
}
}
2017-05-07 20:04:31 -04:00
public static void NewGame()
{
var save = new Save();
save.ExperiencedStories = new List<string>();
if (DevMode)
2017-07-04 17:12:25 -04:00
{
2017-10-20 16:35:53 -04:00
if (ProfileName == "xpbad")
{
save.CurrentOS = "xpbad";
save.ThemeName = "badxp";
currentTheme = new BadXPTheme();
}
else if (ProfileName == "98")
2017-07-04 17:12:25 -04:00
{
save.CurrentOS = "98";
2017-07-05 14:41:23 -04:00
save.ThemeName = "default98";
currentTheme = new Default98Theme();
2017-07-04 18:24:33 -04:00
}
else
{
save.CurrentOS = "95";
2017-07-05 14:41:23 -04:00
save.ThemeName = "default95";
2017-07-28 09:01:37 -04:00
save.BytesLeft = 536870912;
2017-07-05 14:41:23 -04:00
currentTheme = new Default95Theme();
2017-07-04 17:12:25 -04:00
}
}
2017-07-04 18:24:33 -04:00
else
{
save.CurrentOS = "95";
2017-07-05 14:41:23 -04:00
save.ThemeName = "default95";
2017-07-28 09:01:37 -04:00
save.BytesLeft = 536870912;
2017-07-05 14:41:23 -04:00
currentTheme = new Default95Theme();
2017-07-04 18:24:33 -04:00
}
CurrentSave = save;
2017-07-01 17:17:57 -04:00
CheckFiles();
SaveGame();
}
public static void CheckFiles()
{
2017-07-28 09:01:37 -04:00
Directory.CreateDirectory(GameDirectory);
2017-07-30 00:10:22 -04:00
Directory.CreateDirectory(DataDirectory);
2017-07-28 09:01:37 -04:00
Directory.CreateDirectory(AllProfilesDirectory);
Directory.CreateDirectory(ProfileDirectory);
Directory.CreateDirectory(ProfileFileSystemDirectory);
2017-07-27 15:58:05 -04:00
SaveDirectoryInfo(ProfileDirectory, "folders", false, "My Computer", false);
2017-07-27 23:58:39 -04:00
SaveDirectoryInfo(ProfileFileSystemDirectory, "CDrive", false, "C:", true);
2017-08-01 10:28:47 -04:00
if (CurrentSave.CurrentOS == "95" || CurrentSave.CurrentOS == "98") SaveDirectoryInfo(ProfileMyComputerDirectory, "My Documents", false, "My Documents", true);
if (CurrentSave.CurrentOS == "2000" || CurrentSave.CurrentOS == "ME") SaveDirectoryInfo(ProfileMyComputerDirectory, "Documents and Settings", false, "Documents and Settings", true);
SaveDirectoryInfo(ProfileMyComputerDirectory, "Program Files", true, "Program Files", true);
2017-07-27 15:58:05 -04:00
SaveDirectoryInfo(ProfileProgramsDirectory, "Accessories", false, "Accessories", true);
SaveDirectoryInfo(ProfileProgramsDirectory, "Internet Explorer", true, "Internet Explorer", true);
2017-09-22 21:18:09 -04:00
if (CurrentSave.CurrentOS == "95") SaveDirectoryInfo(ProfileProgramsDirectory, "The Microsoft Network", true, "The Microsoft Network", true);
2017-08-01 10:28:47 -04:00
SaveDirectoryInfo(ProfileMyComputerDirectory, "Windows", true, "Windows", true);
2017-07-01 17:17:57 -04:00
2017-08-05 08:29:30 -04:00
CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Accessories"), "wordpad.exe", "wordpad", 16, 183296);
CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Internet Explorer"), "ie20.exe", "ie", 8, 512);
CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Internet Explorer"), "lnfinst.exe", "iebrokeninstaller", 8, 512);
2017-09-22 21:18:09 -04:00
if (CurrentSave.CurrentOS == "95") CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"), "msnver.txt", "5900", 12, 4);
2017-07-01 17:17:57 -04:00
CreateWindowsDirectory();
}
public static void CreateWindowsDirectory()
{
SaveDirectoryInfo(ProfileWindowsDirectory, "Application Data", true, "Application Data", true);
2017-07-27 15:58:05 -04:00
SaveDirectoryInfo(ProfileWindowsDirectory, "System", true, "System", true);
SaveDirectoryInfo(ProfileWindowsDirectory, "Config", true, "Config", true);
SaveDirectoryInfo(ProfileWindowsDirectory, "Cursors", true, "Cursors", true);
SaveDirectoryInfo(ProfileWindowsDirectory, "Fonts", true, "Fonts", true);
SaveDirectoryInfo(ProfileWindowsDirectory, "Help", true, "Help", true);
SaveDirectoryInfo(ProfileWindowsDirectory, "Temp", true, "Temp", true);
SaveDirectoryInfo(ProfileWindowsDirectory, "Desktop", true, "Desktop", true);
2017-08-05 08:29:30 -04:00
2017-08-01 10:28:47 -04:00
CreateWindowsFile(ProfileWindowsDirectory, "calc.exe", "calc", 13, 59392);
2017-08-01 13:05:37 -04:00
CreateWindowsFile(ProfileWindowsDirectory, "emm386.exe", "emm386", 10, 125495);
2017-08-01 10:28:47 -04:00
CreateWindowsFile(ProfileWindowsDirectory, "explorer.exe", "explorer", 0, 204288);
CreateWindowsFile(ProfileWindowsDirectory, "notepad.exe", "notepad", 14, 34034);
CreateWindowsFile(ProfileWindowsDirectory, "regedit.exe", "regedit", 15, 120320);
2017-08-01 13:05:37 -04:00
CreateWindowsFile(ProfileWindowsDirectory, "win.com", "", 10, 22679);
CreateWindowsFile(ProfileWindowsDirectory, "write.exe", "wordpad", 16, 5120);
2017-07-01 17:17:57 -04:00
}
2017-08-05 08:29:30 -04:00
public static void CreateWindowsFile(string filepath, string filename, string contents, int fileicon, int bytes)
2017-07-01 17:17:57 -04:00
{
2017-07-27 00:25:37 -04:00
File.WriteAllText(Path.Combine(filepath, filename), contents);
THFileInfo info = new THFileInfo();
info.Name = filename;
info.FileIcon = fileicon;
2017-07-27 23:58:39 -04:00
info.ByteSize = bytes;
2017-07-28 09:01:37 -04:00
CurrentSave.BytesLeft -= bytes;
2017-07-27 00:25:37 -04:00
UpdateDirectoryInfo(filepath, info);
}
public static void UpdateDirectoryInfo(string path, THFileInfo newfile)
{
2017-08-27 14:40:33 -04:00
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("."))
2017-07-27 10:23:57 -04:00
{
2017-08-27 14:40:33 -04:00
string[] dos = file.DOSName.Split('.');
2017-08-01 13:05:37 -04:00
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";
2017-07-27 10:23:57 -04:00
2017-08-27 14:40:33 -04:00
file.DOSName = dos[0] + "." + dos[1];
2017-08-01 13:05:37 -04:00
}
2017-08-27 14:40:33 -04:00
else if (file.DOSName.Length > 8) file.DOSName = file.DOSName.Substring(0, 6) + "~1";
return file.DOSName;
}
2017-07-27 10:23:57 -04:00
2017-08-27 14:40:33 -04:00
public static void RenameDirectory(string path, string dirname, string newname)
{
2017-07-27 00:25:37 -04:00
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info")));
2017-08-27 14:40:33 -04:00
THDirInfo di = fsfi.SubDirs.Find((THDirInfo f) => { return f.Name == dirname; });
if (di == null) return;
THDirInfo newDi = di;
newDi.Name = newname;
2017-07-27 00:25:37 -04:00
2017-08-27 14:40:33 -04:00
THFileInfo tmpfi = new THFileInfo();
newDi.DOSName = SetDOSName(ref tmpfi);
fsfi.SubDirs.Remove(di);
fsfi.SubDirs.Add(newDi);
2017-07-27 00:25:37 -04:00
string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented);
File.WriteAllText(Path.Combine(path, "_data.info"), toWrite);
2017-05-07 20:04:31 -04:00
}
2017-08-27 14:40:33 -04:00
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;
2017-08-27 14:40:33 -04:00
THFileInfo newFi = fi;
2017-08-27 14:40:33 -04:00
newFi.Name = newname;
THFileInfo tmpfi = new THFileInfo();
newFi.DOSName = SetDOSName(ref tmpfi);
fsfi.Files.Remove(fi);
2017-08-27 14:40:33 -04:00
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)
{
2017-09-22 21:18:09 -04:00
if (newOS == "98")
{
// 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);
SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Application Data"), "Microsoft", false, "Microsoft", true);
SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Application Data", "Microsoft"), "Address Book", false, "Address Book", 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);
2017-09-22 21:18:09 -04:00
if (Directory.Exists(Path.Combine(ProfileProgramsDirectory, "12padams"))) Directory.Delete(Path.Combine(ProfileProgramsDirectory, "12padams"), true);
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(ProfileProgramsDirectory, "_data.info")));
foreach (THDirInfo dir in fsfi.SubDirs)
{
2017-09-22 21:18:09 -04:00
if (dir.Name == "The Microsoft Network" || dir.Name == "12padams")
{
fsfi.SubDirs.Remove(dir);
break;
}
}
CurrentSave.BytesLeft = 916455424;
string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented);
File.WriteAllText(Path.Combine(ProfileProgramsDirectory, "_data.info"), toWrite);
fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(ProfileWindowsDirectory, "_data.info")));
Directory.Delete(Path.Combine(ProfileWindowsDirectory, "Desktop"), true);
SaveDirectoryInfo(ProfileWindowsDirectory, "Desktop", true, "Desktop", true);
}
}
2017-08-27 14:40:33 -04:00
public static void SaveDirectoryInfo(string parent, string dirname, bool isProtected, string label, bool allowback, bool updateParent = true)
{
2017-08-13 15:18:46 -04:00
if (File.Exists(Path.Combine(parent, dirname, "_data.info")) && Path.Combine(parent, dirname) != ProfileFileSystemDirectory) return;
2017-07-27 23:58:39 -04:00
Directory.CreateDirectory(Path.Combine(parent, dirname));
FileSystemFolderInfo info = new FileSystemFolderInfo();
2017-07-27 00:25:37 -04:00
info.IsProtected = isProtected;
info.Label = label;
2017-07-27 10:33:02 -04:00
info.DOSLabel = info.Label.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(".", "").Replace(" ", "");
if (info.DOSLabel.Length > 8) info.DOSLabel = info.DOSLabel.Substring(0, 6) + "~1";
2017-07-31 21:04:18 -04:00
if (label == "C:") info.DOSLabel = "C:";
2017-07-27 00:25:37 -04:00
info.AllowBack = allowback;
2017-07-27 10:23:57 -04:00
info.Files = new List<THFileInfo>(256);
2017-07-27 15:58:05 -04:00
info.SubDirs = new List<THDirInfo>(256);
2017-07-27 23:58:39 -04:00
info.ByteSize = 0;
2017-07-27 15:58:05 -04:00
if (updateParent)
2017-07-27 15:58:05 -04:00
{
2017-08-27 14:40:33 -04:00
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);
2017-07-27 15:58:05 -04:00
2017-08-27 14:40:33 -04:00
File.WriteAllText(Path.Combine(parent, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented));
}
2017-07-27 15:58:05 -04:00
}
string toWrite = JsonConvert.SerializeObject(info, Formatting.Indented);
2017-07-27 15:58:05 -04:00
File.WriteAllText(Path.Combine(Path.Combine(parent, dirname), "_data.info"), toWrite);
}
public static Save ReadSave(string fname)
{
#if BINARY_SAVE
using (var fobj = File.OpenRead(fname))
2017-11-05 09:49:59 -05:00
using (var read = new BinaryReader(fobj))
{
2017-11-05 09:49:59 -05:00
if (read.ReadInt32() != magic)
2017-08-23 13:38:40 -04:00
throw new InvalidDataException("This is not a Histacom2 binary save");
2017-11-05 09:49:59 -05:00
return Whoa.Whoa.DeserialiseObject<Save>(fobj, SerialisationOptions.NonSerialized);
}
#else
return JsonConvert.DeserializeObject<Save>(File.ReadAllText(fname));
#endif
}
public static void WriteSave(string fname, Save save)
{
#if BINARY_SAVE
using (var fobj = File.OpenWrite(fname))
2017-11-05 09:49:59 -05:00
using (var write = new BinaryWriter(fobj))
{
2017-11-05 09:49:59 -05:00
write.Write(magic);
Whoa.Whoa.SerialiseObject(fobj, save, SerialisationOptions.NonSerialized);
}
#else
// Serialize the save to JSON.
File.WriteAllText(fname, JsonConvert.SerializeObject(save, Formatting.Indented));
#endif
}
2017-05-07 20:04:31 -04:00
public static void SaveGame()
{
WriteSave(Path.Combine(ProfileDirectory, ProfileFile), CurrentSave);
}
public static bool LoadSave()
{
string savefile = Path.Combine(ProfileDirectory, ProfileFile);
try
{
CurrentSave = ReadSave(savefile);
}
catch
{
MessageBox.Show("WARNING! It looks like this save is corrupt! We will now open the Save troubleshooter");
troubleshooter.ShowDialog();
}
return true;
2017-05-07 20:04:31 -04:00
}
2017-07-05 17:25:36 -04:00
2017-07-22 15:35:30 -04:00
public static byte[] GetAchievements()
{
2017-10-02 14:20:29 -04:00
byte[] byt = new byte[] { 0, // 0 - Piracy Ending
0, // 1 - End of Internet Ending
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // 20 - Minesweeper Hard Mode
2017-07-22 15:35:30 -04:00
if (DevMode) File.WriteAllBytes(Path.Combine(DataDirectory, "achieved.thack"), byt);
if (File.Exists(Path.Combine(DataDirectory, "achieved.thack"))) byt = File.ReadAllBytes(Path.Combine(DataDirectory, "achieved.thack"));
else File.WriteAllBytes(Path.Combine(DataDirectory, "achieved.thack"), byt);
return byt;
}
2017-08-05 21:14:30 -04:00
public static void SaveAchievement(int achievementID)
{
if (!File.Exists(Path.Combine(DataDirectory, "achieved.thack"))) File.WriteAllBytes(Path.Combine(DataDirectory, "achieved.thack"), new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
2017-08-05 21:14:30 -04:00
byte[] byt = File.ReadAllBytes(Path.Combine(DataDirectory, "achieved.thack"));
byt[achievementID] = 1;
File.WriteAllBytes(Path.Combine(DataDirectory, "achieved.thack"), byt);
}
2017-07-05 17:25:36 -04:00
public static void SetTheme()
{
switch (CurrentSave.ThemeName)
{
case "default95":
currentTheme = new Default95Theme();
break;
case "default98":
currentTheme = new Default98Theme();
break;
2017-07-05 17:25:36 -04:00
case "dangeranimals":
currentTheme = new DangerousCreaturesTheme();
break;
2017-07-05 18:41:55 -04:00
case "insidepc":
currentTheme = new InsideComputerTheme();
break;
2017-10-20 16:35:53 -04:00
case "badxp":
currentTheme = new BadXPTheme();
break;
2017-10-23 16:18:09 -04:00
case "default95plus":
currentTheme = new Default95PlusTheme();
break;
case "goldenera":
currentTheme = new GoldenEraTheme();
break;
case "Leo":
currentTheme = new LeoTheme();
break;
case "Mystery":
currentTheme = new MysteryTheme();
break;
case "Nature":
currentTheme = new NatureTheme();
break;
case "Science":
currentTheme = new ScienceTheme();
break;
case "Sports":
currentTheme = new SportsTheme();
break;
case "The60":
currentTheme = new The60Theme();
break;
case "Travel":
currentTheme = new TravelTheme();
break;
case "MoreWin":
currentTheme = new MoreWinTheme();
break;
2017-07-05 17:25:36 -04:00
}
}
2017-05-07 20:04:31 -04:00
}
public class Save
{
// To maintain binary save compatibility,
2017-11-05 09:49:59 -05:00
// add all new properties/fields to the end and don't remove any.
2017-05-07 20:04:31 -04:00
public string Username { get; set; }
public string CurrentOS { get; set; }
// public Dictionary<string, bool> InstalledPrograms { get; set; } InstallProgram is no longer needed... we have that data in the FileSystem
2017-05-07 20:04:31 -04:00
public List<string> ExperiencedStories { get; set; }
public bool FTime95 { get; set; }
public int mineSweepE { get; set; } = 999;
public int mineSweepI { get; set; } = 999;
public int mineSweepH { get; set; } = 999;
2017-07-04 18:24:33 -04:00
public string ThemeName { get; set; }
2017-07-28 09:01:37 -04:00
public int BytesLeft { get; set; }
2017-07-31 15:40:59 -04:00
public Theme customTheme { get; set; }
public bool FTime98 { get; set; }
public bool[] installed95 { get; set; } = new bool[7]; // 0: WC98, 1: FTP, 2: SR, 3: EB, 4: SKNDWS, 5: TD0.1, 6: GTN
2017-05-07 20:04:31 -04:00
}
public class FileSystemFolderInfo
{
2017-07-27 00:25:37 -04:00
public bool IsProtected { get; set; }
public string Label { get; set; }
2017-07-27 10:33:02 -04:00
public string DOSLabel { get; set; }
2017-07-27 00:25:37 -04:00
public bool AllowBack { get; set; }
2017-07-27 23:58:39 -04:00
public int ByteSize { get; set; }
2017-07-27 10:23:57 -04:00
public List<THFileInfo> Files { get; set; }
2017-07-27 15:58:05 -04:00
public List<THDirInfo> SubDirs { get; set; }
2017-07-27 00:25:37 -04:00
}
public class THFileInfo
{
public string Name { get; set; }
public string DOSName { get; set; }
public int FileIcon { get; set; }
2017-07-27 23:58:39 -04:00
public int ByteSize { get; set; }
}
2017-07-27 15:58:05 -04:00
public class THDirInfo
{
public string Name { get; set; }
public string DOSName { get; set; }
}
2017-05-07 20:04:31 -04:00
}