Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fronkongames/gamework-local-data
Async load / save local data with compression, encryption and integrity check.
https://github.com/fronkongames/gamework-local-data
compression encryption game-development gamedev gamedev-framework gamedev-library gamedevelopment serialization unity unity3d
Last synced: about 2 months ago
JSON representation
Async load / save local data with compression, encryption and integrity check.
- Host: GitHub
- URL: https://github.com/fronkongames/gamework-local-data
- Owner: FronkonGames
- License: mit
- Created: 2022-06-04T18:45:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-13T20:54:16.000Z (over 2 years ago)
- Last Synced: 2023-03-05T22:23:11.492Z (almost 2 years ago)
- Topics: compression, encryption, game-development, gamedev, gamedev-framework, gamedev-library, gamedevelopment, serialization, unity, unity3d
- Language: C#
- Homepage:
- Size: 2.19 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Async Load/Save Local Data With Compression, Encryption And Integrity Check
'**Local Data**' is a module of '**Game:Work**' dedicated to read and write local files asynchronously.
## Features 🎇
* Fully asynchronous read, load and cancel.
* Integrity check using MD5, SHA-1, SHA-256 or SHA-512 algorithms.
* Compression / decompression using algorithms: GZip, Zip or Brotli.
* Encryption / decryption using algorithms: AES, DES, RC2, DES or TripleDES.
* Supports typical Unity data such as: Vector, Quaternion, Color, etc.## Requisites 🔧
- Unity 2020.3 or higher.
- [Game:Work Core](https://github.com/FronkonGames/GameWork-Core).
- [Game:Work Foundation](https://github.com/FronkonGames/GameWork-Foundation).
- Test Framework 1.1.31 or higher.## Installation 📦️
### Editing your 'manifest.json'
- Open the manifest.json file of your Unity project.
- In the section "dependencies" add:```c#
{
...
"dependencies":
{
...
"FronkonGames.GameWork.Modules.LocalData": "git+https://github.com/FronkonGames/GameWork-Local-Data.git",
"FronkonGames.GameWork.Core": "git+https://github.com/FronkonGames/GameWork-Core.git",
"FronkonGames.GameWork.Foundation": "git+https://github.com/FronkonGames/GameWork-Foundation.git"
}
...
}
```### Git
First clone the dependencies inside your Assets folder:
```
git clone https://github.com/FronkonGames/GameWork-Foundation.gitgit clone https://github.com/FronkonGames/GameWork-Core.git
```Then clone the repository:
```
git clone https://github.com/FronkonGames/GameWork-Local-Data.git
```## Use 🚀
Create a class inheriting from ILocalData and add the attribute _Serializable_:
```c#
[Serializable]
public class MyLocalData : ILocalData
{
public string Signature => "MySignature";
public string playerName = "Guybrush Threepwood";
public Vector3 position = new(0.0f, -10.0f, 0.0f);
}
```To serialize it in the file '_Guy.brush_':
```c#
localDataModule.Write(myLocalData, "Guy.brush", null, (result) =>
{
if (result == FileResult.Ok)
Debug.Log("Guybrush Threepwood saved!");
else
Debug.Error($"{result} writing 'Guy.brush'.");
});
```To deserialise the file '_Guy.brush_' into an object:
```c#
MyLocalData myLocaldata = null;localDataModule.Read("Guy.brush", null, (result, file) =>
{
if (result == FileResult.Ok)
myLocalData = file;
else
Debug.Error($"{result} reading 'Guy.brush'.");
});
```## License 📜
Code released under [MIT License](https://github.com/FronkonGames/GameWork-Scene-Module/blob/main/LICENSE).