-
Notifications
You must be signed in to change notification settings - Fork 0
DiGi.Core.IO
public static class CreateInheritance System.Object → Create
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;TSerializableObject
The type of the serializable object contained within the archive.
bytes System.Byte[]
The byte array to create the archive from.
DiGi.Core.IO.Classes.Archive<TSerializableObject>
An Archive<TSerializableObject> instance if successful; otherwise, null.
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;TSerializableObject
The type of the serializable object to extract.
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.
DiGi.Core.IO.Interfaces.IArchive
An DiGi.Core.IO.Interfaces.IArchive instance if successful; otherwise, null.
Creates a file filter with the specified name and allowed extensions.
public static DiGi.Core.IO.Classes.FileFilter FileFilter(string name, params string[] extensions);name System.String
The descriptive name of the filter.
extensions System.String[]
An array of allowed file extensions.
FileFilter
A FileFilter configured with the specified name and extensions.
Creates a file filter that includes all files.
public static DiGi.Core.IO.Classes.FileFilter FileFilter_AllFiles();FileFilter
A FileFilter that matches all files.
public static class ModifyInheritance System.Object → Modify
Updates a specific line in the file at the given path.
public static bool UpdateLine(string? path, int index, string? line);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.
System.Boolean
True if the update was successful; otherwise, false.
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);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.
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.
public static class QueryInheritance System.Object → Query
Combines a directory path and a relative path to create an absolute path.
public static string? AbsolutePath(this string? directory, string? relativePath);directory System.String
The base directory path.
relativePath System.String
The relative path to combine with the directory.
System.String
The resulting absolute path string.
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;USerializableObject
The type of object to deserialize.
archive DiGi.Core.IO.Interfaces.IArchive
The archive to deserialize from.
USerializableObject
The deserialized USerializableObject, or null if deserialization fails.
Joins multiple file filters into a pipe-separated string.
public static string? Filter(params DiGi.Core.IO.Classes.FileFilter[]? fileFilters);fileFilters FileFilter[]
The array of file filters to be joined.
System.String
A pipe-separated string containing the combined filters, or null if no filters are provided.
Checks if a path is fully qualified (absolute).
public static bool IsPathFullyQualified(string? path);path System.String
The path to check.
System.Boolean
True if the path is fully qualified; otherwise, false.
Reads a specified number of lines from a file.
public static System.Collections.Generic.List<string>? Lines(string? path, int count);path System.String
The path to the file to read.
count System.Int32
The number of lines to read from the file.
System.Collections.Generic.List<System.String>
A list of strings containing the lines read, or null if the operation fails.
Checks if a file is locked by another process.
public static bool Locked(this System.IO.FileInfo? fileInfo);fileInfo System.IO.FileInfo
The file information of the file to check.
System.Boolean
True if the file is locked; otherwise, false.
Calculates the relative path from one directory to another.
public static string? RelativePath(string? relativeTo, string? path);relativeTo System.String
The base directory to calculate the relative path from.
path System.String
The target path to make relative.
System.String
The calculated relative path, or null if it cannot be determined.
Serializes an ISerializableObject into an IArchive.
public static DiGi.Core.IO.Interfaces.IArchive? Serialize(this DiGi.Core.Interfaces.ISerializableObject serializableObject);serializableObject DiGi.Core.Interfaces.ISerializableObject
The object to be serialized.
DiGi.Core.IO.Interfaces.IArchive
An DiGi.Core.IO.Interfaces.IArchive containing the serialized data, or null if serialization fails.