Class Archive
- Namespace
- Cobilas.GodotEngine.Utility.IO
- Assembly
- com.cobilas.godot.utility.dll
Represents a system file.
public class Archive : DataBase, IDisposable, IFormattable
- Inheritance
-
Archive
- Implements
- Inherited Members
Constructors
Archive(DataBase?, string?, ArchiveAttributes)
Creates a new instance of this object.
public Archive(DataBase? parent, string? dataName, ArchiveAttributes attributes)
Parameters
parent
DataBasedataName
stringattributes
ArchiveAttributes
Properties
ArchiveExtension
Allows you to get the system file extension.
public string ArchiveExtension { get; }
Property Value
- string
Returns a string containing the system file extension.
Attributes
The attributes of the data file.
public override ArchiveAttributes Attributes { get; protected set; }
Property Value
- ArchiveAttributes
Returns the attributes of the data file.
GetGuid
Allows you to generate a guid from the allocated buffer.
public Guid GetGuid { get; }
Property Value
- Guid
Returns a guid generated from the allocated buffer.
IsNull
Determines whether the object is a null representation.
public bool IsNull { get; }
Property Value
- bool
Returns
true
if the object is a null representation.
Name
Data file name.
public override string? Name { get; protected set; }
Property Value
- string
Returns a string containing the name of the data file.
NameWithoutExtension
Allows you to get the name of the system file without its extension.
public string NameWithoutExtension { get; }
Property Value
- string
Returns a string with the name of the system file without its extension.
Null
A null representation of the Archive object.
public static Archive Null { get; }
Property Value
Parent
The parent element of the data file.
public override DataBase? Parent { get; protected set; }
Property Value
- DataBase
Returns parent element of data file.
Path
The full path of the data file.
public override string Path { get; }
Property Value
- string
Returns a string containing the full path of the data file.
bufferLength
Allows you to check the length of the allocated buffer.
public long bufferLength { get; }
Property Value
- long
Returns the length of the allocated buffer.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override void Dispose()
Flush()
Allows you to flush the object's buffer to the system file that this object represents.
public void Flush()
Exceptions
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
- InvalidOperationException
It will occur when there is another invalid operation.
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
- FileNotFoundException
It will occur when the path of the file that this object represents does not exist.
Read()
This method allows reading the system file loaded in this object.
public byte[] Read()
Returns
- byte[]
Returns a copy of the buffer loaded into this object.
Read(out char[])
This method allows reading the system file loaded in this object.
public void Read(out char[] chars)
Parameters
Exceptions
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Read(out string)
This method allows reading the system file loaded in this object.
public void Read(out string text)
Parameters
Exceptions
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Read(Encoding, out char[])
This method allows reading the system file loaded in this object.
public void Read(Encoding encoding, out char[] chars)
Parameters
encoding
EncodingThe Encoding that will be used to convert the object buffer to a char[].
chars
char[]Returns the buffer already converted to char[].
Exceptions
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Read(Encoding, out string)
This method allows reading the system file loaded in this object.
public void Read(Encoding encoding, out string text)
Parameters
encoding
EncodingThe Encoding that will be used to convert the object buffer to a string.
text
stringReturns the buffer already converted to string.
Exceptions
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Read(Encoding, out StringBuilder)
This method allows reading the system file loaded in this object.
public void Read(Encoding encoding, out StringBuilder builder)
Parameters
encoding
EncodingThe Encoding that will be used to convert the object buffer to a StringBuilder.
builder
StringBuilderReturns the buffer already converted to StringBuilder.
Exceptions
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Read(out StringBuilder)
This method allows reading the system file loaded in this object.
public void Read(out StringBuilder builder)
Parameters
builder
StringBuilderReturns the buffer already converted to StringBuilder.
Exceptions
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
RefreshBuffer()
The method allows you to refresh the buffer if the file is changed.
public void RefreshBuffer()
Exceptions
- InvalidOperationException
It will occur when there is another invalid operation.
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
- FileNotFoundException
It will occur when the path of the file that this object represents does not exist.
RenameArchive(Archive?, string?)
Allows you to rename the system file.
public static bool RenameArchive(Archive? archive, string? newName)
Parameters
archive
ArchiveThe representation of the file that will be renamed.
newName
stringThe new name that will be given to the object.
Returns
- bool
Returns
true
when the operation is performed successfully.
Exceptions
- InvalidOperationException
Occurs when the name of the new file has an invalid character.
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
ReplaceBuffer(byte[]?)
The method allows replacing the object's current buffer with another one.
public void ReplaceBuffer(byte[]? newBuffer)
Parameters
newBuffer
byte[]The new buffer that will be allocated in this object.
Exceptions
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
- ArgumentNullException
Occurs if the
newBuffer
parameter is null.- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToString(string, IFormatProvider)
Formats the value of the current instance using the specified format.
public override string ToString(string format, IFormatProvider formatProvider)
Parameters
format
stringThe format to use.-or- A null reference (
Nothing
in Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProvider
IFormatProviderThe provider to use to format the value.-or- A null reference (
Nothing
in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
Write(byte[])
The method allows writing to the object's buffer.
public void Write(byte[] buffer)
Parameters
buffer
byte[]The value that will be written to the object buffer.
Exceptions
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Write(byte[], Encoding)
The method allows writing to the object's buffer.
public void Write(byte[] buffer, Encoding encoding)
Parameters
buffer
byte[]The value that will be written to the object buffer.
encoding
EncodingThe Encoding that will be used to write to the object buffer.
Exceptions
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Write(char[])
The method allows writing to the object's buffer.
public void Write(char[] chars)
Parameters
chars
char[]The value that will be written to the object buffer.
Exceptions
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Write(char[], Encoding)
The method allows writing to the object's buffer.
public void Write(char[] chars, Encoding encoding)
Parameters
chars
char[]The value that will be written to the object buffer.
encoding
EncodingThe Encoding that will be used to write to the object buffer.
Exceptions
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Write(string)
The method allows writing to the object's buffer.
public void Write(string text)
Parameters
text
stringThe value that will be written to the object buffer.
Exceptions
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.
Write(string, Encoding)
The method allows writing to the object's buffer.
public void Write(string text, Encoding encoding)
Parameters
text
stringThe value that will be written to the object buffer.
encoding
EncodingThe Encoding that will be used to write to the object buffer.
Exceptions
- ReadOnlyException
Will occur if the method is called on an object that is marked as read-only.
- ObjectDisposedException
Will occur when the method is called after the object has been disposed.