LoadSettingsFromFile Method

Summary
Loads some or all of the convert object settings from a file.
Syntax
C#
VB
C++
publicvirtualvoidLoadSettingsFromFile(stringsourceFile,ConvertSettingsflags)
PublicOverridableSubLoadSettingsFromFile( _ByValsourceFileAsString, _ByValflagsAsConvertSettings_)
public:virtualvoidLoadSettingsFromFile(String^sourceFile,ConvertSettingsflags)

Parameters

sourceFile
The file from which settings will be loaded.

flags
The setting flags specifying which settings to load. See theConvertSettingsenumeration for the setting options.

Remarks

Loads some or all of the convert object settings from a file. This reconstructs the conversion configuration using the settings found in the file. The convert object settings can be saved to a file by calling theSaveSettingsToFilemethod. Settings can be saved to a stream by calling theSaveSettingsToStreammethod. Settings saved to a stream can be loaded using theLoadSettingsFromStreammethod. It may be helpful to call theCanSaveObjectSettingsmethod before calling the save methods. This ensures the settings can be saved. If eitherSaveSettingsToFileorSaveSettingsToStreamis called for settings that cannot be saved, the save method will fail.

Example
C#
VB
usingLeadtools;usingLeadtools.Multimedia;usingLeadtoolsMultimediaExamples.Fixtures;publicbool_result =false;publicConvertCtrlForm _form =newConvertCtrlForm();publicConvertCtrl _convertctrl;publicstring_streamSettings = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_ObjectSettingsExample_Stream.xml");publicstring_fileSettings = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_ObjectSettingsExample.xml");publicvoidObjectSettingsExample(){// reference the play control_convertctrl = _form.ConvertCtrl;// input and output filesstringinFile = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_Source.avi");stringoutFile = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_ObjectSettingsExample.avi");try{Processor pVideoDizzy = _convertctrl.VideoProcessors.EFXDizzy;// set a video processor_convertctrl.SelectedVideoProcessors.Add(pVideoDizzy);// save the settings to a fileif(SaveFileSettings()){// now clear the selected processors again_convertctrl.SelectedVideoProcessors.Clear();// check whether stream file existsif(File.Exists(_fileSettings)){// load the saved settings from a file// and check whether the processor is selected againLoadFileSettings();// set the result_result = _convertctrl.SelectedVideoProcessors.Contains(pVideoDizzy);}}// save the settings to a streamif(SaveStreamSettings()){// now clear the selected processors again_convertctrl.SelectedVideoProcessors.Clear();// check whether the stream file existsif(File.Exists(_streamSettings)){// load the saved settings from a stream// and check whether the processor is selected againLoadStreamSettings();// set the result_result & = _convertctrl。希利ctedVideoProcessors.Contains(pVideoDizzy);}}}catch(Exception){_result =false;}}privatevoidLoadFileSettings(){_convertctrl.LoadSettingsFromFile(_fileSettings, ConvertSettings.Processors);}privateboolSaveFileSettings(){// check whether we can save the processors settingsif(_convertctrl.CanSaveObjectSettings(ConvertSettings.Processors)){_convertctrl.SaveSettingsToFile(_fileSettings, ConvertSettings.Processors);returntrue;}returnfalse;}privatevoidLoadStreamSettings(){Stream settings =newStreamReader(_streamSettings).BaseStream;_convertctrl.LoadSettingsFromStream(settings, ConvertSettings.Processors);settings.Close();}privateboolSaveStreamSettings(){// check whether we can save the processors settingsif(_convertctrl.CanSaveObjectSettings(ConvertSettings.Processors)){Stream settings =newStreamWriter(_streamSettings,false).BaseStream;_convertctrl.SaveSettingsToStream(settings, ConvertSettings.Processors);settings.Close();returntrue;}returnfalse;}staticclassLEAD_VARS{publicconststringMediaDir =@"C:\LEADTOOLS21\Media";}
ImportsLeadtoolsImportsLeadtools.MultimediaImportsLeadtoolsMultimediaExamples.FixturesPublic_resultAsBoolean=FalsePublic_formAsConvertCtrlForm =NewConvertCtrlForm()Public_convertctrlAsConvertCtrlPublic_streamSettingsAsString= Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_ObjectSettingsExample_Stream.xml")Public_fileSettingsAsString= Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_ObjectSettingsExample.xml")PublicSubObjectSettingsExample()' reference the play control_convertctrl = _form.ConvertCtrl' input and output filesDiminFileAsString= Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_Source.avi")DimoutFileAsString= Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_ObjectSettingsExample.avi")TryDimpVideoDizzyAsProcessor = _convertctrl.VideoProcessors.EFXDizzy' set a video processor_convertctrl.SelectedVideoProcessors.Add(pVideoDizzy)' save the settings to a fileIfSaveFileSettings()Then' now clear the selected processors again_convertctrl.SelectedVideoProcessors.Clear()' check if a stream file existsIfFile.Exists(_fileSettings)Then' load the saved settings from a file' and check if the processor is selected againLoadFileSettings()' set the result_result = _convertctrl.SelectedVideoProcessors.Contains(pVideoDizzy)EndIfEndIf' save the settings to a streamIfSaveStreamSettings()Then' now clear the selected processors again_convertctrl.SelectedVideoProcessors.Clear()' check if a stream file existsIfFile.Exists(_streamSettings)Then' load the saved settings from a stream' and check if the processor is selected againLoadStreamSettings()' set the result_result = _resultAnd_convertctrl.SelectedVideoProcessors.Contains(pVideoDizzy)EndIfEndIfCatche1AsException_result =FalseEndTryEndSubPrivateSubLoadFileSettings()_convertctrl.LoadSettingsFromFile(_fileSettings, ConvertSettings.Processors)EndSubPrivateFunctionSaveFileSettings()AsBoolean' check if we can save the processor's settingsIf_convertctrl.CanSaveObjectSettings(ConvertSettings.Processors)Then_convertctrl.SaveSettingsToFile(_fileSettings, ConvertSettings.Processors)ReturnTrueEndIfReturnFalseEndFunctionPrivateSubLoadStreamSettings()DimsettingsAsStream =NewStreamReader(_streamSettings).BaseStream_convertctrl.LoadSettingsFromStream(settings, ConvertSettings.Processors)settings.Close()EndSubPrivateFunctionSaveStreamSettings()AsBoolean' check if we can save the processors settingsIf_convertctrl.CanSaveObjectSettings(ConvertSettings.Processors)ThenDimsettingsAsStream =NewStreamWriter(_streamSettings,False).BaseStream_convertctrl.SaveSettingsToStream(settings, ConvertSettings.Processors)settings.Close()ReturnTrueEndIfReturnFalseEndFunctionPublicNotInheritableClassLEAD_VARSPublicConstMediaDirAsString="C:\LEADTOOLS21\Media"EndClass
Requirements

Target Platforms

Leadtools.Multimedia Assembly
188金宝搏的网址客服|Support|Contact Us|Intellectual Property Notices
© 1991-2021LEAD Technologies, Inc.All Rights Reserved.