C# Class AddonHelper.Addon

显示文件 Open project: angelog/ClipUpload Class Usage Examples

Public Properties

Property Type Description
ProgressBar cProgressBar
rnd System.Random

Public Methods

Method Description
AddLog ( string URL, string info ) : void

Add a recently uploaded file to the upload log

Backup ( byte buffer, string filename ) : void

Make a backup of the given file buffer as the current filename

Backup ( string sourceFile ) : void

Make a backup of the given source file

Debug ( string str ) : void

Writes to debug.txt

Drag ( Action doneDragging ) : void

Drag to upload

Epoch ( ) : long

Returns the linux epoch time (seconds passed since 1/1/1970)

GetBetween ( string Source, string Str1, string Str2 ) : string

Get a string between 2 other strings from the source string

GetEncoder ( ImageFormat format ) : System.Drawing.Imaging.ImageCodecInfo

Returns the image encoder for the given ImageFormat

GetProxy ( ) : WebProxy

Get a WebProxy object from the global proxy settings in the ClipUpload application

ImagePipeline ( Image img ) : void

Transforms an image based on global upload settings

LongDataEscape ( string Str ) : string

Alternative of M:System.Uri.EscapeDataString(System.String) to allow for much longer data to be escaped

MD5 ( string S ) : string

Generate an MD5 hash of the given string

PopulateKeysCombobox ( ComboBox comboBox ) : void

Populate a keys combobox with possible keys to press

RandomFilename ( int len, string chars = "abcdefghijklmnopqrstuvwxyz0123456789" ) : string

Returns a random filename based on the length and the allowed characters given

RandomString ( int len, string chars = "abcdefghijklmnopqrstuvwxyz0123456789" ) : string

Returns a random string based on the length and the allowed characters given

SetClipboardText ( string Text ) : void

Safely sets the clipboard text. Refrain from using Clipboard.SetText directly, instead, use this function!

SetShortcuts ( bool enabled ) : void

Enables or disables shortcuts in ClipUpload.

base64Decode ( string input ) : string

Decode a base64 string

base64Encode ( string input ) : string

Encode a string in base64

getDateString ( ) : string

Returns a date string without any delimiters in the following order: Day, month, year, hour, minute, second

Private Methods

Method Description
GetOpenClipboardWindow ( ) : IntPtr
formatFilename ( string origFilename ) : string

Method Details

AddLog() public method

Add a recently uploaded file to the upload log
public AddLog ( string URL, string info ) : void
URL string The URL
info string Additional info that will appear in the recent uploads list
return void

Backup() public method

Make a backup of the given file buffer as the current filename
public Backup ( byte buffer, string filename ) : void
buffer byte The file buffer
filename string The filename
return void

Backup() public method

Make a backup of the given source file
public Backup ( string sourceFile ) : void
sourceFile string The source filename
return void

Debug() public method

Writes to debug.txt
public Debug ( string str ) : void
str string Line of text
return void

Drag() public method

Drag to upload
public Drag ( Action doneDragging ) : void
doneDragging Action Dragging callback
return void

Epoch() public method

Returns the linux epoch time (seconds passed since 1/1/1970)
public Epoch ( ) : long
return long

GetBetween() public method

Get a string between 2 other strings from the source string
public GetBetween ( string Source, string Str1, string Str2 ) : string
Source string The source string
Str1 string The first string, for example: "<link>"
Str2 string The second string, for example: "</link>"
return string

GetEncoder() public method

Returns the image encoder for the given ImageFormat
public GetEncoder ( ImageFormat format ) : System.Drawing.Imaging.ImageCodecInfo
format System.Drawing.Imaging.ImageFormat The ImageFormat to get the encoder for
return System.Drawing.Imaging.ImageCodecInfo

GetProxy() public method

Get a WebProxy object from the global proxy settings in the ClipUpload application
public GetProxy ( ) : WebProxy
return System.Net.WebProxy

ImagePipeline() public method

Transforms an image based on global upload settings
public ImagePipeline ( Image img ) : void
img Image The base image
return void

LongDataEscape() public method

Alternative of M:System.Uri.EscapeDataString(System.String) to allow for much longer data to be escaped
public LongDataEscape ( string Str ) : string
Str string The string to be escaped
return string

MD5() public method

Generate an MD5 hash of the given string
public MD5 ( string S ) : string
S string The string
return string

PopulateKeysCombobox() public method

Populate a keys combobox with possible keys to press
public PopulateKeysCombobox ( ComboBox comboBox ) : void
comboBox System.Windows.Forms.ComboBox The combobox
return void

RandomFilename() public method

Returns a random filename based on the length and the allowed characters given
public RandomFilename ( int len, string chars = "abcdefghijklmnopqrstuvwxyz0123456789" ) : string
len int The length
chars string Allowed characters
return string

RandomString() public static method

Returns a random string based on the length and the allowed characters given
public static RandomString ( int len, string chars = "abcdefghijklmnopqrstuvwxyz0123456789" ) : string
len int The length
chars string Allowed characters
return string

SetClipboardText() public method

Safely sets the clipboard text. Refrain from using Clipboard.SetText directly, instead, use this function!
public SetClipboardText ( string Text ) : void
Text string The text to set the clipboard to
return void

SetShortcuts() public static method

Enables or disables shortcuts in ClipUpload.
public static SetShortcuts ( bool enabled ) : void
enabled bool Bool to enable or disable
return void

base64Decode() public method

Decode a base64 string
public base64Decode ( string input ) : string
input string The base64 string to be decoded
return string

base64Encode() public method

Encode a string in base64
public base64Encode ( string input ) : string
input string The string to be encoded
return string

getDateString() public method

Returns a date string without any delimiters in the following order: Day, month, year, hour, minute, second
public getDateString ( ) : string
return string

Property Details

ProgressBar public_oe property

Used to invoke a progressbar window
public cProgressBar ProgressBar
return cProgressBar

rnd public_oe static_oe property

public static Random,System rnd
return System.Random