C# Class MPTagThat.Core.Util

Mostra file Open project: MediaPortal/MPTagThat

Public Methods

Method Description
CheckParameterFormat ( string str, Options formattype ) : bool

Check the Parameter Format for validity

CreateCursorFromResource ( string resourceName, int xHotSpot, int yHotSpot ) : Cursor

Create a cursor from the given Resource Name

Drive2BassID ( char driveLetter ) : int

Converts the given CD/DVD Drive Letter to a number suiteable for BASS

DurationToSeconds ( string durationString ) : int

Converts a time string "HH:mm:ss" to seconds

EnterMethod ( MPTagThat.Core.CallingMethod method ) : void

write the Method Name into the log

FormatGridColumn ( MPTagThat.Core.GridViewColumn setting ) : System.Windows.Forms.DataGridViewColumn

Formats a Grid Column based on the Settings

FormatID3Tag ( File file ) : File

Based on the Options set, use the correct version for ID3 Eventually remove V1 or V2 tags, if set in the options

GetCallingMethod ( ) : MPTagThat.Core.CallingMethod

Example using CallingMethod within another method. This still returns information about the caller by excluding calls from this Utils class.

GetFolderThumb ( string folder ) : Common.MPTagThat.Core.Common.Picture

Return the folder.jpg as a Taglib.Picture

GetImageAssociatedWithFile ( string filePath, bool small ) : Image
GetQualifiedFilename ( string strBasePath, string &strFileName ) : void

Returns a filename prefixed with the Path

GetWebPage ( string requestString ) : string

Returns the requested WebPage

HttpPostRequest ( string url, string>.Dictionary postParameters ) : string

Post data to WebPage and get result.

IsAudio ( string fileName ) : bool

Is this an Audio file, which can be handled by MPTagThat

IsCDDrive ( string driveLetter ) : bool

Checks if the given Drive Letter is a CD/DVD Drive

IsPicture ( string fileName ) : bool

Is this a Picture file, which can be shown in Listview

IsReplayGain ( string description ) : bool

Checks, if we got a replaygain frame

LabelToParameter ( string label ) : string

Convert the Label to a Parameter

LeaveMethod ( MPTagThat.Core.CallingMethod method ) : void

write the Method Name into the log

LongestCommonSubstring ( string sourceString, string targetString ) : double

This function matches the Longet Common Substring of the source string found in target string

MakeValidFileName ( string str ) : string

Make a Valid Filename out of a given String

MakeValidFolderName ( string str ) : string

Make a Valid Foldername out of a given String

ReadFullStream ( Stream stream, int initialLength ) : byte[]

Reads data from a stream until the end is reached. The data is returned as a byte array. An IOException is thrown if any of the underlying IO calls fail.

RelativePathTo ( string fromDirectory, string toPath ) : string

Creates a relative path from one file or folder to another.

RemoveInvalidChars ( string strText ) : string

Changes the Quote to a double Quote, to have correct SQL Syntax

RemoveTrailingSlash ( string strLine ) : string
ReplaceEx ( string original, string pattern, string replacement ) : string

Fast Case Sensitive Replace Method

ReplaceParametersWithTrackValues ( string parameter, TrackData track ) : string

Replace the given Parameter string with the values from the Track

SavePicture ( TrackData track ) : void

Save the Picture of the track as folder.jpg

SecondsToHMSString ( string sSeconds ) : string

Converts given seconds to HH:mm:ss

SendMessage ( string action, string data ) : void

Sends a message

SendProgress ( string message ) : void

Sends a Progress Message, so that the status bar can be updated

isARedBookCD ( string drive ) : bool

Checks, if the given Drive Letter is a Red Book (Audio) CD

Private Methods

Method Description
CheckParmWithLengthIndicator ( int startIndex, string str, string &parmString ) : bool

Check a Parameter with a given Length Indicator for correctness

CreateIconIndirect ( System.Drawing.IconInfo &icon ) : IntPtr
GetIconInfo ( IntPtr hIcon, System.Drawing.IconInfo &pIconInfo ) : bool
MoveWindow ( IntPtr hWnd, int x, int y, int cx, int cy, bool repaint ) : bool
ReplaceStringWithLengthIndicator ( int startIndex, string replaceString, string replaceValue ) : string
SHFileOperation ( SHFILEOPSTRUCT &FileOp ) : int
SendMessage ( IntPtr hWnd, int msg, int len, IntPtr order ) : IntPtr
SetWindowText ( IntPtr hwnd, String lpString ) : bool
Util ( ) : System

Method Details

CheckParameterFormat() public static method

Check the Parameter Format for validity
public static CheckParameterFormat ( string str, Options formattype ) : bool
str string
formattype Options
return bool

CreateCursorFromResource() public static method

Create a cursor from the given Resource Name
public static CreateCursorFromResource ( string resourceName, int xHotSpot, int yHotSpot ) : Cursor
resourceName string
xHotSpot int
yHotSpot int
return System.Windows.Forms.Cursor

Drive2BassID() public static method

Converts the given CD/DVD Drive Letter to a number suiteable for BASS
public static Drive2BassID ( char driveLetter ) : int
driveLetter char
return int

DurationToSeconds() public static method

Converts a time string "HH:mm:ss" to seconds
public static DurationToSeconds ( string durationString ) : int
durationString string
return int

