Skip to content

Commit

Permalink
feat: add dedicated alternatives to GetMappedKeyOrInput
Browse files Browse the repository at this point in the history
  • Loading branch information
cengelha committed Aug 17, 2024
1 parent dcd4e07 commit ec5f8d7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ All notable changes to this project will be documented in this file. It uses the
[Keep a Changelog](http://keepachangelog.com/en/1.0.0/) principles and [Semantic Versioning](https://semver.org/)
since 1.0.0.

## Unreleased
## Unreleased (0.13.1)

### Known Issues
### Added
* New dedicated methods as alternative for `GetMappedKeyOrInput` which works in both directions
### Changed
### Deprecated
### Removed
Expand Down
36 changes: 36 additions & 0 deletions libNOM.map/Mapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,42 @@ public static string GetMappedKeyOrInput(string key, bool useAccount)
return key;
}

/// <inheritdoc cref="GetMappedKeyForDeobfuscationOrInput(string, bool)"/>
public static string GetMappedKeyForDeobfuscationOrInput(string key) => GetMappedKeyForDeobfuscationOrInput(key, false);

/// <summary>
/// Maps the specified key.
/// </summary>
/// <param name="key"></param>
/// <param name="useAccount"></param>
/// <returns>The deobfuscated key or the input if no mapping found.</returns>
public static string GetMappedKeyForDeobfuscationOrInput(string key, bool useAccount)
{
if (GetMapForDeobfuscation(useAccount).TryGetValue(key, out var resultFromDeobfuscation))
return resultFromDeobfuscation;

return key;
}

/// <inheritdoc cref="GetMappedKeyForObfuscationOrInput(string, bool)"/>
public static string GetMappedKeyForObfuscationOrInput(string key) => GetMappedKeyForObfuscationOrInput(key, false);

/// <summary>
/// Maps the specified key.
/// </summary>
/// <param name="key"></param>
/// <param name="useAccount"></param>
/// <returns>The obfuscated key or the input if no mapping found.</returns>
public static string GetMappedKeyForObfuscationOrInput(string key, bool useAccount)
{
if (GetMapForObfuscation(useAccount).TryGetValue(key, out var resultFromObfuscation))
return resultFromObfuscation;

return key;
}

// //

/// <inheritdoc cref="Deobfuscate(JToken, bool)"/>
public static HashSet<string> Deobfuscate(JToken node) => Deobfuscate(node, false);

Expand Down
2 changes: 1 addition & 1 deletion libNOM.map/libNOM.map.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<!-- Package -->
<PropertyGroup Label="General">
<Version>0.13.0</Version>
<Version>0.13.1-beta.1</Version>
<Authors>cengelha</Authors>
<Description>Provides obfuscation and deobfuscation of save files from the game No Man's Sky.</Description>
<Copyright>Copyright (c) Christian Engelhardt 2021</Copyright>
Expand Down

0 comments on commit ec5f8d7

Please sign in to comment.