C# Class wmib.Core

Inheritance: System.MarshalByRefObject
Mostra file Open project: benapetr/wikimedia-bot

Public Properties

Property Type Description
DB Database
KernelThread Thread
LastText string
MysqlDB WMIBMySQL
PostgreDB PostgreSQL
WriterThread Thread

Public Methods

Method Description
BackupData ( string name ) : bool

Create a backup file This is very useful function in case you need to overwrite some file. In that case there is a chance for program to crash during the write and this would left the file corrupted, this function will create a copy of a file using config.tempName() which later needs to be deleted (after you finish your write operation). The file that is to be backed up doesn't need to exist, if it's not present the function just return false

BackupRecovery ( string FileName ) : bool

Recover a file that had a backup and remove it

GetAction ( string message, string Channel, string host, string nick ) : bool

Called on action

GetChannel ( string name ) : Channel

Get a channel object

GetMessage ( string channel, string nick, string host, string message ) : bool

Called when someone post a message to server

GetTempFileName ( string file ) : bool

Copy the selected file to a temporary file name this function is used mostly for restore of corrupted data, so that the corrupted version of file can be stored in /tmp for debugging

HandleException ( Exception ex ) : void

Exception handler

HandleException ( Exception ex, string module ) : void

Exception handler

Kill ( ) : void

This will disable bot and close this process

RecoverFile ( string name, string ch = "unknown object" ) : bool

Recover a file that was previously stored

ShowHelp ( string parameter, Channel channel ) : bool
TrafficLog ( string text ) : void

Store a traffic log to a file

Trim ( string input ) : string
ValidFile ( string name ) : bool

Return true in case the filename is valid

WikiEncode ( string url ) : string
getUptime ( ) : string

Return uptime

Private Methods

Method Description
Terminate ( ) : void
showInfo ( string name, string info, string channel ) : void

Method Details

BackupData() public static method

Create a backup file This is very useful function in case you need to overwrite some file. In that case there is a chance for program to crash during the write and this would left the file corrupted, this function will create a copy of a file using config.tempName() which later needs to be deleted (after you finish your write operation). The file that is to be backed up doesn't need to exist, if it's not present the function just return false
public static BackupData ( string name ) : bool
name string Full path of a file that you want to make a backup of
return bool

BackupRecovery() public static method

Recover a file that had a backup and remove it
public static BackupRecovery ( string FileName ) : bool
FileName string Name of file
return bool

GetAction() public static method

Called on action
public static GetAction ( string message, string Channel, string host, string nick ) : bool
message string Message
Channel string Channel
host string Host
nick string Nick
return bool

GetChannel() public static method

Get a channel object
public static GetChannel ( string name ) : Channel
name string Name
return Channel

GetMessage() public static method

Called when someone post a message to server
public static GetMessage ( string channel, string nick, string host, string message ) : bool
channel string Channel
nick string Nick
host string Host
message string Message
return bool

GetTempFileName() public static method

Copy the selected file to a temporary file name this function is used mostly for restore of corrupted data, so that the corrupted version of file can be stored in /tmp for debugging
public static GetTempFileName ( string file ) : bool
file string /// File ///
return bool

HandleException() public static method

Exception handler
public static HandleException ( Exception ex ) : void
ex System.Exception Exception pointer
return void

HandleException() public static method

Exception handler
public static HandleException ( Exception ex, string module ) : void
ex System.Exception Exception pointer
module string Channel name
return void

Kill() public static method

This will disable bot and close this process
public static Kill ( ) : void
return void

RecoverFile() public static method

Recover a file that was previously stored
public static RecoverFile ( string name, string ch = "unknown object" ) : bool
name string
ch string
return bool

ShowHelp() public static method

public static ShowHelp ( string parameter, Channel channel ) : bool
parameter string
channel Channel
return bool

TrafficLog() public static method

Store a traffic log to a file
public static TrafficLog ( string text ) : void
text string
return void

Trim() public static method

public static Trim ( string input ) : string
input string
return string

ValidFile() public static method

Return true in case the filename is valid
public static ValidFile ( string name ) : bool
name string Name
return bool

WikiEncode() public static method

public static WikiEncode ( string url ) : string
url string
return string

getUptime() public static method

Return uptime
public static getUptime ( ) : string
return string

Property Details

DB public_oe static_oe property

Database server the bot is connected to multiple DB's this is a pointer to preferred one
public static Database,wmib DB
return Database

KernelThread public_oe static_oe property

public static Thread KernelThread
return Thread

LastText public_oe static_oe property

Last line of text received on irc
public static string LastText
return string

MysqlDB public_oe static_oe property

public static WMIBMySQL,wmib MysqlDB
return WMIBMySQL

PostgreDB public_oe static_oe property

The postgre DB
public static PostgreSQL,wmib PostgreDB
return PostgreSQL

WriterThread public_oe static_oe property

Thread which is writing the system data to files
public static Thread WriterThread
return Thread