Files
RobustToolbox/Robust.Shared/ContentPack/IContentRoot.cs
Tyler Young 0d52def877 Have RobustSerializer use a shared string dictionary (#1117)
* implements shared string dictionary and handshake from net-code-2

* fix unit test

switch to szr sawmill

* try to silence some warnings around ZipEntry

* rebase and use system zip instead of icsharplib

fix rebase artifacts

* Update Robust.Shared/Interfaces/GameObjects/IComponentFactory.cs

* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs

* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs

* Apply suggestions from code review

* Apply suggestions from code review

* Update Robust.Shared/Serialization/RobustSerializer.cs

* since no longer gathering from paths, make string splitting more robust

* make string gathering ignore strings under 4 chars long

make string gathering yet more robust

* add limit to size of mapped strings

* add more string data to feed into shared string dictionary from YAML files

add JSON importer but don't parse RSI metadata yet

fix typo that breaks nulls in MappedStringSerializer

minor refactoring

make string splitting more robust

add WriteUnsignedInt / ReadUnsignedInt for validating WriteCompressedUnsignedInt / ReadCompressedUnsignedInt aren't bogus

* comment out some log statements

* minor refactor, reorder logging

add null check due to smart typing NRT checks

* Add doc comments, readability improvements to MappedStringSerializer

The protocol, handshake, and internal logic are now more documented.

The main area that could still be improved is the documentation of how
the cache system works, but the code is readable enough for now that it
isn't immediately necessary.

* add documentation, organization

* update some more doc comments

* add flows to doc comment for NetworkInitialize

* more documentation and organization

* more docs

* instead of retrieving INetManager by IoC, assign when NetworkInitialize is invoked

* "document" the regex

* Update Robust.Shared/Network/NetManager.cs

* add missing check for LockMappedStrings

* Update Robust.Shared/Serialization/RobustSerializer.MappedStringSerializer.cs

Co-authored-by: ComicIronic <comicironic@gmail.com>

* change to warning instead of throw for unlocked string mapping

Co-authored-by: ComicIronic <comicironic@gmail.com>
2020-06-12 04:09:55 +02:00

44 lines
1.6 KiB
C#

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Robust.Shared.Utility;
namespace Robust.Shared.ContentPack
{
internal partial class ResourceManager
{
/// <summary>
/// Common interface for mounting various things in the VFS.
/// </summary>
protected interface IContentRoot
{
/// <summary>
/// Initializes the content root.
/// Throws an exception if the content root failed to mount.
/// </summary>
void Mount();
/// <summary>
/// Gets a file from the content root using the relative path.
/// </summary>
/// <param name="relPath">Relative path from the root directory.</param>
/// <param name="stream"></param>
/// <returns>A stream of the file loaded into memory.</returns>
bool TryGetFile(ResourcePath relPath, [NotNullWhen(true)] out Stream? stream);
/// <summary>
/// Recursively finds all files in a directory and all sub directories.
/// </summary>
/// <param name="path">Directory to search inside of.</param>
/// <returns>Enumeration of all relative file paths of the files found.</returns>
IEnumerable<ResourcePath> FindFiles(ResourcePath path);
/// <summary>
/// Recursively returns relative paths to resource files.
/// </summary>
/// <returns>Enumeration of all relative file paths.</returns>
IEnumerable<string> GetRelativeFilePaths();
}
}
}