Class VirtualTextFormatter
Utility class for generating text-based representations of the virtual storage's tree structure. Provides static methods for generating various debug texts.
Inherited Members
Namespace: AkiraNetwork.VirtualStorageLibrary.Utilities
Assembly: VirtualStorageLibrary.dll
Syntax
public static class VirtualTextFormatter
Remarks
This class distinguishes between full-width and half-width characters based on specific character code ranges. The following ranges are considered full-width characters:
- 0x1100 to 0x115F: Korean Hangul Jamo characters
- 0x2E80 to 0xA4CF (excluding 0x303F): CJK Unified Ideographs and compatibility characters
- 0xAC00 to 0xD7A3: Korean Hangul syllables
- 0xF900 to 0xFAFF: CJK compatibility ideographs
- 0xFE10 to 0xFE19: Vertical forms punctuation
- 0xFE30 to 0xFE6F: CJK compatibility forms
- 0xFF00 to 0xFF60: Full-width ASCII and symbols
- 0xFFE0 to 0xFFE6: Full-width special symbols
The distinction between full-width and half-width characters is important for ensuring proper alignment and formatting in text-based representations, especially when working with mixed-language data or presenting data in a tabular format. This classification helps in correctly calculating string widths and aligning elements in debug text outputs, such as file paths or tabular data, where accurate spacing is crucial.
Methods
GenerateLinkTableDebugText<T>(VirtualStorage<T>)
Generates and returns a table representation of symbolic link information.
Declaration
public static string GenerateLinkTableDebugText<T>(this VirtualStorage<T> vs)
Parameters
Type | Name | Description |
---|---|---|
VirtualStorage<T> | vs | The instance of the virtual storage. |
Returns
Type | Description |
---|---|
string | The generated debug text of the link table. |
Type Parameters
Name | Description |
---|---|
T | The type of data in the storage. |
GenerateSingleTableDebugText<T>(T)
Generates and returns a table representation of a single object's properties.
Declaration
public static string GenerateSingleTableDebugText<T>(this T singleObject)
Parameters
Type | Name | Description |
---|---|---|
T | singleObject | The object to be represented. |
Returns
Type | Description |
---|---|
string | The generated debug text of the table. |
Type Parameters
Name | Description |
---|---|
T | The type of the object. |
GenerateTableDebugText<T>(IEnumerable<T>)
Generates and returns a table representation of the collection's contents.
Declaration
public static string GenerateTableDebugText<T>(this IEnumerable<T> enumerableObject)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | enumerableObject | The collection to be represented. |
Returns
Type | Description |
---|---|
string | The generated debug text of the table. |
Type Parameters
Name | Description |
---|---|
T | The type of objects in the collection. |
GenerateTreeDebugText<T>(VirtualStorage<T>, VirtualPath, bool, bool)
Generates and returns a text-based representation of the virtual storage tree structure.
Declaration
public static string GenerateTreeDebugText<T>(this VirtualStorage<T> vs, VirtualPath basePath, bool recursive = true, bool followLinks = false)
Parameters
Type | Name | Description |
---|---|---|
VirtualStorage<T> | vs | The instance of the virtual storage. |
VirtualPath | basePath | The base path from which to start. |
bool | recursive | Whether to list subdirectories recursively. |
bool | followLinks | Whether to follow symbolic links. |
Returns
Type | Description |
---|---|
string | The generated debug text of the tree structure. |
Type Parameters
Name | Description |
---|---|
T | The type of data in the storage. |
Remarks
The generated text represents the tree structure starting from the specified base path. Each node is represented by the result of the ToString method overridden in the specific derived class of the node.
When `recursive` is true, subdirectories are listed recursively. If false, subdirectories are not included in the output.
When `followLinks` is true, symbolic links are replaced with their target paths in the output. If false, the symbolic links themselves are displayed.
The output format includes indents and special characters to denote directory hierarchies and symbolic links. Example:
/
├dir1/
│├subdir1/
││└item3
│└item2
├link-to-dir -> /dir1
├item1
└link-to-item -> /item1