Describes the definition of a setting.
Namespace:
Microsoft.ComponentStudio.ComponentPlatformInterface
Assembly:
Microsoft.ComponentStudio.ComponentPlatformInterface (in
microsoft.componentstudio.componentplatforminterface.dll)
Usage
Syntax
Example
In this example, you set the working directory that
contains the catalogs. You then retrieve all the catalogs in that
directory, create a StreamWriter object and enumerate the
ComponentSettings collection. Finally, you write setting names
and types as well as the configuration passes to the StreamWriter
object and display a success message.
Note: |
To run this example, you must change the value of the variable
myFolder to the name of the folder that contains the
catalogs on your machine. |
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ComponentStudio.ComponentPlatformInterface;
using System.IO;
namespace GoFish_Revision
{
class Program
{
static void Main(string[] args)
{
// get current directory
// string currentdir = Directory.GetCurrentDirectory();
string currentdir = @"C:\myFolder";
// get all catalogs in the current directory
string[] dirs = Directory.GetFiles(currentdir, "*.clg");
foreach (string clogs in dirs)
{
//Create new CPI instance
System.Console.WriteLine(clogs);
OfflineImage imageN = Cpi.Instance.OpenOfflineImage(clogs);
//Create new StreamWriter
using (StreamWriter sw = new StreamWriter(clogs + "_LOG.txt"))
{
sw.WriteLine(clogs);
// enumerate ComponentSettings collection
foreach (ComponentSetting compName in imageN.ComponentSettings)
{
sw.WriteLine("========================================");
sw.WriteLine(compName.Id.Name);
int settingCount=0;
//Count settings
foreach (SettingDefinition CountCycle in compName.SettingDefinitions)
{
settingCount++;
}
sw.WriteLine("-- " + settingCount + " settings");
//Write setting names & types
foreach (SettingDefinition settingDef in compName.SettingDefinitions)
{
sw.WriteLine(settingDef.Path + " [" + settingDef.DataType + "] ");
settingCount++;
//Write configuration passes
foreach (ConfigurationPass settingPass in settingDef.ApplicableConfigurationPasses)
{
sw.WriteLine(" " + settingPass);
}
}
}
}
}
}
}
}
/* Output:
Files are written to the specified folder.
*/
|
Remarks
Inheritance
Hierarchy
System.Object
Microsoft.ComponentStudio.ComponentPlatformInterface.SettingDefinition
Thread Safety
Any public static (Shared in Visual
Basic) members of this type are thread safe. Any instance members
are not guaranteed to be thread safe.
Platforms
Development Platforms
Windows XP Home Edition, Windows XP Professional, Windows Server
2003, Windows Vista, and Windows 2000
Target Platforms
See Also