Tesses.VirtualFilesystem.Saf 1.0.0

dotnet add package Tesses.VirtualFilesystem.Saf --version 1.0.0                
NuGet\Install-Package Tesses.VirtualFilesystem.Saf -Version 1.0.0                
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="Tesses.VirtualFilesystem.Saf" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tesses.VirtualFilesystem.Saf --version 1.0.0                
#r "nuget: Tesses.VirtualFilesystem.Saf, 1.0.0"                
#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 Tesses.VirtualFilesystem.Saf as a Cake Addin
#addin nuget:?package=Tesses.VirtualFilesystem.Saf&version=1.0.0

// Install Tesses.VirtualFilesystem.Saf as a Cake Tool
#tool nuget:?package=Tesses.VirtualFilesystem.Saf&version=1.0.0                

Tesses.VirtualFilesystem.Saf

A library to use Tesses.VirtualFilesystem with Storage Access Framework (Android)

Nuget

License

GPL3-only Licensed under GPL3

How to use (not presistant)

   ...
   using Tesses.VirtualFilesystem;
   using Tesses.VirtualFilesystem.Filesystems;
   using Android.Content;
   using AndroidX.DocumentFile.Provider;
   using Tesses.VirtualFilesystem.Extensions;
   ...

   void SomeActivityFunction()
   {
        SAFFileSystem.RequestDirectory(this,true);
   }    
   protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent? data)
   {
        if(requestCode == SAFFileSystem.RequestCode && resultCode == Result.Ok)
        {
            var res=SAFFileSystem.GetSAFFromResponse(this,data);
            if(res != null)
                HandleFilesystem(res);
        }
   }
   void HandleFilesystem(SAFFileSystem fs)
   {
        fs.CreateDirectory(Special.Root/"My Special Folder");
        //read https://gitea.site.tesses.net/tesses50/tesses-vfs to get up to speed
        //root is relative to the folder the user chose
        //so get subdir filesystem is not needed
   }

How to use (presistant)

   ...
   using Tesses.VirtualFilesystem;
   using Tesses.VirtualFilesystem.Filesystems;
   using Android.Content;
   using AndroidX.DocumentFile.Provider;
   using Tesses.VirtualFilesystem.Extensions;
   ...
   const string MySAFKey = "MySafKey";
   void SomethingWithContext()
   {
       var res= SAFFileSystem.GetSAFFromSharedStorage(this,MySAFKey);
       if(res != null)
            HandleFilesystem(res);
   }
   void SomeActivityFunction()
   {
        var res= SAFFileSystem.GetSAFFromSharedStorage(this,MySAFKey);
       if(res != null)
            HandleFilesystem(res);
       else
            SAFFileSystem.RequestDirectory(this,true,true);
   }    
   protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent? data)
   {
        if(requestCode == SAFFileSystem.RequestCode && resultCode == Result.Ok)
        {
            var res=SAFFileSystem.GetSAFFromResponsePresistant(this,data,MySAFKey);
            if(res != null)
                HandleFilesystem(res);
        }
   }
   void HandleFilesystem(SAFFileSystem fs)
   {
        fs.CreateDirectory(Special.Root/"My Special Folder");
        //read https://gitea.site.tesses.net/tesses50/tesses-vfs to get up to speed
        //root is relative to the folder the user chose
        //so get subdir filesystem is not needed
   }

How to revoke permissions

   ...
   using Tesses.VirtualFilesystem;
   using Tesses.VirtualFilesystem.Filesystems;
   using Android.Content;
   using AndroidX.DocumentFile.Provider;
   using Tesses.VirtualFilesystem.Extensions;
   ...
   const string MySAFKey = "MySafKey";
    void SomethingWithContext()
    {
        SAFFileSystem.Revoke(this,MySAFKey);
    }
Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.0 95 7/22/2024