mirror of
https://github.com/tonytins/s2pk.git
synced 2025-05-19 15:33:17 -04:00
Support for The Sims 3 in config file
This commit is contained in:
parent
8d07e6d307
commit
7af7fc427b
3 changed files with 19 additions and 4 deletions
|
@ -2,7 +2,7 @@ namespace S2PK;
|
||||||
|
|
||||||
public class Config
|
public class Config
|
||||||
{
|
{
|
||||||
public string Destination { get; set; } = string.Empty;
|
public Destination Games { get; set; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the configuration from the specified file path.
|
/// Loads the configuration from the specified file path.
|
||||||
|
@ -16,3 +16,9 @@ public class Config
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Destination
|
||||||
|
{
|
||||||
|
public string Sims2 { get; set; } = string.Empty;
|
||||||
|
public string Sims3 { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
|
@ -46,12 +46,19 @@ public static class PackageManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="package">The path to the package file.</param>
|
/// <param name="package">The path to the package file.</param>
|
||||||
/// <param name="destination">The destination directory. If not provided, the destination is read from the configuration file.</param>
|
/// <param name="destination">The destination directory. If not provided, the destination is read from the configuration file.</param>
|
||||||
public static void UnpackPackages(string package, string destination = "")
|
/// <param name="ts3">Whether to unpack for The Sims 3.</param>
|
||||||
|
public static void UnpackPackages(string package, string destination = "", bool ts3 = false)
|
||||||
{
|
{
|
||||||
|
// If destination is not provided, read from configuration file
|
||||||
if (string.IsNullOrEmpty(destination))
|
if (string.IsNullOrEmpty(destination))
|
||||||
{
|
{
|
||||||
var config = Config.Load("s2pk.toml"); // TODO: Config file should be in home directory
|
var config = Config.Load("s2pk.toml"); // TODO: Config file should be in home directory
|
||||||
destination = config.Destination;
|
|
||||||
|
// If The Sims 3 is not specified, use the default destination
|
||||||
|
if (!ts3)
|
||||||
|
destination = config.Games.Sims2;
|
||||||
|
else
|
||||||
|
destination = config.Games.Sims3;
|
||||||
}
|
}
|
||||||
|
|
||||||
var file = new FileInfo(package);
|
var file = new FileInfo(package);
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
destination ≡ "path/to/destination"
|
[games]
|
||||||
|
sims2 ≡ "path/to/sims2"
|
||||||
|
sims3 ≡ "path/to/sims3"
|
||||||
|
|
Loading…
Add table
Reference in a new issue