C# Class DrutNET.DrutNETBase

Base Class with general functions
Mostra file Open project: bricel/DrutNet Class Usage Examples

Public Methods

Method Description
CreateDir ( string dir ) : DirectoryInfo
CurlDataProgress ( ProgressDataStruct info ) : void
DeleteAllFiles ( string directory, string fileNotToDelete ) : void
DirectoryExists ( string dir ) : bool
DownloadHTTPFile ( string httpPath, string savePath ) : bool

Download a public file from a URL

FileExists ( string file ) : bool
GetExtension ( string FileName ) : string

return file extension with leading point

GetFileName ( string FileName ) : string

Return file name and extension without path

GetFileNameWithoutExtension ( string FileName ) : string

Remove the extension and path of a filename

GetFileNameWithoutExtension ( string FileName, bool withPath ) : string

remove extension and keep path if withPath is set to true

GetPath ( string FileName ) : string

Return the path of the file

GetUniqueDirectory ( string dir, bool useUnderScore ) : string

return a unique dir name

GetUniqueFileName ( string sourceFN ) : string

check if filename exist , and return a filename_num that is unique

GetUniqueFileName ( string sourceFN, bool useUnderScore ) : string
OpenWebPage ( string url ) : void
ReadAutoCompleteFile ( string path ) : string[]
ReplaceFileExtension ( string FileName, string newExtension ) : string

replace the filename extension

UnZip ( string pathToUnZip, string targetFolder ) : void
WriteAutoCompleteFile ( string autoCompleteStr, string path ) : void
sendLogEvent ( string message, string mSender, Enums mType ) : void

Send a message event

sendLogEvent ( string message, string mSender, Enums mType, bool verbose ) : void
sendLogEvent ( string message, string errorFile, string mSender, Enums mType ) : void
sendLogEvent ( string message, string errorFile, string mSender, Enums mType, bool verbose ) : void

Protected Methods

Method Description
readByte ( BinaryReader ruleFileBinaryReader ) : byte
readFloat ( BinaryReader ruleFileBinaryReader, int numOfIFloatToRead ) : List

Read floats into an array

readFloat ( BinaryReader ruleFileBinaryReader ) : float

read single float

readInt32 ( BinaryReader ruleFileBinaryReader, int numOfIntToRead ) : List

read int32

readInt32 ( BinaryReader ruleFileBinaryReader ) : int

read single int 32

readString ( BinaryReader ruleFileBinaryReader, int numOfCharToRead ) : string
writeFloatToFile ( BinaryWriter ruleFileBinaryWriter, float f ) : bool
writeInt32ToFile ( BinaryWriter ruleFileBinaryWriter, int i ) : bool
writeStringAndLengthToFile ( BinaryWriter ruleFileBinaryWriter, string s ) : bool
writeStringToFile ( BinaryWriter ruleFileBinaryWriter, string s ) : bool
writeStringToFile ( BinaryWriter ruleFileBinaryWriter, string s, bool endChar ) : bool

Private Methods

Method Description
sendErrorLogEvent ( string message ) : void
sendErrorLogEvent ( string message, bool verbose ) : void
writeLogToFile ( string message, string mSender, Enums mType ) : void

Method Details

CreateDir() public static method

public static CreateDir ( string dir ) : DirectoryInfo
dir string
return System.IO.DirectoryInfo

CurlDataProgress() public static method

public static CurlDataProgress ( ProgressDataStruct info ) : void
info ProgressDataStruct
return void

DeleteAllFiles() public static method

public static DeleteAllFiles ( string directory, string fileNotToDelete ) : void
directory string
fileNotToDelete string
return void

DirectoryExists() public static method

public static DirectoryExists ( string dir ) : bool
dir string
return bool

DownloadHTTPFile() public static method

Download a public file from a URL
public static DownloadHTTPFile ( string httpPath, string savePath ) : bool
httpPath string
savePath string
return bool

FileExists() public static method

public static FileExists ( string file ) : bool
file string
return bool

GetExtension() public static method

return file extension with leading point
public static GetExtension ( string FileName ) : string
FileName string
return string

GetFileName() public static method

Return file name and extension without path
public static GetFileName ( string FileName ) : string
FileName string
return string

GetFileNameWithoutExtension() public static method

Remove the extension and path of a filename
public static GetFileNameWithoutExtension ( string FileName ) : string
FileName string
return string

GetFileNameWithoutExtension() public static method

