-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure INI parser to support bethesda ini files (#535)
* Configure INI parser to support bethesda ini files. Configuration taken from Mutagen: https://github.com/Noggog/Mutagen/blob/369a0549fab90593cb130b3889f988228f8ecf98/Mutagen.Bethesda.Core/Archives/DI/GetArchiveIniListings.cs#L38-L46 * Add test for INI parsing
- Loading branch information
Showing
6 changed files
with
213 additions
and
1 deletion.
There are no files selected for viewing
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
120 changes: 120 additions & 0 deletions
120
tests/Games/NexusMods.Games.Generic.Tests/Assets/IniSamples/enblocal.ini
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,120 @@ | ||
keyWithoutSection="SomeString" | ||
|
||
[PROXY] | ||
EnableProxyLibrary=false | ||
InitProxyFunctions=true | ||
ProxyLibrary=other_d3d9.dll | ||
|
||
# hashtagcomment | ||
|
||
[EmptySection] | ||
|
||
[GLOBAL] | ||
emptyKey= | ||
duplicateKey=2 | ||
duplicateKey=3 | ||
UsePatchSpeedhackWithoutGraphics=false | ||
UseDefferedRendering=true | ||
IgnoreCreationKit=true | ||
IsEnderal=false | ||
|
||
[GLOBAL] | ||
duplicate=section | ||
|
||
[PERFORMANCE] | ||
SpeedHack=true | ||
EnableOcclusionCulling=true | ||
|
||
[MULTIGPU] | ||
DisableCloudsShadowInReflections=false | ||
|
||
[MEMORY] | ||
ExpandSystemMemoryX64=false | ||
ReduceSystemMemoryUsage=true | ||
DisableDriverMemoryManager=false | ||
DisablePreloadToVRAM=false | ||
EnableUnsafeMemoryHacks=false | ||
ReservedMemorySizeMb=64 | ||
VideoMemorySizeMb=2000 | ||
EnableCompression=false | ||
AutodetectVideoMemorySize=false | ||
|
||
[THREADS] | ||
DataSyncMode=0 | ||
PriorityMode=0 | ||
|
||
[MULTIHEAD] | ||
ForceVideoAdapterIndex=false | ||
VideoAdapterIndex=0 | ||
|
||
[WINDOW] | ||
ForceBorderless=false | ||
ForceBorderlessFullscreen=false | ||
|
||
[ENGINE] | ||
ForceAnisotropicFiltering=true | ||
MaxAnisotropy=16 | ||
ForceLodBias=false | ||
LodBias=0.0 | ||
AddDisplaySuperSamplingResolutions=false | ||
EnableVSync=false | ||
VSyncSkipNumFrames=0 | ||
|
||
[LIMITER] | ||
WaitBusyRenderer=false | ||
EnableFPSLimit=false | ||
FPSLimit=10.0 | ||
|
||
[INPUT] | ||
//shift | ||
KeyCombination=16 | ||
//f12 | ||
KeyUseEffect=123 | ||
//home | ||
KeyFPSLimit=36 | ||
//num / 106 | ||
KeyShowFPS=106 | ||
//print screen | ||
KeyScreenshot=44 | ||
//enter | ||
KeyEditor=13 | ||
//f4 | ||
KeyFreeVRAM=115 | ||
//B | ||
KeyBruteForce=66 | ||
|
||
[ADAPTIVEQUALITY] | ||
Enable=false | ||
Quality=1 | ||
DesiredFPS=20.0 | ||
|
||
[ANTIALIASING] | ||
EnableEdgeAA=false | ||
EnableTemporalAA=false | ||
EnableSubPixelAA=false | ||
|
||
[FIX] | ||
FixGameBugs=true | ||
FixParallaxBugs=true | ||
FixParallaxTerrain=false | ||
FixAliasedTextures=true | ||
IgnoreInventory=true | ||
FixTintGamma=true | ||
RemoveBlur=false | ||
RemoveRadialBlur=false | ||
FixSubSurfaceScattering=true | ||
FixSkyReflection=true | ||
FixCursorVisibility=true | ||
FixLag=false | ||
GenerateGrassNormals=true | ||
|
||
[LONGEXPOSURE] | ||
EnableLongExposureMode=false | ||
Time=1.0 | ||
BlendMax=0.0 | ||
|
||
[FILE] | ||
ScreenshotFormat=0 | ||
|
||
[GUI] | ||
HighResolutionScaling=true |
29 changes: 29 additions & 0 deletions
29
tests/Games/NexusMods.Games.Generic.Tests/IniParsingTests.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,29 @@ | ||
using FluentAssertions; | ||
using IniParser; | ||
using IniParser.Parser; | ||
using NexusMods.Games.Generic.FileAnalyzers; | ||
using NexusMods.Paths; | ||
using Xunit; | ||
|
||
namespace NexusMods.Games.FOMOD.Tests; | ||
|
||
public class IniParsingTests | ||
{ | ||
private readonly IFileSystem _fs; | ||
|
||
public IniParsingTests(IFileSystem fs) | ||
{ | ||
_fs = fs; | ||
} | ||
|
||
[Fact] | ||
public void ParseIniTest() | ||
{ | ||
var assetsPath = _fs.GetKnownPath(KnownPath.EntryDirectory).Combine("Assets"); | ||
var testIniPath = assetsPath.Combine("IniSamples/enblocal.ini"); | ||
var config = IniAnalzyer.Config; | ||
var parser = new FileIniDataParser(new IniDataParser(config)); | ||
var act = () => parser.ReadFile(testIniPath.ToString()); | ||
act.Should().NotThrow(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/Games/NexusMods.Games.Generic.Tests/NexusMods.Games.Generic.Tests.csproj
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,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\Games\NexusMods.Games.Generic\NexusMods.Games.Generic.csproj" /> | ||
<ProjectReference Include="..\NexusMods.Games.TestFramework\NexusMods.Games.TestFramework.csproj" /> | ||
</ItemGroup> | ||
|
||
|
||
<ItemGroup> | ||
<None Update="Assets\**"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
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,23 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using NexusMods.Common; | ||
using NexusMods.Games.TestFramework; | ||
using Xunit.DependencyInjection; | ||
using Xunit.DependencyInjection.Logging; | ||
|
||
namespace NexusMods.Games.Generic.Tests; | ||
|
||
public class Startup | ||
{ | ||
public void ConfigureServices(IServiceCollection container) | ||
{ | ||
container | ||
.AddDefaultServicesForTesting() | ||
.AddGenericGameSupport() | ||
.Validate(); | ||
} | ||
|
||
// ReSharper disable once UnusedMember.Global | ||
public void Configure(ILoggerFactory loggerFactory, ITestOutputHelperAccessor accessor) => | ||
loggerFactory.AddProvider(new XunitTestOutputLoggerProvider(accessor, delegate { return true;})); | ||
} |