Skip to content

DiGi.Core.IO

github-actions[bot] edited this page Jul 15, 2026 · 3 revisions

DiGi.Core.IO Namespace

Classes

Create Class

public static class Create

Inheritance System.Object → Create

Methods

Create.Archive<TSerializableObject>(this byte[]) Method

Creates an archive from the specified byte array.

public static DiGi.Core.IO.Classes.Archive<TSerializableObject>? Archive<TSerializableObject>(this byte[] bytes)
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

TSerializableObject

The type of the serializable object contained within the archive.

Parameters

bytes System.Byte[]

The byte array to create the archive from.

Returns

DiGi.Core.IO.Classes.Archive<TSerializableObject>
An Archive<TSerializableObject> instance if successful; otherwise, null.

Create.Archive<TSerializableObject>(this byte[], TSerializableObject) Method

Creates an archive from the specified byte array and extracts the associated serializable object.

public static DiGi.Core.IO.Interfaces.IArchive? Archive<TSerializableObject>(this byte[] bytes, out TSerializableObject? serializableObject)
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

TSerializableObject

The type of the serializable object to extract.

Parameters

bytes System.Byte[]

The byte array to create the archive from.

serializableObject TSerializableObject

When this method returns, contains the extracted serializable object, or null if extraction failed.

Returns

DiGi.Core.IO.Interfaces.IArchive
An DiGi.Core.IO.Interfaces.IArchive instance if successful; otherwise, null.

Create.FileFilter(string, string[]) Method

Creates a file filter with the specified name and allowed extensions.

public static DiGi.Core.IO.Classes.FileFilter FileFilter(string name, params string[] extensions);

Parameters

name System.String

The descriptive name of the filter.

extensions System.String[]

An array of allowed file extensions.

Returns

FileFilter
A FileFilter configured with the specified name and extensions.

Create.FileFilter_AllFiles() Method

Creates a file filter that includes all files.

public static DiGi.Core.IO.Classes.FileFilter FileFilter_AllFiles();

Returns

FileFilter
A FileFilter that matches all files.

Modify Class

public static class Modify

Inheritance System.Object → Modify

Methods

Modify.UpdateLine(string, int, string) Method

Updates a specific line in the file at the given path.

public static bool UpdateLine(string? path, int index, string? line);

Parameters

path System.String

The path to the file.

index System.Int32

The zero-based index of the line to update.

line System.String

The new content for the line.

Returns

System.Boolean
True if the update was successful; otherwise, false.

Modify.UpdateLines(string, Dictionary<int,string>) Method

Updates multiple lines in the file at the given path based on the provided dictionary of indices and content.

public static System.Collections.Generic.HashSet<int>? UpdateLines(string? path, System.Collections.Generic.Dictionary<int,string?>? lineDictionary);

Parameters

path System.String

The path to the file to be updated.

lineDictionary System.Collections.Generic.Dictionary<System.Int32,System.String>

A dictionary where keys are line indices and values are the new content for those lines.

Returns

System.Collections.Generic.HashSet<System.Int32>
A System.Collections.Generic.HashSet<> containing the indices of the lines that were successfully updated, or null if an error occurred.

Query Class

public static class Query

Inheritance System.Object → Query

Methods

Query.AbsolutePath(this string, string) Method

Combines a directory path and a relative path to create an absolute path.

public static string? AbsolutePath(this string? directory, string? relativePath);

Parameters

directory System.String

The base directory path.

relativePath System.String

The relative path to combine with the directory.

Returns

System.String
The resulting absolute path string.

Query.Deserialize<USerializableObject>(this IArchive) Method

Deserializes a USerializableObject from the specified archive.

public static USerializableObject? Deserialize<USerializableObject>(this DiGi.Core.IO.Interfaces.IArchive archive)
    where USerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

USerializableObject

The type of object to deserialize.

Parameters

archive DiGi.Core.IO.Interfaces.IArchive

The archive to deserialize from.

Returns

USerializableObject
The deserialized USerializableObject, or null if deserialization fails.

Query.Filter(FileFilter[]) Method

Joins multiple file filters into a pipe-separated string.

public static string? Filter(params DiGi.Core.IO.Classes.FileFilter[]? fileFilters);

Parameters

fileFilters FileFilter[]

The array of file filters to be joined.

Returns

System.String
A pipe-separated string containing the combined filters, or null if no filters are provided.

Query.IsPathFullyQualified(string) Method

Checks if a path is fully qualified (absolute).

public static bool IsPathFullyQualified(string? path);

Parameters

path System.String

The path to check.

Returns

System.Boolean
True if the path is fully qualified; otherwise, false.

Query.Lines(string, int) Method

Reads a specified number of lines from a file.

public static System.Collections.Generic.List<string>? Lines(string? path, int count);

Parameters

path System.String

The path to the file to read.

count System.Int32

The number of lines to read from the file.

Returns

System.Collections.Generic.List<System.String>
A list of strings containing the lines read, or null if the operation fails.

Query.Locked(this FileInfo) Method

Checks if a file is locked by another process.

public static bool Locked(this System.IO.FileInfo? fileInfo);

Parameters

fileInfo System.IO.FileInfo

The file information of the file to check.

Returns

System.Boolean
True if the file is locked; otherwise, false.

Query.RelativePath(string, string) Method

Calculates the relative path from one directory to another.

public static string? RelativePath(string? relativeTo, string? path);

Parameters

relativeTo System.String

The base directory to calculate the relative path from.

path System.String

The target path to make relative.

Returns

System.String
The calculated relative path, or null if it cannot be determined.

Query.Serialize(this ISerializableObject) Method

Serializes an ISerializableObject into an IArchive.

public static DiGi.Core.IO.Interfaces.IArchive? Serialize(this DiGi.Core.Interfaces.ISerializableObject serializableObject);

Parameters

serializableObject DiGi.Core.Interfaces.ISerializableObject

The object to be serialized.

Returns

DiGi.Core.IO.Interfaces.IArchive
An DiGi.Core.IO.Interfaces.IArchive containing the serialized data, or null if serialization fails.

Clone this wiki locally