Initial migration to the new 2dog project project structure

This commit is contained in:
Tony Bark 2026-04-24 08:10:32 -04:00
parent 55044ae4b8
commit 1f2032dcf8
34 changed files with 830 additions and 96 deletions

View file

@ -0,0 +1,31 @@
namespace Cyberbits;
public static class FileFetcher
{
public static string LoadTextFile(string filename, bool userDir = false)
{
var location = "res";
if (userDir)
location = "user";
using var file = FileAccess.Open($"{location}://{filename}", FileAccess.ModeFlags.Read);
var contents = file.GetAsText();
file.Close();
return contents;
}
public static ConfigFile LoadConfig(string filename, bool userDir = false)
{
var config = new ConfigFile();
// Load data from a file.
var err = config.Load(LoadTextFile(filename, userDir));
if (err != Error.Ok)
sys.Environment.Exit(sys.Environment.ExitCode);
return config;
}
}