C# 클래스 mybox.Common

A class which is used to store common functions common to the client and server
파일 보기 프로젝트 열기: jonocodes/mybox

공개 프로퍼티들

프로퍼티 타입 설명
TempDir String
UserHome String

공개 메소드들

메소드 설명
BufferToSignal ( byte buffer ) : Signal

Convert a byte array to a single byte signal

CreateLocalDirectory ( String absPath ) : bool

Create a directory on the local filesystem if it does not exist

DateTimeToUnixTimestamp ( System.DateTime dateTime ) : long

Convert DateTime to unix timestamp.

DeleteLocal ( String absPath ) : bool

Delete a local file or directory

EncryptPassword ( string pwd, string salt ) : string

Enrcypt a password with a salt and return the result

EndDirWithSlash ( String absPath ) : string

Make sure the input directory path has a trailing slash.

ExitError ( ) : void

Quit the program when an error occurs.

FileChecksumToBytes ( String absPath ) : byte[]
FileChecksumToString ( String absPath ) : String
GenerateSalt ( int size ) : string

Generates a random salt for password encryption purposes

GetFilesRecursive ( string baseDir ) : List

Gets a recursive listing of files from a directory

GetModTime ( String fullPath ) : long

Get the data modification time of a local file

Md5Hash ( String input ) : String

Md5 digest a string.

ReceiveFile ( Socket socket, string baseDir ) : MyFile

Receive a file over a socket

ReceiveString ( Socket socket ) : String

Get a string from a socket which is sent by SendString

SendString ( Socket socket, String str ) : bool

Send a string along a socket

Sha256Hash ( String input ) : String

Compute Sha256 for a string.

ShowCliHelp ( OptionSet options, Assembly thisAssembly ) : void

Display the command line options and then exit.

SignalToBuffer ( Signal signal ) : byte[]

Convert the signal to a byte array

UnixTimeStampToDateTime ( long unixTimeStamp ) : System.DateTime

Convert UNIX timestamp to a datetime object

비공개 메소드들

메소드 설명
SendFile ( String relPath, Socket socket, String baseDir ) : MyFile

메소드 상세

BufferToSignal() 공개 정적인 메소드

Convert a byte array to a single byte signal
public static BufferToSignal ( byte buffer ) : Signal
buffer byte
리턴 Signal

CreateLocalDirectory() 공개 정적인 메소드

Create a directory on the local filesystem if it does not exist
public static CreateLocalDirectory ( String absPath ) : bool
absPath String
리턴 bool

DateTimeToUnixTimestamp() 공개 정적인 메소드

Convert DateTime to unix timestamp.
public static DateTimeToUnixTimestamp ( System.DateTime dateTime ) : long
dateTime System.DateTime /// DateTime ///
리턴 long

DeleteLocal() 공개 정적인 메소드

Delete a local file or directory
public static DeleteLocal ( String absPath ) : bool
absPath String the absolute path to the item
리턴 bool

EncryptPassword() 공개 정적인 메소드

Enrcypt a password with a salt and return the result
public static EncryptPassword ( string pwd, string salt ) : string
pwd string
salt string
리턴 string

EndDirWithSlash() 공개 정적인 메소드

Make sure the input directory path has a trailing slash.
public static EndDirWithSlash ( String absPath ) : string
absPath String
리턴 string

ExitError() 공개 정적인 메소드

Quit the program when an error occurs.
public static ExitError ( ) : void
리턴 void

FileChecksumToBytes() 공개 정적인 메소드

public static FileChecksumToBytes ( String absPath ) : byte[]
absPath String
리턴 byte[]

FileChecksumToString() 공개 정적인 메소드

public static FileChecksumToString ( String absPath ) : String
absPath String
리턴 String

GenerateSalt() 공개 정적인 메소드

Generates a random salt for password encryption purposes
public static GenerateSalt ( int size ) : string
size int the length in bytes of the salt
리턴 string

GetFilesRecursive() 공개 정적인 메소드

Gets a recursive listing of files from a directory
public static GetFilesRecursive ( string baseDir ) : List
baseDir string
리턴 List

GetModTime() 공개 정적인 메소드

Get the data modification time of a local file
public static GetModTime ( String fullPath ) : long
fullPath String
리턴 long

Md5Hash() 공개 정적인 메소드

Md5 digest a string.
public static Md5Hash ( String input ) : String
input String /// Any string ///
리턴 String

ReceiveFile() 공개 정적인 메소드

Receive a file over a socket
public static ReceiveFile ( Socket socket, string baseDir ) : MyFile
socket System.Net.Sockets.Socket
baseDir string the base directory the file will live in
리턴 MyFile

ReceiveString() 공개 정적인 메소드

Get a string from a socket which is sent by SendString
public static ReceiveString ( Socket socket ) : String
socket System.Net.Sockets.Socket
리턴 String

SendString() 공개 정적인 메소드

Send a string along a socket
public static SendString ( Socket socket, String str ) : bool
socket System.Net.Sockets.Socket
str String
리턴 bool

Sha256Hash() 공개 정적인 메소드

Compute Sha256 for a string.
public static Sha256Hash ( String input ) : String
input String /// Input. ///
리턴 String

ShowCliHelp() 공개 정적인 메소드

Display the command line options and then exit.
public static ShowCliHelp ( OptionSet options, Assembly thisAssembly ) : void
options OptionSet
thisAssembly System.Reflection.Assembly
리턴 void

SignalToBuffer() 공개 정적인 메소드

Convert the signal to a byte array
public static SignalToBuffer ( Signal signal ) : byte[]
signal Signal
리턴 byte[]

UnixTimeStampToDateTime() 공개 정적인 메소드

Convert UNIX timestamp to a datetime object
public static UnixTimeStampToDateTime ( long unixTimeStamp ) : System.DateTime
unixTimeStamp long /// Unix time stamp. ///
리턴 System.DateTime

프로퍼티 상세

TempDir 공개적으로 정적으로 프로퍼티

The system temp directory
public static String TempDir
리턴 String

UserHome 공개적으로 정적으로 프로퍼티

The user's system home directory primarialy used for determining where the config directory is
public static String UserHome
리턴 String