LoadSettingsFromStream Method

Summary
Loads settings from a stream.
Syntax
C#
C++/CLI
public virtual void LoadSettingsFromStream( 
   Stream sourceStream, 
   PlaySettings flags 
) 
public: 
virtual void LoadSettingsFromStream(  
   Stream^ sourceStream, 
   PlaySettings flags 
)  

Parameters

sourceStream
The stream containing the saved settings to load.

flags
The PlaySettings enumeration values specifying which settings to load.

Remarks

This method reconstructs the play control configuration based on the settings loaded from the specified stream. Play control settings can be saved to a stream by calling SaveSettingsToStream, or to a file by calling SaveSettingsToFile. Settings saved to a stream can be loaded using LoadSettingsFromStream.

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
public bool _result = false; 
public PlayCtrlForm _form = new PlayCtrlForm(); 
public PlayCtrl _playctrl; 
 
public string _streamSettings = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ObjectSettingsExample_Stream.xml"); 
public string _fileSettings = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_ObjectSettingsExample.xml"); 
 
public void ObjectSettingsExample() 
{ 
   // reference the play control 
   _playctrl = _form.PlayCtrl; 
 
   // input files 
   string inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi"); 
 
   try 
   { 
      Processor pVideoDizzy = _playctrl.VideoProcessors.EFXDizzy; 
      // set a video processor 
      _playctrl.SelectedVideoProcessors.Add(pVideoDizzy); 
 
      // save the settings to a file 
      if (SaveFileSettings()) 
      { 
         // now clear the selected processors again 
         _playctrl.SelectedVideoProcessors.Clear(); 
 
         // check whether a stream file exists 
         if (File.Exists(_fileSettings)) 
         { 
            // load the saved settings from a file 
            // and check whether the processor is selected again 
            LoadFileSettings(); 
 
            // set the result  
            _result = _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy); 
         } 
      } 
 
      // save the settings to a stream 
      if (SaveStreamSettings()) 
      { 
         // now clear the selected processors again 
         _playctrl.SelectedVideoProcessors.Clear(); 
 
         // check whether a stream file exists 
         if (File.Exists(_streamSettings)) 
         { 
            // load the saved settings from a stream  
            // and check whether the processor is selected again 
            LoadStreamSettings(); 
 
            // set the result  
            _result &= _playctrl.SelectedVideoProcessors.Contains(pVideoDizzy); 
         } 
      } 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
} 
 
private void LoadFileSettings() 
{ 
   _playctrl.LoadSettingsFromFile(_fileSettings, PlaySettings.Processors); 
} 
 
private bool SaveFileSettings() 
{ 
   //  check whether we can save the processors settings 
   if (_playctrl.CanSaveObjectSettings(PlaySettings.Processors)) 
   { 
      _playctrl.SaveSettingsToFile(_fileSettings, PlaySettings.Processors); 
      return true; 
   } 
   return false; 
} 
 
private void LoadStreamSettings() 
{ 
   Stream settings = new StreamReader(_streamSettings).BaseStream; 
   _playctrl.LoadSettingsFromStream(settings, PlaySettings.Processors); 
   settings.Close(); 
} 
 
private bool SaveStreamSettings() 
{ 
   //  check whether we can save the processors settings 
   if (_playctrl.CanSaveObjectSettings(PlaySettings.Processors)) 
   { 
      Stream settings = new StreamWriter(_streamSettings, false).BaseStream; 
      _playctrl.SaveSettingsToStream(settings, PlaySettings.Processors); 
      settings.Close(); 
      return true; 
   } 
   return false; 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\LEADTOOLS22\Media"; 
} 
Requirements

Target Platforms

See Also

Reference

PlayCtrl Class

PlayCtrl Members

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Multimedia Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.