remove extension and keep path if withPath is set to true
public static GetFileNameWithoutExtension ( string FileName, bool withPath ) : string
FileName string
withPath bool
return string

GetPath() public static method

Return the path of the file
public static GetPath ( string FileName ) : string
FileName string
return string

GetUniqueDirectory() public static method

return a unique dir name
public static GetUniqueDirectory ( string dir, bool useUnderScore ) : string
dir string Directory without ending slash
useUnderScore bool
return string

GetUniqueFileName() public static method

check if filename exist , and return a filename_num that is unique
public static GetUniqueFileName ( string sourceFN ) : string
sourceFN string
return string

GetUniqueFileName() public static method

public static GetUniqueFileName ( string sourceFN, bool useUnderScore ) : string
sourceFN string
useUnderScore bool
return string

OpenWebPage() public static method

public static OpenWebPage ( string url ) : void
url string
return void

ReadAutoCompleteFile() public static method

public static ReadAutoCompleteFile ( string path ) : string[]
path string
return string[]

ReplaceFileExtension() public static method

replace the filename extension
public static ReplaceFileExtension ( string FileName, string newExtension ) : string
FileName string original file name to change
newExtension string new extension , with the dot
return string

UnZip() public static method

public static UnZip ( string pathToUnZip, string targetFolder ) : void
pathToUnZip string
targetFolder string
return void

WriteAutoCompleteFile() public static method

public static WriteAutoCompleteFile ( string autoCompleteStr, string path ) : void
autoCompleteStr string
path string
return void

readByte() protected method

protected readByte ( BinaryReader ruleFileBinaryReader ) : byte
ruleFileBinaryReader System.IO.BinaryReader
return byte

readFloat() protected method

Read floats into an array
protected readFloat ( BinaryReader ruleFileBinaryReader, int numOfIFloatToRead ) : List
ruleFileBinaryReader System.IO.BinaryReader
numOfIFloatToRead int
return List

readFloat() protected method

read single float
protected readFloat ( BinaryReader ruleFileBinaryReader ) : float
ruleFileBinaryReader System.IO.BinaryReader
return float

readInt32() protected method

read int32
protected readInt32 ( BinaryReader ruleFileBinaryReader, int numOfIntToRead ) : List
ruleFileBinaryReader System.IO.BinaryReader
numOfIntToRead int
return List

readInt32() protected method

read single int 32
protected readInt32 ( BinaryReader ruleFileBinaryReader ) : int
ruleFileBinaryReader System.IO.BinaryReader
return int

readString() protected method

protected readString ( BinaryReader ruleFileBinaryReader, int numOfCharToRead ) : string
ruleFileBinaryReader System.IO.BinaryReader
numOfCharToRead int
return string

sendLogEvent() public static method

Send a message event
public static sendLogEvent ( string message, string mSender, Enums mType ) : void
message string
mSender string
mType Enums
return void

sendLogEvent() public static method

public static sendLogEvent ( string message, string mSender, Enums mType, bool verbose ) : void
message string
mSender string
mType Enums
verbose bool
return void

sendLogEvent() public static method

public static sendLogEvent ( string message, string errorFile, string mSender, Enums mType ) : void
message string
errorFile string
mSender string
mType Enums
return void

sendLogEvent() public static method

public static sendLogEvent ( string message, string errorFile, string mSender, Enums mType, bool verbose ) : void
message string
errorFile string
mSender string
mType Enums
verbose bool
return void

writeFloatToFile() protected method

protected writeFloatToFile ( BinaryWriter ruleFileBinaryWriter, float f ) : bool
ruleFileBinaryWriter System.IO.BinaryWriter
f float
return bool

writeInt32ToFile() protected method

protected writeInt32ToFile ( BinaryWriter ruleFileBinaryWriter, int i ) : bool
ruleFileBinaryWriter System.IO.BinaryWriter
i int
return bool

writeStringAndLengthToFile() protected method

protected writeStringAndLengthToFile ( BinaryWriter ruleFileBinaryWriter, string s ) : bool
ruleFileBinaryWriter System.IO.BinaryWriter
s string
return bool

writeStringToFile() protected method

protected writeStringToFile ( BinaryWriter ruleFileBinaryWriter, string s ) : bool
ruleFileBinaryWriter System.IO.BinaryWriter
s string
return bool

writeStringToFile() protected method

protected writeStringToFile ( BinaryWriter ruleFileBinaryWriter, string s, bool endChar ) : bool
ruleFileBinaryWriter System.IO.BinaryWriter
s string
endChar bool
return bool