FileAccessPlugin
Provides standardized methods for accessing both local file and url resources. Automatically handles searching local folders for assets.
About this mod Author’s original text
File Access Plugin
This unofficial TaleSpire plugin for providing a standardized method of accessing
both local and internet resources (files). Plugins that use this plugin for file
access will be able to access both local file resources and internet resources,
without having to have different code, just by specifying a local or internet
source. When using local files this plugin automatically searches plugin folders
and the common folder (if present) for content which means the parent plugin does
not need to worry about such details.
Change Log
1.7.2: Fixed bug with sort order
1.7.1: Hide File Not Found exception for URL based Exist unless diagnostics are on
1.7.0: Added ability to re-load the cache (needed by plugins that modify files)
1.6.0: Added Plugin namespace with related methods
1.5.3: Update to keyboard detection code
1.5.1: Improved diagnostics
1.5.1: Fixed bug with Find when using URL
1.4.1: Fix Talespire takedown bug
1.4.0: Added support for Assets folders used by CALP
1.3.1: Bug Fix: CacheSetting produces Null Exception Error
1.3.0: The SetCacheType method is marked as obsolete and does not do anything.
The cache setting is now controlled at the File Access Plugin level via
R2ModMan configuration setting. This prevents plugins from changing the
cache setting on each other.
1.3.0: Removed unnecessary log entries
1.2.3: Catalog returns bare info by default (usable in code) with option to return
extended infromation for logging purpose
1.2.1: Find returns full path if a full path source is provided
1.2.0: Supports direct path option
1.1.1: Better location of the plugins folder in case manual install was done.
1.1.0: Fixed issue with forced R2ModMan profile. Plugin now auto detects profile.
1.0.0: Initial release
Install
Install using R2ModMan or similar and reference the plugin DLL when building the
parent plugin. This gives access to the LordAshes.FileAccessPlugin namespace with
most of the file related functions under the sub-namespace File, some image loading
function under the sub-namepace Image and an assetBundle loader under the sub-namespace
of AssetBundle.
Usage
GetProtocol(string source)
Gets the protocol portion of the source. Empty string if the source is a local file or
the protocol poriton (e.g. http or https) if it is a URL.
The following sub-namespaces are available...
File
AppendAllText(string source, string content)
string ReadAllText(string source)
WriteAllText(string source, string content)
Functions for appending, reading and writing the contents of the source as a single string.
Note: When using a URL for the source, append and write functions perform an upload.
AppendAllLines(string source, string content)
string ReadAllLines(string source)
WriteAllLines(string source, string content)
Functions for appending, reading and writing the contents of the source as an string array
of lines. Each line is the source is an individual entry in the array.
Note: When using a URL for the source, append and write functions perform an upload.
byte ReadAllBytes(string source)
WriteAllBytes(string source, byte content)
Functions for reading and writing the contents of the source as an byte array.
Note: When using a URL for the source, append and write functions perform an upload.
bool Exists(source)
Determines if the source exists. For local files it must exists in the plugin directories
or the common folder. For URL the resource needs to exists at the give source.
string Find(source)
When the source is a local file, finds where the source is located. Returns a string array
of resources that match the given source using a "contains" concept. When using any of the
append, reaad or write functions from this plugin, it is not necessary to use Find because
the functions take care of that on their own. However, if using a different function to
access the file, the Find function can be used to obtain the complete file path and namepace
of the file.
string Catalog(Bool extendedData)
Returns
Install & use Install: follow the bundled instructions
- Unzip the archive from playbuff and read the bundled readme / instructions first.
- Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
- For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
- Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.
Install locations vary a lot between mods — the bundled readme is the most reliable guide.
Install these first, or the mod will not work: