gpvigano / AsImpL

Asynchronous Importer and run-time Loader for Unity
MIT License
212 stars 37 forks source link

Refactor filesystem access to allow extension #45

Closed NoTuxNoBux closed 3 years ago

NoTuxNoBux commented 3 years ago

This extracts an IFilesystem and a FileFilesystem using the current implementation.

I needed to be able to listen to filesystem and web access for debugging purposes as well as to collect what AsImpL is accessing during loading. Since everything uses static calls to the .NET and Unity APIs, this is currently impossible. Extension is not possible either because the methods are private (but would be a poor choice anyway).

Functionally this is the same as it was before.

I'm not too fond of introducing static properties, but I wanted to make these changes as minimally invasive as possible. The ideal solution would be constructor injection and non-static use, but I understand that this can be problematic with MonoBehaviours in Unity, so this is the next best thing to have some extensibility, I guess.