aalekhm / IOLib_IdentifierLib

Unity app to test a custom IO & Identity Library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IOLib_IdentifierLib

Unity app to test IO & Identity Library.

In-Game screenshot

Here is the final in-game screenshot displaying the 'Player' data as 'Level', 'Health' & 'Position' that can be saved & loaded from disk.
Also, a Unique Identifier that is specific to the device and has the same ID on app launch & re-installs is displayed.

In-Game screenshot

Steps to build:

@ The Unity project is build with Unity 2019.4.16f1
@ Add the project to Unity by selecting the top level folder(referred to it as root in the following description).
@ Kindly switch the Build Settings to 'Android' via 'File -> Build Settings -> Platform (Android)'.
@ Switch to or double click the 'PlayerStatsScene' under Scenes, if not visible by default.


Library wrapper code can be found under:

IO Library : root/Assets/IO

@ IOWrapper.FastIO offers brute force RW(ReadAllBytes() & WriteAllBytes()) functionality on a specified file along with regular file checking operations like 'Exists()', 'Clear()', 'Rename()' & 'Delete()'.
@ Alternatively, it exposes 'OpenForRead()' & 'OpenForWrite()' that return 'FileInputStream' & 'FileOutputStream' respectively, for more specific low-level file RW operations.
@ Platform specific calls to the native library is done via an respective '...Impl' implementors that can be found under the 'Android'/'PC' folders.
@ The '...Impl' implementor acts as a bridge between Unity & Android(Java).

@ Encryption & Decryption is embedded inside IOWrapper.FastIO & can be turned on/off which is be passed in as a parameter to WriteAllBytes().
@ If a file is encrypted, the call to ReadAllBytes() will detect it automatically & perform the decryption accordingly. This is done via a specific custom header.
@ Since the idea is not have a brute force cryptology solution, simple X-OR encryption & decryption is adopted for ease of use and understanding on the native side.

@ Alternatively, calls to functions written in C++ exposed via a shared library(.so), can be found under root/Assets/Crypto.
@ root/Assets/Crypto/CryptoWrapper acts as a bridge between Unity & Android(C++) to encrypt/decrypt string literals.
@ This functionality is not used, but the native function calls are tested & are hidden under macro 'TEST_CRYPTOC' found in Player.LoadFromDisk().

Identity Library : root/Assets/Identity

@ IdentityWrapper.Identity class gets an Unique Identifier generated natively via the implementor specific to a platform.
@ On 'Android', the device BRAND, MANUFACTURER, MODEL, ANDROID_ID clubbed along with the Application Package Name is used to generate a Universally Unique Identifier(UUID).
@ Subsequent kill relaunches of the application & reinstall generate the same Identifier for a particular device.

Library Implementation:

@ The underlying library implementation can be found under 'root/ExternalLibrarySource'.
@ Each is a Android Gradle project & can be open via Android Studio.
@ All the classes and their functions are self documented as I have tried to use Class/Function names self explanatory wherever possible.
@ Additionally, the function intention is summarized in a multi-line comment found just above the function definitions.
@ Once built, the output library (.jar or .so) is copied automatically to the root/Assets/Plugins/Android folder.

About

Unity app to test a custom IO & Identity Library.


Languages

Language:ShaderLab 53.6%Language:C# 20.2%Language:Java 14.6%Language:HLSL 9.4%Language:CMake 1.2%Language:C++ 1.1%