public sealed class Converter : IDisposable
Public NotInheritable Class Converter
Implements IDisposable
Dim instance As Converter
public ref class Converter sealed : IDisposable
[<SealedAttribute>]
type Converter =
class
interface IDisposable
end
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
Sub Test()
Private WithEvents converter As New Converter(".\CoreConverter.exe")
Private Sub Test() Handles MyBase.Shown
If Not converter.Exists Then
MessageBox.Show(String.Format("Coreconverter.exe not found in {0}", converter.FilePath))
End If
' Convert a file to MP3.
converter.ConvertToMP3("C:\Input.wav", "C:\Output.mp3",
LameBitrate.Kbps320,
LameBitrateMode.Cbr,
LameFrequency.SameAsSource,
LameProfile.Slow,
LameQuality.Maximum,
LameChannelMode.Auto,
CoreConverterDspEffect.DeleteOutputFileOnError Or CoreConverterDspEffect.RecycleSourceFileAfterConversion,
False,
CoreConverterPriority.Normal)
' Convert a file to WAV.
converter.ConvertToWav("C:\Input.mp3", "C:\Output.wav",
WavBitdepth.SameAsSource,
WavFrequency.SameAsSource,
WavChannelMode.SameAsSource,
CoreConverterDspEffect.None,
False,
CoreConverterPriority.Normal)
' Convert a file to WMA.
converter.ConvertToWma("C:\Input.mp3", "C:\Output.wma",
Wma9Bitrate.Kbps128,
Wma9Frequency.Khz44100,
Wma9ChannelMode.Stereo,
CoreConverterDspEffect.None,
False,
CoreConverterPriority.Normal)
End Sub
''' ----------------------------------------------------------------------------------------------------
''' <summary>
''' Handles the Started event of the converter object instance.
''' </summary>
''' ----------------------------------------------------------------------------------------------------
''' <param name="sender">
''' The source of the event.
''' </param>
'''
''' <param name="e">
''' The <see cref="CoreConverterStartedEventArgs"/> instance containing the event data.
''' </param>
''' ----------------------------------------------------------------------------------------------------
Private Sub Converter_Started(ByVal sender As Object, ByVal e As CoreConverterStartedEventArgs) _
Handles converter.Started
ProgressBar1.Value = ProgressBar1.Minimum
Dim sb As New System.Text.StringBuilder
With sb
.AppendLine(String.Format("Started an ""{0}"" operation", e.Task.ToString()))
.AppendLine(String.Format("Input file is: ""{0}""", e.InputFile))
.AppendLine(String.Format("CoreConverter.exe process id. (PID) is: {0}", CStr(DirectCast(sender, Converter).Process.Id)))
End With
Debug.WriteLine(String.Format("Start Time: {0}", Date.Now.ToLongTimeString))
Debug.WriteLine(sb.ToString())
End Sub
''' ----------------------------------------------------------------------------------------------------
''' <summary>
''' Handles the Exited event of the converter object instance.
''' </summary>
''' ----------------------------------------------------------------------------------------------------
''' <param name="sender">
''' The source of the event.
''' </param>
'''
''' <param name="e">
''' The <see cref="CoreConverterExitedEventArgs"/> instance containing the event data.
''' </param>
''' ----------------------------------------------------------------------------------------------------
Private Sub Converter_Exited(ByVal sender As Object, ByVal e As CoreConverterExitedEventArgs) _
Handles converter.Exited
Dim sb As New System.Text.StringBuilder
With sb
.AppendLine(String.Format("Finished an ""{0}"" operation", e.Task.ToString()))
.AppendLine(String.Format("Input file is: ""{0}""", e.InputFile))
.AppendLine(String.Format("Output file is: ""{0}""", e.OutputFile))
End With
If Not String.IsNullOrEmpty(e.ErrorMessage) Then
sb.AppendLine(String.Format("Error Information: {0}", e.ErrorMessage))
End If
If Not String.IsNullOrEmpty(e.ElapsedTime) Then
sb.AppendLine(String.Format("Total elapsed time: {0}", e.ElapsedTime))
End If
Debug.WriteLine(sb.ToString())
Debug.WriteLine(String.Format("End Time: {0}", Date.Now.ToLongTimeString))
End Sub
''' ----------------------------------------------------------------------------------------------------
''' <summary>
''' Handles the ProgressUpdated event of the converter object instance.
''' </summary>
''' ----------------------------------------------------------------------------------------------------
''' <param name="sender">
''' The source of the event.
''' </param>
'''
''' <param name="e">
''' The <see cref="CoreConverterProgressEventArgs"/> instance containing the event data.
''' </param>
''' ----------------------------------------------------------------------------------------------------
Private Sub Converter_ProgressChanged(ByVal sender As Object, ByVal e As CoreConverterProgressEventArgs) _
Handles converter.ProgressChanged
ProgressBar1.Value = e.Percent
Label1.Text = CStr(e.Percent)
Application.DoEvents()
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
Converter | Initializes a new instance of the Converter class. |
Exists | Gets a value indicating whether the CoreConverter.exe file Exists. |
FilePath | Gets the CoreConverter.exe filepath. |
Process | Gets the CoreConverter.exeProcess instance. |
Exited | Event raised when the CoreConverter.exe process has exited. |
ProgressChanged | Event raised when CoreConverter.exe task progress has been changed. |
Started | Event raised when the CoreConverter.exe process has been started. |
CanConvertTo |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
CanConvertToT |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions) |
IsDisposable |
Determines whether the specified object is a disposable type
(i.e., it implements IDisposable interface).
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
ThrowIfNullTException |
Throws the specified exception if the source object is null.
(Defined by ObjectExtensions) |