C# Класс fCraft.FlatfilePlayerDBProvider

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddPlayer ( string name, Rank startingRank, RankChangeType rankChangeType, IPAddress address ) : PlayerInfo

Adds a new PlayerInfo entry for an actual, logged-in player.

AddUnrecognizedPlayer ( string name, Rank startingRank, RankChangeType rankChangeType ) : PlayerInfo

Adds a new PlayerInfo entry for a player who has never been online, by name.

FindByIP ( IPAddress address, int limit ) : IEnumerable

Finds players by IP address.

FindByPartialName ( string partialName, int limit ) : IEnumerable

Finds players by partial name (prefix).

FindByPattern ( string pattern, int limit ) : IEnumerable

Finds player by name pattern.

FindExact ( string fullName ) : PlayerInfo

Finds player by exact name.

FindOneByPartialName ( string partialName, PlayerInfo &result ) : bool

Searches for player names starting with namePart, returning just one or none of the matches.

Import ( IEnumerable playerInfos ) : void

Inserts all data from given PlayerInfo list directly into the database.

Import ( PlayerInfo playerInfo ) : void

Inserts all data from given playerInfo directly into the database.

Load ( ) : IEnumerable

Initializes the provider, and allocates PlayerInfo objects for all players.

MassRankChange ( Player player, Rank from, Rank to, string reason ) : void

Changes ranks of all players in one transaction.

Remove ( PlayerInfo playerInfo ) : bool

Removes a PlayerInfo entry from the database.

Save ( ) : void

Saves the whole database.

SwapInfo ( PlayerInfo player1, PlayerInfo player2 ) : void

Swaps records of two players in one transaction.