EnterMethod() public static method

write the Method Name into the log
public static EnterMethod ( MPTagThat.Core.CallingMethod method ) : void
method MPTagThat.Core.CallingMethod
return void

FormatGridColumn() public static method

Formats a Grid Column based on the Settings
public static FormatGridColumn ( MPTagThat.Core.GridViewColumn setting ) : System.Windows.Forms.DataGridViewColumn
setting MPTagThat.Core.GridViewColumn
return System.Windows.Forms.DataGridViewColumn

FormatID3Tag() public static method

Based on the Options set, use the correct version for ID3 Eventually remove V1 or V2 tags, if set in the options
public static FormatID3Tag ( File file ) : File
file TagLib.File
return TagLib.File

GetCallingMethod() public static method

Example using CallingMethod within another method. This still returns information about the caller by excluding calls from this Utils class.
public static GetCallingMethod ( ) : MPTagThat.Core.CallingMethod
return MPTagThat.Core.CallingMethod

GetFolderThumb() public static method

Return the folder.jpg as a Taglib.Picture
public static GetFolderThumb ( string folder ) : Common.MPTagThat.Core.Common.Picture
folder string
return Common.MPTagThat.Core.Common.Picture

GetImageAssociatedWithFile() public static method

public static GetImageAssociatedWithFile ( string filePath, bool small ) : Image
filePath string
small bool
return Image

GetQualifiedFilename() public static method

Returns a filename prefixed with the Path
public static GetQualifiedFilename ( string strBasePath, string &strFileName ) : void
strBasePath string
strFileName string
return void

GetWebPage() public static method

Returns the requested WebPage
public static GetWebPage ( string requestString ) : string
requestString string
return string

HttpPostRequest() public static method

Post data to WebPage and get result.
public static HttpPostRequest ( string url, string>.Dictionary postParameters ) : string
url string
postParameters string>.Dictionary
return string

IsAudio() public static method

Is this an Audio file, which can be handled by MPTagThat
public static IsAudio ( string fileName ) : bool
fileName string
return bool

IsCDDrive() public static method

Checks if the given Drive Letter is a CD/DVD Drive
public static IsCDDrive ( string driveLetter ) : bool
driveLetter string
return bool

IsPicture() public static method

Is this a Picture file, which can be shown in Listview
public static IsPicture ( string fileName ) : bool
fileName string
return bool

IsReplayGain() public static method

Checks, if we got a replaygain frame
public static IsReplayGain ( string description ) : bool
description string
return bool

LabelToParameter() public static method

Convert the Label to a Parameter
public static LabelToParameter ( string label ) : string
label string
return string

LeaveMethod() public static method

write the Method Name into the log
public static LeaveMethod ( MPTagThat.Core.CallingMethod method ) : void
method MPTagThat.Core.CallingMethod
return void

LongestCommonSubstring() public static method

This function matches the Longet Common Substring of the source string found in target string
public static LongestCommonSubstring ( string sourceString, string targetString ) : double
sourceString string The Source String to match
targetString string The Target String to search within
return double

MakeValidFileName() public static method

Make a Valid Filename out of a given String
public static MakeValidFileName ( string str ) : string
str string
return string

MakeValidFolderName() public static method

Make a Valid Foldername out of a given String
public static MakeValidFolderName ( string str ) : string
str string
return string

ReadFullStream() public static method

Reads data from a stream until the end is reached. The data is returned as a byte array. An IOException is thrown if any of the underlying IO calls fail.
public static ReadFullStream ( Stream stream, int initialLength ) : byte[]
stream Stream The stream to read data from
initialLength int The initial buffer length
return byte[]

RelativePathTo() public static method

Creates a relative path from one file or folder to another.
public static RelativePathTo ( string fromDirectory, string toPath ) : string
fromDirectory string /// Contains the directory that defines the /// start of the relative path. ///
toPath string /// Contains the path that defines the /// endpoint of the relative path. ///
return string

RemoveInvalidChars() public static method

Changes the Quote to a double Quote, to have correct SQL Syntax
public static RemoveInvalidChars ( string strText ) : string
strText string
return string

RemoveTrailingSlash() public static method

public static RemoveTrailingSlash ( string strLine ) : string
strLine string
return string

ReplaceEx() public static method

Fast Case Sensitive Replace Method
public static ReplaceEx ( string original, string pattern, string replacement ) : string
original string
pattern string
replacement string
return string

ReplaceParametersWithTrackValues() public static method

Replace the given Parameter string with the values from the Track
public static ReplaceParametersWithTrackValues ( string parameter, TrackData track ) : string
parameter string
track TrackData
return string

SavePicture() public static method

Save the Picture of the track as folder.jpg
public static SavePicture ( TrackData track ) : void
track TrackData
return void

SecondsToHMSString() public static method

Converts given seconds to HH:mm:ss
public static SecondsToHMSString ( string sSeconds ) : string
sSeconds string
return string

SendMessage() public static method

Sends a message
public static SendMessage ( string action, string data ) : void
action string
data string
return void

SendProgress() public static method

Sends a Progress Message, so that the status bar can be updated
public static SendProgress ( string message ) : void
message string
return void

isARedBookCD() public static method

Checks, if the given Drive Letter is a Red Book (Audio) CD
public static isARedBookCD ( string drive ) : bool
drive string
return bool