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: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
<PropertyGroup>
<LangVersion>latest</LangVersion>
<ImplicitUsings>true</ImplicitUsings>

<Copyright>Copyright © VictorBush 2021</Copyright>
<Version>0.7.0</Version>
</PropertyGroup>
</Project>
12 changes: 0 additions & 12 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
<Project>
<ItemGroup>
<PackageReference Update="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Update="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.3.242703" PrivateAssets="all" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Update="Microsoft.Windows.Compatibility" Version="6.0.0" />
<PackageReference Update="Moq" Version="4.13.1" />
<PackageReference Update="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Update="System.IO.Abstractions" Version="9.0.4" />
<PackageReference Update="System.IO.Abstractions.TestingHelpers" Version="9.0.4" />
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.5" />
</ItemGroup>
</Project>
20 changes: 20 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<!-- Enable central package management, https://learn.microsoft.com/en-us/nuget/consume-packages/Central-Package-Management -->
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="DockPanelSuite.ThemeVS2015" Version="3.1.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageVersion Include="System.IO.Abstractions" Version="22.0.14" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="22.0.14" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion NeFSedit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
README.md = README.md
SharedAssemblyInfo.cs = SharedAssemblyInfo.cs
TODO.md = TODO.md
Directory.Packages.props = Directory.Packages.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VictorBush.Ego.NefsLib", "VictorBush.Ego.NefsLib\VictorBush.Ego.NefsLib.csproj", "{C3A546A4-7C78-4FA2-98DD-D056858A57D9}"
Expand Down
18 changes: 0 additions & 18 deletions SharedAssemblyInfo.cs

This file was deleted.

23 changes: 0 additions & 23 deletions VictorBush.Ego.NefsEdit.Tests/Properties/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\VictorBush.Ego.NefsEdit\VictorBush.Ego.NefsEdit.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" />
<PackageReference Include="Moq" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" />
<PackageReference Include="xunit" />
Expand Down
23 changes: 0 additions & 23 deletions VictorBush.Ego.NefsEdit/Properties/AssemblyInfo.cs

This file was deleted.

6 changes: 2 additions & 4 deletions VictorBush.Ego.NefsEdit/Source/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal static class Program
/// <summary>
/// Gets the directory where the application exe is located.
/// </summary>
internal static string ExeDirectory => Path.GetDirectoryName(typeof(Program).Assembly.Location);
internal static string ExeDirectory => Application.StartupPath;

/// <summary>
/// Gets the directory used by the application for writing temporary files.
Expand Down Expand Up @@ -71,9 +71,7 @@ internal static void Main()
}).Build();

// Run application
Application.EnableVisualStyles();
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.SetCompatibleTextRenderingDefault(false);
ApplicationConfiguration.Initialize();
Application.Run(host.Services.GetRequiredService<EditorForm>());
}
}
7 changes: 6 additions & 1 deletion VictorBush.Ego.NefsEdit/Source/UI/BrowseAllForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ private void ItemsListView_SelectedIndexChanged(object sender, EventArgs e)

foreach (ListViewItem item in this.itemsListView.SelectedItems)
{
selectedNefsItems.Add((NefsItem)item.Tag);
if (item.Tag is not NefsItem nefsItem)
{
continue;
}

selectedNefsItems.Add(nefsItem);
}