ToDateTimeLegacy ( long timestamp ) : System.DateTime
ToDateTimeLegacy ( [ str, System.DateTime &result ) : bool
ToTimeSpanLegacy ( [ str, System.TimeSpan &result ) : bool
ToUnixTimeLegacy ( System.DateTime date ) : long
TryParseLocalDate ( [ dateString, System.DateTime &date ) : bool

Tries to parse a data in a culture-specific ways. This method is, unfortunately, necessary because in versions 0.520-0.522, fCraft saved dates in a culture-specific format. This means that if the server's culture settings were changed, or if the PlayerDB and IPBanList files were moved between machines, all dates became unparseable.

Unescape ( [ str ) : string
UnescapeOldFormat ( [ str ) : string

Приватные методы

Метод Описание
GetNextID ( ) : int
GetRankByIndex ( int index ) : Rank
GuessRankChangeType ( [ info ) : void
IdentifyFormatVersion ( [ header ) : int
LoadBinary ( ) : void
LoadBinaryFormat0 ( [ reader ) : PlayerInfo
LoadFormat0 ( [ fields ) : PlayerInfo
LoadFormat1 ( [ fields ) : PlayerInfo
LoadFormat2 ( [ fields ) : PlayerInfo
OpenRead ( [ fileName ) : FileStream
OpenWrite ( [ fileName ) : FileStream
ParseBandwidthUseMode ( [ info, [ field ) : void
Read7BitEncodedInt ( [ reader ) : int
ReadDate ( [ reader ) : System.DateTime
ReadIPAddress ( [ reader ) : IPAddress
ReadString ( [ reader ) : string
ReadTimeSpan ( [ reader ) : System.TimeSpan
SaveBinaryFormat0 ( PlayerInfo info, [ writer ) : void
Write7BitEncodedInt ( [ writer, int value ) : void
WriteDate ( [ writer, System.DateTime dateTime ) : void
WriteString ( [ writer, [ str ) : void

Описание методов

AddPlayer() публичный Метод

Adds a new PlayerInfo entry for an actual, logged-in player.
public AddPlayer ( string name, Rank startingRank, RankChangeType rankChangeType, IPAddress address ) : PlayerInfo
name string
startingRank Rank
rankChangeType RankChangeType
address System.Net.IPAddress
Результат PlayerInfo

AddUnrecognizedPlayer() публичный Метод

Adds a new PlayerInfo entry for a player who has never been online, by name.
public AddUnrecognizedPlayer ( string name, Rank startingRank, RankChangeType rankChangeType ) : PlayerInfo
name string
startingRank Rank
rankChangeType RankChangeType
Результат PlayerInfo

FindByIP() публичный Метод

Finds players by IP address.
public FindByIP ( IPAddress address, int limit ) : IEnumerable
address System.Net.IPAddress Player's IP address.
limit int Maximum number of results to return.
Результат IEnumerable

FindByPartialName() публичный Метод

Finds players by partial name (prefix).
public FindByPartialName ( string partialName, int limit ) : IEnumerable
partialName string Full or partial name of the player.
limit int Maximum number of results to return.
Результат IEnumerable

FindByPattern() публичный Метод

Finds player by name pattern.
public FindByPattern ( string pattern, int limit ) : IEnumerable
pattern string Pattern to search for. /// Asterisk (*) matches zero or more characters. /// Question mark (?) matches exactly one character.
limit int Maximum number of results to return.
Результат IEnumerable

FindExact() публичный Метод

Finds player by exact name.
public FindExact ( string fullName ) : PlayerInfo
fullName string Full, case-insensitive name of the player.
Результат PlayerInfo

FindOneByPartialName() публичный Метод

Searches for player names starting with namePart, returning just one or none of the matches.
public FindOneByPartialName ( string partialName, PlayerInfo &result ) : bool
partialName string Partial or full player name.
result PlayerInfo PlayerInfo to output (will be set to null if no single match was found).
Результат bool

Import() публичный Метод

Inserts all data from given PlayerInfo list directly into the database.
public Import ( IEnumerable playerInfos ) : void
playerInfos IEnumerable List of player record to import.
Результат void

Import() публичный Метод

Inserts all data from given playerInfo directly into the database.
public Import ( PlayerInfo playerInfo ) : void
playerInfo PlayerInfo Player record to import.
Результат void

Load() публичный Метод

Initializes the provider, and allocates PlayerInfo objects for all players.
public Load ( ) : IEnumerable
Результат IEnumerable

MassRankChange() публичный Метод

Changes ranks of all players in one transaction.
public MassRankChange ( Player player, Rank from, Rank to, string reason ) : void
player Player
from Rank
to Rank
reason string
Результат void

Remove() публичный Метод

Removes a PlayerInfo entry from the database.
public Remove ( PlayerInfo playerInfo ) : bool
playerInfo PlayerInfo
Результат bool

Save() публичный Метод

Saves the whole database.
public Save ( ) : void
Результат void

SwapInfo() публичный Метод

Swaps records of two players in one transaction.
public SwapInfo ( PlayerInfo player1, PlayerInfo player2 ) : void
player1 PlayerInfo
player2 PlayerInfo
Результат void

ToDateTimeLegacy() публичный статический Метод

public static ToDateTimeLegacy ( long timestamp ) : System.DateTime
timestamp long
Результат System.DateTime

ToDateTimeLegacy() публичный статический Метод

public static ToDateTimeLegacy ( [ str, System.DateTime &result ) : bool
str [
result System.DateTime
Результат bool

ToTimeSpanLegacy() публичный статический Метод

public static ToTimeSpanLegacy ( [ str, System.TimeSpan &result ) : bool
str [
result System.TimeSpan
Результат bool

ToUnixTimeLegacy() публичный статический Метод

public static ToUnixTimeLegacy ( System.DateTime date ) : long
date System.DateTime
Результат long

TryParseLocalDate() публичный статический Метод

Tries to parse a data in a culture-specific ways. This method is, unfortunately, necessary because in versions 0.520-0.522, fCraft saved dates in a culture-specific format. This means that if the server's culture settings were changed, or if the PlayerDB and IPBanList files were moved between machines, all dates became unparseable.
public static TryParseLocalDate ( [ dateString, System.DateTime &date ) : bool
dateString [ String to parse.
date System.DateTime Date to output.
Результат bool

Unescape() публичный статический Метод

public static Unescape ( [ str ) : string
str [
Результат string

UnescapeOldFormat() публичный статический Метод

public static UnescapeOldFormat ( [ str ) : string
str [
Результат string