C# Class MPTagThat.Core.Util

Afficher le fichier Open project: MediaPortal/MPTagThat

Méthodes publiques

Méthode 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

Méthode 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 méthode

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

CreateCursorFromResource() public static méthode

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

Drive2BassID() public static méthode

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

DurationToSeconds() public static méthode

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

EnterMethod() public static méthode

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

FormatGridColumn() public static méthode

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

FormatID3Tag() public static méthode

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
Résultat TagLib.File

GetCallingMethod() public static méthode

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
Résultat MPTagThat.Core.CallingMethod

GetFolderThumb() public static méthode

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

GetImageAssociatedWithFile() public static méthode

public static GetImageAssociatedWithFile ( string filePath, bool small ) : Image
filePath string
small bool
Résultat Image

GetQualifiedFilename() public static méthode

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

GetWebPage() public static méthode

Returns the requested WebPage
public static GetWebPage ( string requestString ) : string
requestString string
Résultat string

HttpPostRequest() public static méthode

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

IsAudio() public static méthode

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

IsCDDrive() public static méthode

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

IsPicture() public static méthode

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

IsReplayGain() public static méthode

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

LabelToParameter() public static méthode

Convert the Label to a Parameter
public static LabelToParameter ( string label ) : string
label string
Résultat string

LeaveMethod() public static méthode

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

LongestCommonSubstring() public static méthode

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
Résultat double

MakeValidFileName() public static méthode

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

MakeValidFolderName() public static méthode

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

ReadFullStream() public static méthode

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
Résultat byte[]

RelativePathTo() public static méthode

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. ///
Résultat string

RemoveInvalidChars() public static méthode

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

RemoveTrailingSlash() public static méthode

public static RemoveTrailingSlash ( string strLine ) : string
strLine string
Résultat string

ReplaceEx() public static méthode

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

ReplaceParametersWithTrackValues() public static méthode

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

SavePicture() public static méthode

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

SecondsToHMSString() public static méthode

Converts given seconds to HH:mm:ss
public static SecondsToHMSString ( string sSeconds ) : string
sSeconds string
Résultat string

SendMessage() public static méthode

Sends a message
public static SendMessage ( string action, string data ) : void
action string
data string
Résultat void

SendProgress() public static méthode

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

isARedBookCD() public static méthode

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