// Tell the editor what items are selected
Expand Down
10 changes: 7 additions & 3 deletions VictorBush.Ego.NefsEdit/Source/UI/BrowseTreeForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ private void FilesListView_DoubleClick(object sender, EventArgs e)
{
if (this.filesListView.SelectedItems.Count > 0)
{
var item = (NefsItem)this.filesListView.SelectedItems[0].Tag;
if (item.Type == NefsItemType.Directory)
if (this.filesListView.SelectedItems[0].Tag is NefsItem { Type: NefsItemType.Directory } item)
{
OpenDirectory(item);
}
Expand Down Expand Up @@ -117,7 +116,12 @@ private void FilesListView_SelectedIndexChanged(object sender, EventArgs e)

foreach (ListViewItem item in this.filesListView.SelectedItems)
{
selectedNefsItems.Add((NefsItem)item.Tag);
if (item.Tag is not NefsItem nefsItem)
{
continue;
}

selectedNefsItems.Add(nefsItem);
}

// Tell the editor what items are selected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public bool ReplaceItemByDialog(NefsItem item)
return false;
}

var fileSize = FileSystem.FileInfo.FromFileName(fileName).Length;
var fileSize = FileSystem.FileInfo.New(fileName).Length;
var itemSize = new NefsItemSize((uint)fileSize);
var newDataSource = new NefsFileDataSource(fileName, 0, itemSize, false);
var cmd = new ReplaceFileCommand(item, item.DataSource, item.State, newDataSource);
Expand Down
32 changes: 10 additions & 22 deletions VictorBush.Ego.NefsEdit/VictorBush.Ego.NefsEdit.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<UseWpf>true</UseWpf>
<AssemblyName>NefsEdit</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<Nullable>enable</Nullable>

<Title>NeFS Edit</Title>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<CodeAnalysisRuleSet></CodeAnalysisRuleSet>
<DocumentationFile>bin\Debug\NefsEdit.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Update="Source\UI\TablessControl.cs">
<SubType>Component</SubType>
</Compile>
Expand All @@ -26,24 +23,15 @@
<ProjectReference Include="..\VictorBush.Ego.NefsLib\VictorBush.Ego.NefsLib.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging">
<Version>3.1.3</Version>
</PackageReference>
<PackageReference Include="Serilog.Extensions.Logging">
<Version>3.0.1</Version>
</PackageReference>
<PackageReference Include="Serilog.Sinks.Console">
<Version>3.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Serilog.Extensions.Logging" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="System.Data.DataSetExtensions" />
<PackageReference Include="System.IO.Abstractions" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" />
<PackageReference Include="DockPanelSuite.ThemeVS2015" Version="3.1.0" />
<PackageReference Include="Microsoft.Windows.Compatibility" />
<PackageReference Include="DockPanelSuite.ThemeVS2015" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\question.ico" />
</ItemGroup>
</Project>
</Project>
23 changes: 0 additions & 23 deletions VictorBush.Ego.NefsLib.Tests/Properties/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// See LICENSE.txt for license information.

using System.Text;
using VictorBush.Ego.NefsLib.IO;
using Xunit;

namespace VictorBush.Ego.NefsLib.Tests.IO;

public class LzssDecompressTests
{
[Fact]
public async Task Decompress_Test()
{
byte[] input = [
0xFF, 0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65, 0xFF, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D,
0x22, 0x31, 0xFF, 0x2E, 0x30, 0x22, 0x20, 0x73, 0x74, 0x61, 0x6E, 0xFF, 0x64, 0x61, 0x6C, 0x6F,
0x6E, 0x65, 0x3D, 0x27, 0xFF, 0x79, 0x65, 0x73, 0x27, 0x20, 0x3F, 0x3E, 0x0D, 0xFF, 0x0A, 0x3C,
0x53, 0x6B, 0x69, 0x70, 0x46, 0x72, 0xBF, 0x6F, 0x6E, 0x74, 0x45, 0x6E, 0x64, 0x14, 0x00, 0x09,
0xFF, 0x3C, 0x50, 0x61, 0x72, 0x61, 0x6D, 0x65, 0x74, 0xEF, 0x65, 0x72, 0x20, 0x6E, 0x2C, 0x00,
0x3D, 0x22, 0x73, 0xEE, 0x19, 0x00, 0x74, 0x6F, 0x67, 0x2C, 0x00, 0x22, 0x20, 0x76, 0x77, 0x61,
0x6C, 0x75, 0x36, 0x00, 0x74, 0x72, 0x75, 0x42, 0x00, 0x05, 0x2F, 0x14, 0x01, 0x2F, 0x18, 0x0A
];
var expectedBytes = Encoding.ASCII.GetBytes("""
<?xml version="1.0" standalone='yes' ?>
<SkipFrontEnd>
<Parameter name="skiptogame" value="true" />
</SkipFrontEnd>
""".ReplaceLineEndings("\r\n"));

using var inputStream = new MemoryStream(input);
var lzss = new LzssDecompress();

// Test
using var outputStream = new MemoryStream();
await lzss.DecompressAsync(inputStream, outputStream, CancellationToken.None)
.ConfigureAwait(false);

// Verify
var actualBytes = outputStream.ToArray();
Assert.Equal(expectedBytes, actualBytes);
}
}
Loading