Skip to content

Commit

Permalink
add strict mode for excel sheets, version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAdam committed May 23, 2020
1 parent 2081c1a commit efcc271
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Lumina/Excel/ExcelSheetImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ExcelSheetImpl( ExcelHeaderFile headerFile, string name, Language request

public Language RequestedLanguage { get; protected set; }

protected readonly Lumina _Lumina;
internal readonly Lumina _Lumina;

protected string GenerateFilePath( string name, uint startId, Language language )
{
Expand Down
5 changes: 5 additions & 0 deletions Lumina/Excel/RowParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ private T ReadField< T >( ExcelColumnDataType type )
throw new ArgumentOutOfRangeException( "type", $"invalid excel column type: {type}" );
}

if( _Sheet._Lumina.Options.ExcelSheetStrictCastingEnabled )
{
return (T)data;
}

if( data is T castedData )
{
return castedData;
Expand Down
2 changes: 1 addition & 1 deletion Lumina/Lumina.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageProjectUrl>https://github.com/NotAdam/Lumina</PackageProjectUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryUrl>https://github.com/NotAdam/Lumina</RepositoryUrl>
<PackageVersion>1.1.2</PackageVersion>
<PackageVersion>1.1.3</PackageVersion>
<Description>Lumina is a small, performant and simple library for interacting with FINAL FANTASY XIV game data.</Description>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand Down
5 changes: 5 additions & 0 deletions Lumina/LuminaOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ public class LuminaOptions
/// which do not define a column checksum.
/// </summary>
public bool PanicOnSheetChecksumMismatch { get; set; } = true;

/// <summary>
/// If enabled, if a cast fails in an excel sheet, an InvalidCastException will be thrown instead of the types default value being inserted instead.
/// </summary>
public bool ExcelSheetStrictCastingEnabled { get; set; } = false;
}
}

0 comments on commit efcc271

Please sign in to comment.