generated from JustArchiNET/ASF-PluginTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comprehensive Update and Fixes for ASFFreeGames Plugin v1.5.1 #65
Conversation
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 commit modifies the GaussianRandom class to use Math instead of MathF and MemoryMarshal.Cast instead of BitConverter. This allows the plugin to be compatible with trimmed ASF binaries that do not include those methods. This also improves the performance by reducing the number of calls to Fill(bytes) from 2 to 1. This fixes the issue #46 (#46) that was reported.
…ZeroBytes specification This commit modifies the GaussianRandom class to use Interlocked.CompareExchange instead of a bool field to ensure thread-safety when accessing the stored value for the next Gaussian number. This commit also changes the GetNonZeroBytes method to use a Span<byte> parameter and a stack-allocated buffer to ensure that no zero bytes are generated, as required by the RandomNumberGenerator base class. Thus, the compliance and performance of the GaussianRandom class are improved.
…Box-Muller formula This commit modifies the GaussianRandom class to use the same logic as the C++ implementation of the Box-Muller formula that is shown on Wikipedia. This involves using a do-while loop to generate a non-zero uniform random number u1, and checking if it is greater than the smallest positive double value (double.Epsilon). This ensures that the logarithm and square root operations do not produce NaN or infinity values. This improves the robustness and accuracy of the GaussianRandom class.
This commit improves the GaussianRandom class to handle some edge cases. It does the following changes: - It uses 2 * sizeof(long) instead of 16 as the size of the byte span to avoid hard-coding the value and make it more readable. - It uses -2.0 instead of -2.0f as the coefficient of the logarithm in the Box-Muller formula to use double precision instead of float precision. - It adds a do-while loop to check if the generated random number is finite and not NaN or infinity, and repeats the generation if it is not. This prevents the NextGaussian method from returning invalid values.
- Upgraded target framework to .NET 8.0 to match ASF requirements. - Updated ASF submodule to the latest stable release. - Transitioned from Newtonsoft.Json to System.Text.Json for improved compatibility with ASF. - Refined GaussianRandom implementation to function with the latest trimmed ASF binary. - Enhanced RedditHelper to utilize System.Text.Json, improving JSON handling. - Modified GaussianRandom to utilize a more reliable RNG method compatible with ASF's trimmed version. - Various improvements and code cleanups in line with ASF's updated codebase.
…uration - Updated `Save` method to address potential issue with file size after writing JSON data. - Implemented option to set file size explicitly after writing using `fs.SetLength(fs.Position)`. This change prevents potential corruption in the saved configuration file by ensuring the correct size reflects the actual JSON content.
# Conflicts: # Directory.Build.props
- Included the version number for Microsoft.NET.Test.Sdk in Directory.Packages.props to align with project dependencies and resolve NU1010 build error.
- Changed the type of CollectIntervalManager from an interface to a concrete class in ASFFreeGamesPlugin. - Suppressed specific warnings in GetIPCommand to prevent compilation issues related to asynchronous calls and code analysis rules.
- Aligned DOTNET_SDK_VERSION with the upgraded project framework across CI, publish, and test integration workflows. - Ensured consistency in .NET versioning to facilitate correct environment setup for build and test processes.
- Deleted unnecessary debug log statements from the GetGames method.
- Simplified exception handling by removing redundant try-catch blocks. - Implemented retry logic with exponential backoff for fetching payload. - Streamlined JsonNode parsing and error handling for more robust operation.
maxisoft
changed the title
Comprehensive Update and Fixes for ASFFreeGames Plugin v1.5.x
Comprehensive Update and Fixes for ASFFreeGames Plugin v1.5.1
May 5, 2024
This was referenced May 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a series of enhancements and fixes that bring the ASFFreeGames plugin up to speed with the latest ASF version, improving stability and compatibility.
Changes:
Fixes:
This update addresses several critical issues reported by users:
System.MissingMethodException
encountered in previous versions (System.MissingMethodException: Attempted to access a missing method. #46).This update ensures that users will have a smoother and more reliable experience with the ASFFreeGames plugin.