LoadProfileByData Method

Summary
Creates a profile object and fills it with the data from the passed string.
Syntax
C#
C++/CLI
public WMProfile LoadProfileByData( 
   string Profile 
) 
public: 
WMProfile^ LoadProfileByData(  
   String^ Profile 
)  

Parameters

Profile
An XML-formatted string that contains the profile data to load.

Return Value

A WMProfile object filled with profile data

Remarks

Creates a profile object and fills it with the data from the passed string. The passed string is an XML-formatted string saved using the SaveProfile method. This method is used to manipulate custom profiles, while system profiles are accessed using the LoadProfileByID or LoadSystemProfile methods. For more information, refer to the Microsoft documentation for IWMProfileManager.LoadProfileByData.

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
public bool _result = false; 
public ConvertCtrlForm _form = new ConvertCtrlForm(); 
public TestCtrlSubForm _subform = new TestCtrlSubForm(); 
 
// this demo for enumerates system profiles and displays profile info 
 
public void SaveProfileExample() 
{ 
   ConvertCtrl convertctrl = _form.ConvertCtrl; 
   string inFile = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_Source.avi"); 
 
   try 
   { 
      // create the profile manager 
      WMProfileManager manager = new WMProfileManager(); 
 
      // build a list of system profiles 
      BuildSystemProfileList(_subform.List); 
 
      // show the dialog 
      _subform.ShowDialog(_form); 
 
      int idx = _subform.List.SelectedIndex; 
 
      // load the selected profile 
      WMProfile profile = LoadSystemProfile(manager, idx); 
 
      // convert to string 
      string sprof = ProfileToString(manager, profile); 
 
      // display the string 
      if (profile.Version == WMT_Version.V8) 
      { 
         MessageBox.Show("Profile " 
                           + profile.Name 
                           + " Content: " 
                           + sprof 
                           + "This profile contains " 
                           + profile.StreamCount.ToString() 
                           + " streams and " 
                           + profile.MutualExclusionCount.ToString() 
                           + " mutex"); 
      } 
 
      // convert string to profile 
      profile = ProfileFromString(manager, sprof); 
 
      // dispose the manager 
      manager.Dispose(); 
 
      // set the result 
      _result = true; 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
 
   // we'll loop on the state and pump messages for this example. 
   // but you should not need to if running from a Windows Forms application. 
   while (convertctrl.State == ConvertState.Running) 
      Application.DoEvents(); 
} 
 
private void BuildSystemProfileList(ListBox lbSysProfiles) 
{ 
   // create the profile manager 
   WMProfileManager manager = new WMProfileManager(); 
   WMProfile profile; 
 
   // set the version to show Windows Media 8.0 system profiles 
   manager.SystemProfileVersion = WMT_Version.V8; 
 
   // walk the list of system profiles and add the name to the combo box 
   lbSysProfiles.Items.Clear(); 
 
   // enumerate the system profiles 
   for (int i = 0; i < manager.SystemProfileCount - 1; i++) 
   { 
      profile = manager.LoadSystemProfile(i); 
      lbSysProfiles.Items.Add(profile.Name); 
   } 
} 
 
private WMProfile LoadSystemProfile(WMProfileManager manager, int idx) 
{ 
   // set the version to load Windows Media 8.0 system profiles 
   manager.SystemProfileVersion = WMT_Version.V8; 
 
   // load the specified profile 
   return manager.LoadSystemProfile(idx); 
} 
 
private string ProfileToString(WMProfileManager manager, WMProfile profile) 
{ 
   // convert the profile to string 
   return manager.SaveProfile(profile); 
} 
 
private WMProfile ProfileFromString(WMProfileManager manager, string profilestr) 
{ 
   // load profile from string data 
   return manager.LoadProfileByData(profilestr); 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\LEADTOOLS22\Media"; 
} 
Requirements

Target Platforms

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.