FinalEngine.IO 2023.4.0-pre

This is a prerelease version of FinalEngine.IO.
dotnet add package FinalEngine.IO --version 2023.4.0-pre
NuGet\Install-Package FinalEngine.IO -Version 2023.4.0-pre
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FinalEngine.IO" Version="2023.4.0-pre" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FinalEngine.IO --version 2023.4.0-pre
#r "nuget: FinalEngine.IO, 2023.4.0-pre"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FinalEngine.IO as a Cake Addin
#addin nuget:?package=FinalEngine.IO&version=2023.4.0-pre&prerelease

// Install FinalEngine.IO as a Cake Tool
#tool nuget:?package=FinalEngine.IO&version=2023.4.0-pre&prerelease

FinalEngine.IO

FinalEngine IO is a core library that provides a file system abstraction API to Final Engine games. It also provides interfaces that can be implemented to add support to a different platform back-end (currently Final Engine uses the .NET 7.0 System.IO classes.

The package provides functions to create, open, read, write and destroy directories (and files).

Getting started

Below you'll find instructions on how to take advantage of this package. Please note that Final Engine is in active development and a full release is still underway.

Prerequisites

There are currently no prerequisites to use this package and it can be used as-is even outside of Final Engine for your file IO needs.

Usage

Once all dependencies have been resolved you can create the required FileSystem.

// Create the file system object.
// Note that there are other constructors that can be used to provide invocation classes to provide further ease of use in the case of a .NET update.
IFileSystem fileSystem = new FileSystem();

Okay, so that's not very interesting. However, now we can do things such as create directories and files.

if (!fileSystem.FileExists("file.txt"))
{
    fileSystem.DeleteFile("file.txt");
}

// Now we can create the file again and pass some data into it using a StreamWriter.
// The API is kept at a low-level to ensure the end-user can have complete control.
using (var stream = fileSystem.CreateFile("file.txt"))
{
    // The stream is given explicit read/write access.
    using (var writer = new StreamWriter(stream))
    {
        writer.WriteLine("Hello, World!");
    }
}

// Now we can read from the file and write it's contents to the console.
using (var stream = fileSystem.OpenFile("file.txt", FileAccessMode.Read))
{
    using (var reader = new StreamReader(stream))
    {
        var content = reader.ReadToEnd();
        Console.WriteLine(content);
    }
}

Additional documentation

  • Generally speaking, you should not need to implement your own IFileSystem as .NET that cares of everything behind the scenes.
  • You should use the IFileSystem interface when create a new ResourceLoader (see FinalEngine.Resources.
  • The examples shown in the code documentation are not yet up-to-date and say that the engines runtime will provide you with an IFileSystem, however, this is not the case and one should be created manually (likely through an IOC and dependency injection). This will be first by next quarterly release.

Feedback

Want to provide feedback? Perhaps you have a found a bug or wish to provide a feature request? Look no further!

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2023.4.0-pre 98 8/1/2023