Skip to content

DiGi.Core.IO.File.Classes

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

DiGi.Core.IO.File.Classes Namespace

Classes

File Class

Base class for files that support metadata and persistence via Zip archives.

public abstract class File : DiGi.Core.Classes.SerializableObject, DiGi.Core.IO.File.Interfaces.IFile, System.IDisposable

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → File

Derived
StorageFile<TSerializableObject>
ValueFile<TSerializableObject>
ValuesFile<TSerializableObject>

Implements DiGi.Core.IO.File.Interfaces.IFile, System.IDisposable

Constructors

File(File) Constructor

Initializes a new instance of the File class by cloning another file's metadata.

public File(DiGi.Core.IO.File.Classes.File? file);

Parameters

file File

The source file to clone metadata from.

File(string) Constructor

Initializes a new instance of the File class with the specified path.

public File(string? path);

Parameters

path System.String

The path to the file.

File(JsonObject) Constructor

Initializes a new instance of the File class from a JSON object.

public File(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing file data.

Properties

File.MetadataStorage Property

Gets the metadata storage of the file.

internal DiGi.Core.IO.Classes.MetadataStorage MetadataStorage { internal get; }

Property Value

DiGi.Core.IO.Classes.MetadataStorage

File.Path Property

Gets or sets the path of the file.

public string? Path { get; set; }

Property Value

System.String

Methods

File.Dispose() Method

Releases all resources used by the file.

public void Dispose();

Implements Dispose()

File.GetMetadata<TMetadata>() Method

Retrieves metadata of the specified type from the file's metadata storage.

public TMetadata? GetMetadata<TMetadata>()
    where TMetadata : DiGi.Core.IO.Interfaces.IMetadata;

Type parameters

TMetadata

The type of metadata to retrieve.

Returns

TMetadata
The metadata of type TMetadata if found; otherwise, null.

File.Open() Method

Opens the file using its current path.

public virtual bool Open();

Implements Open()

Returns

System.Boolean
True if the file was opened successfully; otherwise, false.

File.Open(string) Method

Opens the file from the specified path.

public bool Open(string? path);

Parameters

path System.String

The path of the file to open.

Implements Open(string)

Returns

System.Boolean
True if the file was opened successfully; otherwise, false.

File.Save() Method

Saves the file's metadata and updates its modification date.

public virtual bool Save();

Implements Save()

Returns

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

File.SaveAs(string) Method

Saves the file to the specified path.

public bool SaveAs(string? path);

Parameters

path System.String

The path where the file should be saved.

Implements SaveAs(string)

Returns

System.Boolean
True if the file was saved successfully; otherwise, false.

File.SetMetadata(IMetadata) Method

Sets a custom metadata object for the file.

public void SetMetadata(DiGi.Core.IO.Interfaces.IMetadata? metadata);

Parameters

metadata DiGi.Core.IO.Interfaces.IMetadata

The metadata object to set.

FileMetadata Class

Stores metadata for a file, including creation and modification dates, path, and type.

public class FileMetadata : DiGi.Core.Classes.GuidObject, DiGi.Core.IO.Interfaces.IMetadata, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Core.IO.Wrapper.Interfaces.IWrapperObject, DiGi.Core.IO.Interfaces.IIOObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectDiGi.Core.Classes.UniqueObjectDiGi.Core.Classes.GuidObject → FileMetadata

Implements DiGi.Core.IO.Interfaces.IMetadata, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Core.IO.Wrapper.Interfaces.IWrapperObject, DiGi.Core.IO.Interfaces.IIOObject

Constructors

FileMetadata(FileMetadata) Constructor

Initializes a new instance of the FileMetadata class by cloning another metadata object.

public FileMetadata(DiGi.Core.IO.File.Classes.FileMetadata? fileMetadata);

Parameters

fileMetadata FileMetadata

The source metadata object to clone.

FileMetadata(JsonObject) Constructor

Initializes a new instance of the FileMetadata class from a JSON object.

public FileMetadata(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object used to initialize the metadata.

FileMetadata(Type) Constructor

Initializes a new instance of the FileMetadata class with type.

public FileMetadata(System.Type? type);

Parameters

type System.Type

The type to be associated with this metadata.

FileMetadata(Type, string) Constructor

Initializes a new instance of the FileMetadata class with type and path.

public FileMetadata(System.Type? type, string? path);

Parameters

type System.Type

The type to be associated with this metadata.

path System.String

The file path to be associated with this metadata.

Properties

FileMetadata.Created Property

Gets the date and time when the file was created.

public System.DateTime Created { get; }

Property Value

System.DateTime

FileMetadata.Modified Property

Gets or sets the date and time when the file was last modified.

public System.DateTime Modified { get; set; }

Property Value

System.DateTime

FileMetadata.Path Property

Gets or sets the path of the file.

public string? Path { get; set; }

Property Value

System.String

FileMetadata.Type Property

Gets the full type name of the file.

public string? Type { get; }

Property Value

System.String

StorageFile Class

Represents a file used for storing and managing serializable objects.

public class StorageFile : DiGi.Core.IO.File.Classes.StorageFile<DiGi.Core.Interfaces.ISerializableObject>

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectFileDiGi.Core.IO.File.Classes.StorageFile<DiGi.Core.Interfaces.ISerializableObject> → StorageFile

Constructors

StorageFile(StorageFile) Constructor

Initializes a new instance of the StorageFile class from another storage file instance.

public StorageFile(DiGi.Core.IO.File.Classes.StorageFile? storageFile);

Parameters

storageFile StorageFile

The source storage file instance.

StorageFile(string) Constructor

Initializes a new instance of the StorageFile class using the specified file path.

public StorageFile(string? path);

Parameters

path System.String

The path to the storage file.

StorageFile(JsonObject) Constructor

Initializes a new instance of the StorageFile class from the provided JSON object.

public StorageFile(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to initialize the storage file from.

StorageFile<TSerializableObject> Class

Represents a file used for storing and managing serializable objects.

public class StorageFile<TSerializableObject> : DiGi.Core.IO.File.Classes.File, DiGi.Core.IO.File.Interfaces.IValuesFile<TSerializableObject>, DiGi.Core.IO.File.Interfaces.IValuesFile, DiGi.Core.IO.File.Interfaces.IFile, System.IDisposable
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject

Type parameters

TSerializableObject

The type of serializable object that this storage file manages.

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectFile → StorageFile<TSerializableObject>

Derived
StorageFile

Implements DiGi.Core.IO.File.Interfaces.IValuesFile<TSerializableObject>, DiGi.Core.IO.File.Interfaces.IValuesFile, DiGi.Core.IO.File.Interfaces.IFile, System.IDisposable

Constructors

StorageFile(StorageFile<TSerializableObject>) Constructor

Initializes a new instance of the StorageFile class from an existing typed storage file.

public StorageFile(DiGi.Core.IO.File.Classes.StorageFile<TSerializableObject>? storageFile);

Parameters

storageFile DiGi.Core.IO.File.Classes.StorageFile<TSerializableObject>

The existing typed storage file to initialize from.

StorageFile(string) Constructor

Initializes a new instance of the StorageFile class using the specified file path.

public StorageFile(string? path);

Parameters

path System.String

The system path to the storage file.

StorageFile(JsonObject) Constructor

Initializes a new instance of the StorageFile class from the provided JSON object.

public StorageFile(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object used to initialize the storage file.

Properties

StorageFile<TSerializableObject>.Count Property

Gets the total number of elements contained in the storage file.

public int Count { get; }

Property Value

System.Int32

StorageFile<TSerializableObject>.Values Property

Gets all stored values as a collection of serializable objects.

public System.Collections.Generic.IEnumerable<TSerializableObject?>? Values { get; set; }

Implements Values

Property Value

System.Collections.Generic.IEnumerable<TSerializableObject>

Methods

StorageFile<TSerializableObject>.AddValue(TSerializableObject) Method

Adds a serializable object to the storage and returns its unique reference.

public DiGi.Core.Classes.UniqueReference? AddValue(TSerializableObject? serializableObject);

Parameters

serializableObject TSerializableObject

The serializable object to be added to the storage.

Returns

DiGi.Core.Classes.UniqueReference
The unique reference of the added object, or null if the operation failed.

StorageFile<TSerializableObject>.Contains(UniqueReference) Method

Determines whether the storage contains an object associated with the specified unique reference.

public bool Contains(DiGi.Core.Classes.UniqueReference? uniqueReference);

Parameters

uniqueReference DiGi.Core.Classes.UniqueReference

The unique reference to check for.

Returns

System.Boolean
True if the storage contains an object associated with the specified unique reference; otherwise, false.

StorageFile<TSerializableObject>.GetUniqueReference(TSerializableObject) Method

Retrieves the unique reference for the specified serializable object.

public virtual DiGi.Core.Classes.UniqueReference? GetUniqueReference(TSerializableObject? serializableObject);

Parameters

serializableObject TSerializableObject

The serializable object to retrieve the reference for.

Returns

DiGi.Core.Classes.UniqueReference
The unique reference associated with the specified serializable object, or null.

StorageFile<TSerializableObject>.GetUniqueReferences() Method

Gets a set of all unique references stored in the file.

public System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>? GetUniqueReferences();

Returns

System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>
A hash set containing all unique references stored in the file, or null.

StorageFile<TSerializableObject>.GetValue(UniqueReference) Method

Retrieves the typed value associated with the specified unique reference.

public TSerializableObject? GetValue(DiGi.Core.Classes.UniqueReference? uniqueReference);

Parameters

uniqueReference DiGi.Core.Classes.UniqueReference

The unique reference to retrieve the value for.

Returns

TSerializableObject
The typed value associated with the specified unique reference, or null if not found.

StorageFile<TSerializableObject>.GetValue(Nullable<int>) Method

Retrieves the typed object at the specified index.

public TSerializableObject? GetValue(System.Nullable<int> index);

Parameters

index System.Nullable<System.Int32>

The index of the object to retrieve.

Returns

TSerializableObject
The typed object at the specified index, or null if not found.

StorageFile<TSerializableObject>.GetValue<USerializableObject>(UniqueReference) Method

Retrieves the base serializable object associated with the specified unique reference.

public USerializableObject? GetValue<USerializableObject>(DiGi.Core.Classes.UniqueReference? uniqueReference)
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of the serializable object.

Parameters

uniqueReference DiGi.Core.Classes.UniqueReference

The unique reference to retrieve the value for.

Returns

USerializableObject
The base serializable object associated with the specified unique reference, or null if not found.

StorageFile<TSerializableObject>.GetValue<USerializableObject>(int) Method

Retrieves the object at the specified index.

public USerializableObject? GetValue<USerializableObject>(int index)
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of serializable object to retrieve.

Parameters

index System.Int32

The index of the object to retrieve.

Returns

USerializableObject
The object at the specified index, or null if not found.

StorageFile<TSerializableObject>.GetValues(IEnumerable<UniqueReference>) Method

Retrieves a typed collection of objects associated with the provided set of unique references.

public System.Collections.Generic.IEnumerable<TSerializableObject?>? GetValues(System.Collections.Generic.IEnumerable<DiGi.Core.Classes.UniqueReference>? uniqueReferences);

Parameters

uniqueReferences System.Collections.Generic.IEnumerable<DiGi.Core.Classes.UniqueReference>

The collection of unique references to retrieve values for.

Returns

System.Collections.Generic.IEnumerable<TSerializableObject>
A collection of typed objects associated with the provided unique references, or null if not available.

StorageFile<TSerializableObject>.GetValues(IEnumerable<int>) Method

Retrieves a typed collection of objects at the specified indices.

public System.Collections.Generic.IEnumerable<TSerializableObject?>? GetValues(System.Collections.Generic.IEnumerable<int>? indexes);

Parameters

indexes System.Collections.Generic.IEnumerable<System.Int32>

The collection of indices for which to retrieve values.

Returns

System.Collections.Generic.IEnumerable<TSerializableObject>
A collection of typed objects corresponding to the provided indices, or null if not available.

StorageFile<TSerializableObject>.GetValues<USerializableObject>() Method

Retrieves all stored objects as a collection.

public System.Collections.Generic.IEnumerable<USerializableObject?>? GetValues<USerializableObject>()
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of serializable objects being retrieved.

Returns

System.Collections.Generic.IEnumerable<USerializableObject>
A collection of all stored objects, or null if the collection is empty.

StorageFile<TSerializableObject>.GetValues<USerializableObject>(IEnumerable<UniqueReference>) Method

Retrieves a collection of objects associated with the provided set of unique references.

public System.Collections.Generic.IEnumerable<USerializableObject?>? GetValues<USerializableObject>(System.Collections.Generic.IEnumerable<DiGi.Core.Classes.UniqueReference>? uniqueReferences)
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of serializable object to retrieve.

Parameters

uniqueReferences System.Collections.Generic.IEnumerable<DiGi.Core.Classes.UniqueReference>

The collection of unique references to retrieve values for.

Returns

System.Collections.Generic.IEnumerable<USerializableObject>
A collection of objects associated with the provided unique references, or null if not available.

StorageFile<TSerializableObject>.GetValues<USerializableObject>(IEnumerable<int>) Method

Retrieves a collection of objects at the specified indices.

public System.Collections.Generic.IEnumerable<USerializableObject?>? GetValues<USerializableObject>(System.Collections.Generic.IEnumerable<int>? indexes)
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of serializable objects being retrieved.

Parameters

indexes System.Collections.Generic.IEnumerable<System.Int32>

The collection of indices to retrieve objects from.

Returns

System.Collections.Generic.IEnumerable<USerializableObject>
A collection of objects found at the specified indices, or null if no objects were found.

StorageFile<TSerializableObject>.Open() Method

Opens the storage file for reading and writing.

public override bool Open();

Implements Open()

Returns

System.Boolean
True if the storage file was opened successfully; otherwise, false.

StorageFile<TSerializableObject>.Remove(UniqueReference) Method

Removes the object associated with the specified unique reference.

public bool Remove(DiGi.Core.Classes.UniqueReference? uniqueReference);

Parameters

uniqueReference DiGi.Core.Classes.UniqueReference

The unique reference of the object to remove.

Returns

System.Boolean
True if the object was successfully removed; otherwise, false.

StorageFile<TSerializableObject>.Remove(IEnumerable<UniqueReference>) Method

Removes all objects associated with the provided set of unique references.

public System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>? Remove(System.Collections.Generic.IEnumerable<DiGi.Core.Classes.UniqueReference>? uniqueReferences);

Parameters

uniqueReferences System.Collections.Generic.IEnumerable<DiGi.Core.Classes.UniqueReference>

The collection of unique references to be removed.

Returns

System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>
A HashSet containing the unique references that were successfully removed, or null if no objects were removed.

StorageFile<TSerializableObject>.RemoveAll<USerializableObject>(Func<USerializableObject,bool>) Method

Removes all objects that satisfy the specified condition and returns their references.

public System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>? RemoveAll<USerializableObject>(System.Func<USerializableObject?,bool>? func)
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of the serializable objects being evaluated.

Parameters

func System.Func<USerializableObject,System.Boolean>

A predicate function to determine which objects to remove.

Returns

System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>
A set containing the unique references of all removed objects, or null if no objects were removed.

StorageFile<TSerializableObject>.RemoveFirst<USerializableObject>(Func<USerializableObject,bool>) Method

Removes the first object that satisfies the specified condition and returns its reference.

public DiGi.Core.Classes.UniqueReference? RemoveFirst<USerializableObject>(System.Func<USerializableObject?,bool>? func)
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of the serializable objects being evaluated.

Parameters

func System.Func<USerializableObject,System.Boolean>

A predicate function to determine which object to remove.

Returns

DiGi.Core.Classes.UniqueReference
The unique reference of the removed object, or null if no object satisfied the condition.

StorageFile<TSerializableObject>.Save() Method

Saves the current state of the storage file to disk.

public override bool Save();

Implements Save()

Returns

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

StorageFile<TSerializableObject>.TryGetValue(UniqueReference, TSerializableObject) Method

Attempts to retrieve a typed value for the specified unique reference.

public bool TryGetValue(DiGi.Core.Classes.UniqueReference? uniqueReference, out TSerializableObject? serializableObject);

Parameters

uniqueReference DiGi.Core.Classes.UniqueReference

The unique reference of the object to retrieve.

serializableObject TSerializableObject

When this method returns, contains the retrieved object if successful; otherwise, null.

Returns

System.Boolean
True if the object was successfully retrieved; otherwise, false.

StorageFile<TSerializableObject>.TryGetValue(int, TSerializableObject) Method

Attempts to retrieve a typed value at the specified index.

public bool TryGetValue(int index, out TSerializableObject? serializableObject);

Parameters

index System.Int32

The zero-based index of the element to get.

serializableObject TSerializableObject

When this method returns, contains the object corresponding to the specified index, if found; otherwise, null.

Returns

System.Boolean
True if the element exists at the specified index; otherwise, false.

StorageFile<TSerializableObject>.TryGetValue<USerializableObject>(UniqueReference, USerializableObject) Method

Attempts to retrieve a base serializable object for the specified unique reference.

public bool TryGetValue<USerializableObject>(DiGi.Core.Classes.UniqueReference? uniqueReference, out USerializableObject? serializableObject)
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of the serializable object.

Parameters

uniqueReference DiGi.Core.Classes.UniqueReference

The unique reference of the object to retrieve.

serializableObject USerializableObject

When this method returns, contains the retrieved object if successful; otherwise, null.

Returns

System.Boolean
True if the object was successfully retrieved; otherwise, false.

StorageFile<TSerializableObject>.TryGetValue<USerializableObject>(Nullable<int>, USerializableObject) Method

Attempts to retrieve a base serializable object at the specified index.

public bool TryGetValue<USerializableObject>(System.Nullable<int> index, out USerializableObject? serializableObject)
    where USerializableObject : TSerializableObject;

Type parameters

USerializableObject

The type of the serializable object.

Parameters

index System.Nullable<System.Int32>

The zero-based index of the element to get.

serializableObject USerializableObject

When this method returns, contains the object corresponding to the specified index, if found; otherwise, null.

Returns

System.Boolean
True if the element exists at the specified index; otherwise, false.

ValueFile Class

Represents a file that stores a single value.

public class ValueFile : DiGi.Core.IO.File.Classes.ValueFile<DiGi.Core.Interfaces.ISerializableObject>

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectFileDiGi.Core.IO.File.Classes.ValueFile<DiGi.Core.Interfaces.ISerializableObject> → ValueFile

Constructors

ValueFile(ValueFile) Constructor

Initializes a new instance of the ValueFile class from an existing non-generic value file.

public ValueFile(DiGi.Core.IO.File.Classes.ValueFile? valueFile);

Parameters

valueFile ValueFile

The existing non-generic value file to initialize from.

ValueFile(string) Constructor

Initializes a new instance of the ValueFile class using the specified file path.

public ValueFile(string? path);

Parameters

path System.String

The path to the value file.

ValueFile(JsonObject) Constructor

Initializes a new instance of the ValueFile class from the provided JSON object.

public ValueFile(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to initialize the value file from.

ValueFile<TSerializableObject> Class

Represents a file that stores a single value.

public class ValueFile<TSerializableObject> : DiGi.Core.IO.File.Classes.File, DiGi.Core.IO.File.Interfaces.IValueFile<TSerializableObject>, DiGi.Core.IO.File.Interfaces.IValueFile, DiGi.Core.IO.File.Interfaces.IFile, System.IDisposable
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject

Type parameters

TSerializableObject

The type of the serializable object stored in the file.

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectFile → ValueFile<TSerializableObject>

Derived
ValueFile

Implements DiGi.Core.IO.File.Interfaces.IValueFile<TSerializableObject>, DiGi.Core.IO.File.Interfaces.IValueFile, DiGi.Core.IO.File.Interfaces.IFile, System.IDisposable

Constructors

ValueFile(ValueFile<TSerializableObject>) Constructor

Initializes a new instance of the ValueFile class from an existing generic value file.

public ValueFile(DiGi.Core.IO.File.Classes.ValueFile<TSerializableObject>? valueFile);

Parameters

valueFile DiGi.Core.IO.File.Classes.ValueFile<TSerializableObject>

The existing generic value file to initialize from.

ValueFile(string) Constructor

Initializes a new instance of the ValueFile class using the specified file path.

public ValueFile(string? path);

Parameters

path System.String

The path to the value file.

ValueFile(JsonObject) Constructor

Initializes a new instance of the ValueFile class from the provided JSON object.

public ValueFile(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to initialize from.

Properties

ValueFile<TSerializableObject>.Value Property

Gets or sets the value stored within the file.

public TSerializableObject? Value { get; set; }

Implements Value

Property Value

TSerializableObject

Methods

ValueFile<TSerializableObject>.Open() Method

Opens the file and loads its content into memory.

public override bool Open();

Implements Open()

Returns

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

ValueFile<TSerializableObject>.Save() Method

Saves the current state of the object to the file.

public override bool Save();

Implements Save()

Returns

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

Operators

ValueFile<TSerializableObject>.explicit operator TSerializableObject(ValueFile<TSerializableObject>) Operator

Explicitly converts a ValueFile<TSerializableObject> to its contained value of type TSerializableObject.

public static TSerializableObject? explicit operator TSerializableObject?(DiGi.Core.IO.File.Classes.ValueFile<TSerializableObject>? valueFile);

Parameters

valueFile DiGi.Core.IO.File.Classes.ValueFile<TSerializableObject>

The value file to convert.

Returns

TSerializableObject
The contained value, or the default value if the file is null.

ValuesFile Class

Represents a file that stores a collection of values.

public class ValuesFile : DiGi.Core.IO.File.Classes.ValuesFile<DiGi.Core.Interfaces.ISerializableObject>

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectFileDiGi.Core.IO.File.Classes.ValuesFile<DiGi.Core.Interfaces.ISerializableObject> → ValuesFile

Constructors

ValuesFile(ValuesFile) Constructor

Initializes a new instance of the ValuesFile class from an existing non-generic values file.

public ValuesFile(DiGi.Core.IO.File.Classes.ValuesFile? valuesFile);

Parameters

valuesFile ValuesFile

The existing non-generic values file to initialize from.

ValuesFile(string) Constructor

Initializes a new instance of the ValuesFile class using the specified file path.

public ValuesFile(string? path);

Parameters

path System.String

The path to the values file.

ValuesFile(JsonObject) Constructor

Initializes a new instance of the ValuesFile class from the provided JSON object.

public ValuesFile(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to initialize from.

ValuesFile<TSerializableObject> Class

Represents a file that stores a collection of values.

public class ValuesFile<TSerializableObject> : DiGi.Core.IO.File.Classes.File, DiGi.Core.IO.File.Interfaces.IValuesFile<TSerializableObject>, DiGi.Core.IO.File.Interfaces.IValuesFile, DiGi.Core.IO.File.Interfaces.IFile, System.IDisposable
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject

Type parameters

TSerializableObject

The type of the serializable object stored in the file.

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectFile → ValuesFile<TSerializableObject>

Derived
ValuesFile

Implements DiGi.Core.IO.File.Interfaces.IValuesFile<TSerializableObject>, DiGi.Core.IO.File.Interfaces.IValuesFile, DiGi.Core.IO.File.Interfaces.IFile, System.IDisposable

Constructors

ValuesFile(ValuesFile<TSerializableObject>) Constructor

Initializes a new instance of the ValuesFile class from an existing generic values file.

public ValuesFile(DiGi.Core.IO.File.Classes.ValuesFile<TSerializableObject>? valuesFile);

Parameters

valuesFile DiGi.Core.IO.File.Classes.ValuesFile<TSerializableObject>

The existing generic values file to initialize from.

ValuesFile(string) Constructor

Initializes a new instance of the ValuesFile class using the specified file path.

public ValuesFile(string? path);

Parameters

path System.String

The path to the values file.

ValuesFile(JsonObject) Constructor

Initializes a new instance of the ValuesFile class from the provided JSON object.

public ValuesFile(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to initialize from.

Properties

ValuesFile<TSerializableObject>.Values Property

Gets or sets the collection of values stored within the file.

public System.Collections.Generic.IEnumerable<TSerializableObject?>? Values { get; set; }

Implements Values

Property Value

System.Collections.Generic.IEnumerable<TSerializableObject>

Methods

ValuesFile<TSerializableObject>.Open() Method

Opens the file and loads its content into memory.

public override bool Open();

Implements Open()

Returns

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

ValuesFile<TSerializableObject>.Save() Method

Saves the current state of the object to the file.

public override bool Save();

Implements Save()

Returns

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

Clone this wiki locally