C# Class fCraft.BlockDB

Database of block changes. Each BlockDB object is associated with a world. Provides controls for storage/retention, and methods to look up data.
Inheritance: IDisposable
Afficher le fichier Open project: GlennMR/800craft Class Usage Examples

Private Properties

Свойство Type Description
AddEntry void
BlockDB System
CacheClear void
CheckAlignment void
CountNewerEntries int
EnforceLimit void
EnforceTimeLimit void
EnsureCapacity void
Flush void
Init void
LimitCapacity void
Lookup fCraft.BlockDBEntry[]
OnPlayerPlacedBlock void
OpenAppend System.IO.FileStream
OpenRead System.IO.FileStream
Preload void
TrimFile void

Méthodes publiques

Méthode Description
AutoToggleIfNeeded ( ) : bool

If EnabledState is set to Auto, calling this auto-enables / auto-disables BlockDB depending on world's BuildSecurity.MinRank and BlockDBAutoEnableRank config key.

Clear ( ) : void

Clears cache and deletes the .fbdb file.

GetReadLock ( ) : IDisposable

Acquires and returns a shared (read) lock for this BlockDB. Disposing the object returned by this method releases the lock.

GetWriteLock ( ) : IDisposable

Acquires and returns an exclusive (write) lock for this BlockDB. Disposing the object returned by this method releases the lock.

LoadSettings ( System.Xml.Linq.XElement el ) : void
Lookup ( int max ) : fCraft.BlockDBEntry[]
Lookup ( int max, System.TimeSpan span ) : fCraft.BlockDBEntry[]
Lookup ( int max, Vector3I coords ) : fCraft.BlockDBEntry[]

Returns list of all changes done to the map at the given coordinate, newest to oldest.

Lookup ( int max, [ area ) : fCraft.BlockDBEntry[]
Lookup ( int max, [ area, System.TimeSpan span ) : fCraft.BlockDBEntry[]
Lookup ( int max, [ area, [ info, bool exclude ) : fCraft.BlockDBEntry[]
Lookup ( int max, [ area, [ info, bool exclude, System.TimeSpan span ) : fCraft.BlockDBEntry[]
Lookup ( int max, [ info, bool exclude ) : fCraft.BlockDBEntry[]
Lookup ( int max, [ info, bool exclude, System.TimeSpan span ) : fCraft.BlockDBEntry[]
SaveSettings ( ) : System.Xml.Linq.XElement
SaveSettings ( string rootName ) : System.Xml.Linq.XElement
Traverse ( [ processor ) : void

Traverses the database, newest to oldest entries, processing each entry with the given IBlockDBQueryProcessor.

Private Methods

Méthode Description
AddEntry ( BlockDBEntry item ) : void
BlockDB ( [ world ) : System
CacheClear ( ) : void
CheckAlignment ( ) : void
CountNewerEntries ( System.TimeSpan age ) : int

Counts entries that are newer than the given age.

EnforceLimit ( ) : void
EnforceTimeLimit ( ) : void
EnsureCapacity ( int min ) : void
Flush ( bool enforceLimits ) : void
Init ( ) : void
LimitCapacity ( int max ) : void
Lookup ( int max, BlockDBSearchType searchType, bool>.[ selector ) : fCraft.BlockDBEntry[]
OnPlayerPlacedBlock ( object sender, [ e ) : void
OpenAppend ( ) : FileStream
OpenRead ( ) : FileStream
Preload ( ) : void
TrimFile ( int maxCapacity ) : void

Method Details

AutoToggleIfNeeded() public méthode

If EnabledState is set to Auto, calling this auto-enables / auto-disables BlockDB depending on world's BuildSecurity.MinRank and BlockDBAutoEnableRank config key.
public AutoToggleIfNeeded ( ) : bool
Résultat bool

Clear() public méthode

Clears cache and deletes the .fbdb file.
public Clear ( ) : void
Résultat void

GetReadLock() public méthode

Acquires and returns a shared (read) lock for this BlockDB. Disposing the object returned by this method releases the lock.
public GetReadLock ( ) : IDisposable
Résultat IDisposable

GetWriteLock() public méthode

Acquires and returns an exclusive (write) lock for this BlockDB. Disposing the object returned by this method releases the lock.
public GetWriteLock ( ) : IDisposable
Résultat IDisposable

LoadSettings() public méthode

public LoadSettings ( System.Xml.Linq.XElement el ) : void
el System.Xml.Linq.XElement
Résultat void

Lookup() public méthode

public Lookup ( int max ) : fCraft.BlockDBEntry[]
max int
Résultat fCraft.BlockDBEntry[]

Lookup() public méthode

public Lookup ( int max, System.TimeSpan span ) : fCraft.BlockDBEntry[]
max int
span System.TimeSpan
Résultat fCraft.BlockDBEntry[]

Lookup() public méthode

Returns list of all changes done to the map at the given coordinate, newest to oldest.
Given coordinates are outside the map.
public Lookup ( int max, Vector3I coords ) : fCraft.BlockDBEntry[]
max int Maximum number of changes to return.
coords Vector3I Coordinate to search at.
Résultat fCraft.BlockDBEntry[]

Lookup() public méthode

public Lookup ( int max, [ area ) : fCraft.BlockDBEntry[]
max int
area [
Résultat fCraft.BlockDBEntry[]

Lookup() public méthode

public Lookup ( int max, [ area, System.TimeSpan span ) : fCraft.BlockDBEntry[]
max int
area [
span System.TimeSpan
Résultat fCraft.BlockDBEntry[]

Lookup() public méthode

public Lookup ( int max, [ area, [ info, bool exclude ) : fCraft.BlockDBEntry[]
max int
area [
info [
exclude bool
Résultat fCraft.BlockDBEntry[]

Lookup() public méthode

public Lookup ( int max, [ area, [ info, bool exclude, System.TimeSpan span ) : fCraft.BlockDBEntry[]
max int
area [
info [
exclude bool
span System.TimeSpan
Résultat fCraft.BlockDBEntry[]

Lookup() public méthode

public Lookup ( int max, [ info, bool exclude ) : fCraft.BlockDBEntry[]
max int
info [
exclude bool
Résultat fCraft.BlockDBEntry[]

Lookup() public méthode

public Lookup ( int max, [ info, bool exclude, System.TimeSpan span ) : fCraft.BlockDBEntry[]
max int
info [
exclude bool
span System.TimeSpan
Résultat fCraft.BlockDBEntry[]

SaveSettings() public méthode

public SaveSettings ( ) : System.Xml.Linq.XElement
Résultat System.Xml.Linq.XElement

SaveSettings() public méthode

public SaveSettings ( string rootName ) : System.Xml.Linq.XElement
rootName string
Résultat System.Xml.Linq.XElement

Traverse() public méthode

Traverses the database, newest to oldest entries, processing each entry with the given IBlockDBQueryProcessor.
processor is null. BlockDB is disabled. The end of FBDB file is reached prematurely (corrupted file, or outside interference). FBDB file is not aligned to 20 bytes (likely corrupted). An I/O error occurrs while trying to read FBDB file from disk.
public Traverse ( [ processor ) : void
processor [ Processor to use for each BlockDBEntry.
Résultat void