-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RunAGroup creates a seed mod as a starting point
closes #444
- Loading branch information
Showing
3 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
Synthesis.Bethesda.Execution/Running/Runner/CreateEmptyPatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.IO.Abstractions; | ||
using Mutagen.Bethesda.Environments.DI; | ||
using Mutagen.Bethesda.Plugins; | ||
using Mutagen.Bethesda.Plugins.Records; | ||
using Noggog; | ||
using Serilog; | ||
using Synthesis.Bethesda.Execution.Profile; | ||
|
||
namespace Synthesis.Bethesda.Execution.Running.Runner; | ||
|
||
public interface ICreateEmptyPatch | ||
{ | ||
FilePath Create(ModKey modKey, RunParameters runParameters); | ||
} | ||
|
||
public class CreateEmptyPatch : ICreateEmptyPatch | ||
{ | ||
private readonly ILogger _logger; | ||
private readonly IFileSystem _fileSystem; | ||
private readonly IGameReleaseContext _gameReleaseContext; | ||
public IProfileDirectories ProfileDirectories { get; } | ||
|
||
public CreateEmptyPatch( | ||
ILogger logger, | ||
IFileSystem fileSystem, | ||
IProfileDirectories profileDirectories, | ||
IGameReleaseContext gameReleaseContext) | ||
{ | ||
_logger = logger; | ||
_fileSystem = fileSystem; | ||
_gameReleaseContext = gameReleaseContext; | ||
ProfileDirectories = profileDirectories; | ||
} | ||
|
||
public FilePath Create(ModKey modKey, RunParameters runParameters) | ||
{ | ||
var path = new FilePath(Path.Combine(ProfileDirectories.WorkingDirectory, "Seed Mod", modKey.FileName)); | ||
_logger.Information("Creating seed mod at {Path}", path); | ||
path.Directory?.Create(_fileSystem); | ||
var mod = ModInstantiator.Activator(modKey, _gameReleaseContext.Release, | ||
headerVersion: runParameters.HeaderVersionOverride, | ||
forceUseLowerFormIDRanges: runParameters.FormIDRangeMode.ToForceBool()); | ||
mod.WriteToBinary(path, fileSystem: _fileSystem); | ||
return path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters