Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "VictorBush.Ego.NefsCommon"]
path = VictorBush.Ego.NefsCommon
url = https://github.com/victorbush/ego.nefscommon.git
12 changes: 0 additions & 12 deletions NeFSedit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VictorBush.Ego.NefsLib.Test
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VictorBush.Ego.NefsEdit.Tests", "VictorBush.Ego.NefsEdit.Tests\VictorBush.Ego.NefsEdit.Tests.csproj", "{40723AAF-DC4B-4DFE-BE01-90C562C7E298}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VictorBush.Ego.NefsCommon.InjectionDatabase.Tests", "VictorBush.Ego.NefsCommon\VictorBush.Ego.NefsCommon.InjectionDatabase.Tests\VictorBush.Ego.NefsCommon.InjectionDatabase.Tests.csproj", "{181257C0-BBE9-408C-B3EF-3BD12E0F7AF3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VictorBush.Ego.NefsCommon.InjectionDatabase", "VictorBush.Ego.NefsCommon\VictorBush.Ego.NefsCommon.InjectionDatabase\VictorBush.Ego.NefsCommon.InjectionDatabase.csproj", "{D9336E22-6F6C-43F3-A5A5-71C0C81B85EE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -48,14 +44,6 @@ Global
{40723AAF-DC4B-4DFE-BE01-90C562C7E298}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40723AAF-DC4B-4DFE-BE01-90C562C7E298}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40723AAF-DC4B-4DFE-BE01-90C562C7E298}.Release|Any CPU.Build.0 = Release|Any CPU
{181257C0-BBE9-408C-B3EF-3BD12E0F7AF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{181257C0-BBE9-408C-B3EF-3BD12E0F7AF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{181257C0-BBE9-408C-B3EF-3BD12E0F7AF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{181257C0-BBE9-408C-B3EF-3BD12E0F7AF3}.Release|Any CPU.Build.0 = Release|Any CPU
{D9336E22-6F6C-43F3-A5A5-71C0C81B85EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9336E22-6F6C-43F3-A5A5-71C0C81B85EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9336E22-6F6C-43F3-A5A5-71C0C81B85EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9336E22-6F6C-43F3-A5A5-71C0C81B85EE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
- Support reading and writing split archives across multiple files
- Add support for versions 0.1.0, 0.2.0, 1.3.0, 1.4.0
- Bring back auto-search of nefs headers in game exe
- Determine behavior for extracting duplicate and removed files
1 change: 0 additions & 1 deletion VictorBush.Ego.NefsCommon
Submodule VictorBush.Ego.NefsCommon deleted from 469e1d
3 changes: 0 additions & 3 deletions VictorBush.Ego.NefsEdit/Source/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using VictorBush.Ego.NefsCommon.InjectionDatabase;
using VictorBush.Ego.NefsEdit.Services;
using VictorBush.Ego.NefsEdit.UI;
using VictorBush.Ego.NefsEdit.Utility;
Expand Down Expand Up @@ -66,8 +65,6 @@ internal static void Main()
x.AddSingleton<INefsReader, NefsReader>();
x.AddSingleton<INefsWriter>(x => new NefsWriter(TempDirectory, x.GetRequiredService<IFileSystem>(), x.GetRequiredService<INefsTransformer>()));
x.AddSingleton<INefsEditWorkspace, NefsEditWorkspace>();
x.AddSingleton<IFileDownloader, FileDownloader>();
x.AddSingleton<IInjectionDatabaseService, InjectionDatabaseService>();
}).Build();

// Run application
Expand Down
8 changes: 2 additions & 6 deletions VictorBush.Ego.NefsEdit/Source/Services/UiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

using System.IO.Abstractions;
using System.Windows.Threading;
using VictorBush.Ego.NefsCommon.InjectionDatabase;
using VictorBush.Ego.NefsEdit.UI;
using VictorBush.Ego.NefsLib.ArchiveSource;
using VictorBush.Ego.NefsLib.IO;
Expand All @@ -14,16 +13,13 @@ namespace VictorBush.Ego.NefsEdit.Services;
/// </summary>
internal class UiService : IUiService
{
private readonly IInjectionDatabaseService injectionDatabaseService;

/// <summary>
/// Initializes a new instance of the <see cref="UiService"/> class.
/// </summary>
public UiService(Dispatcher dispatcher, IFileSystem fileSystem, IInjectionDatabaseService injectionDatabaseService)
public UiService(Dispatcher dispatcher, IFileSystem fileSystem)
{
Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
FileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
this.injectionDatabaseService = injectionDatabaseService ?? throw new ArgumentNullException(nameof(injectionDatabaseService));
}

/// <inheritdoc/>
Expand Down Expand Up @@ -55,7 +51,7 @@ public DialogResult ShowMessageBox(string message, string? title = null, Message
IProgressService progressService,
INefsReader reader)
{
using var dialog = new OpenFileForm(settingsService, this, progressService, reader, FileSystem, this.injectionDatabaseService);
using var dialog = new OpenFileForm(settingsService, this, progressService, reader, FileSystem);
var result = dialog.ShowDialog();
var source = dialog.ArchiveSource;
return (result, source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,5 @@ public class OpenFileDialogState
/// </summary>
public string NefsFilePath { get; set; } = "";

public string NefsInjectDataFilePath { get; set; } = "";

public string NefsInjectFilePath { get; set; } = "";

public string HeadlessExePath { get; set; } = "";
}
15 changes: 0 additions & 15 deletions VictorBush.Ego.NefsEdit/Source/Settings/RecentFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ public RecentFile(NefsArchiveSource source)
GameDatSecondaryOffset = gameDatSource.SecondaryOffset;
GameDatSecondarySize = gameDatSource.SecondarySize;
Type = "GameDatSource";

break;

case NefsInjectSource nefsInjectSource:
NefsInjectDataFilePath = nefsInjectSource.DataFilePath;
NefsInjectFilePath = nefsInjectSource.NefsInjectFilePath;
Type = nameof(NefsInjectSource);
break;

default:
Expand All @@ -63,8 +56,6 @@ public RecentFile(NefsArchiveSource source)
public int? GameDatPrimarySize { get; set; }
public long? GameDatSecondaryOffset { get; set; }
public int? GameDatSecondarySize { get; set; }
public string NefsInjectDataFilePath { get; set; } = "";
public string NefsInjectFilePath { get; set; } = "";
public string StandardFilePath { get; set; } = "";
public string Type { get; set; } = "";

Expand All @@ -78,9 +69,6 @@ public NefsArchiveSource ToArchiveSource()
case "GameDatSource":
return NefsArchiveSource.Headless(GameDatDataFilePath, GameDatHeaderFilePath, GameDatPrimaryOffset!.Value, GameDatPrimarySize, GameDatSecondaryOffset!.Value, GameDatSecondarySize);

case nameof(NefsInjectSource):
return NefsArchiveSource.NefsInject(NefsInjectDataFilePath, NefsInjectFilePath);

default:
throw new InvalidOperationException("Unknown source.");
}
Expand All @@ -97,9 +85,6 @@ public override string ToString()
case "GameDatSource":
return $"[Headless] {Path.GetFileName(GameDatDataFilePath)} [{GameDatPrimaryOffset}|{GameDatSecondaryOffset}]";

case nameof(NefsInjectSource):
return $"[NefsInject] {Path.GetFileName(NefsInjectDataFilePath)}";

default:
return "Unknown source.";
}
Expand Down
6 changes: 0 additions & 6 deletions VictorBush.Ego.NefsEdit/Source/UI/ArchiveDebugForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using VictorBush.Ego.NefsEdit.Workspace;
using VictorBush.Ego.NefsLib;
using VictorBush.Ego.NefsLib.ArchiveSource;
using VictorBush.Ego.NefsLib.Header;
using VictorBush.Ego.NefsLib.Header.Version160;
using VictorBush.Ego.NefsLib.Header.Version200;
using WeifenLuo.WinFormsUI.Docking;
Expand Down Expand Up @@ -48,11 +47,6 @@ private string GetArchiveSourceInfo(NefsArchiveSource source)
Archive file: {standardSource.FilePath}
Header offset: 0";

case NefsInjectSource nefsInjectSource:
return $@"NefsInject archive.
Data file: {nefsInjectSource.DataFilePath}
NefsInject file: {nefsInjectSource.NefsInjectFilePath}";

case HeadlessSource gameDatSource:
return $@"GameDat archive.
Data file: {gameDatSource.DataFilePath}
Expand Down
36 changes: 0 additions & 36 deletions VictorBush.Ego.NefsEdit/Source/UI/EditorForm.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// See LICENSE.txt for license information.

using Microsoft.Extensions.Logging;
using VictorBush.Ego.NefsCommon.InjectionDatabase;
using VictorBush.Ego.NefsEdit.Commands;
using VictorBush.Ego.NefsEdit.Services;
using VictorBush.Ego.NefsEdit.Workspace;
Expand All @@ -15,7 +14,6 @@ namespace VictorBush.Ego.NefsEdit.UI;
internal partial class EditorForm : Form
{
private readonly ILogger<EditorForm> logger;
private readonly IInjectionDatabaseService injectionDatabaseService;
private readonly IProgressService progressService;
private ArchiveDebugForm archiveDebugForm;
private BrowseAllForm browseAllForm;
Expand All @@ -32,13 +30,11 @@ public EditorForm(
INefsEditWorkspace workspace,
IUiService uiService,
ISettingsService settingsService,
IInjectionDatabaseService injectionDatabaseService,
IProgressService progressService)
{
InitializeComponent();
UiService = uiService ?? throw new ArgumentNullException(nameof(uiService));
SettingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
this.injectionDatabaseService = injectionDatabaseService ?? throw new ArgumentNullException(nameof(injectionDatabaseService));
this.progressService = progressService ?? throw new ArgumentNullException(nameof(progressService));
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
Workspace = workspace ?? throw new ArgumentNullException(nameof(workspace));
Expand Down Expand Up @@ -131,38 +127,6 @@ private void EditorForm_Load(object sender, EventArgs e)

// Load settings
SettingsService.Load();

// Check for database update
if (SettingsService.CheckForDatabaseUpdatesOnStartup)
{
this.logger.LogInformation("Checking for injection database update.");

UiService.Dispatcher.InvokeAsync(async () =>
{
try
{
var update = await this.injectionDatabaseService.CheckForDatabaseUpdateAsync();
if (update is null)
{
this.logger.LogInformation("No injection database update found.");
return;
}

var result = UiService.ShowMessageBox("A new injection database is available. Download now?", "Database Update Available", MessageBoxButtons.YesNo);
if (result != DialogResult.Yes)
{
return;
}

await this.progressService.RunModalTaskAsync(progress => this.injectionDatabaseService.UpdateDatabaseAsync(update));
this.logger.LogInformation($"Injection database updates to version {update.DbVersion}.");
}
catch (Exception ex)
{
this.logger.LogError(ex, "Failed to check for injection database update.");
}
});
}
}

private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down
Loading