61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
//----------------------------------------------------------------------------
|
|
//
|
|
// Copyright (c) Intel Corporation, 2008 - 2009 All Rights Reserved.
|
|
//
|
|
// File: CimParam.cs
|
|
//
|
|
// Contents: CimParam is a part of the CimFramework project.
|
|
// It implements a Cim param class.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
using System;
|
|
using System.Reflection;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Xml;
|
|
using System.Xml.XPath;
|
|
using System.Xml.Serialization;
|
|
using Intel.Manageability.Cim;
|
|
using Intel.Manageability.Exceptions;
|
|
|
|
namespace Intel.Manageability.Cim
|
|
{
|
|
/// <summary>
|
|
/// A class which store the data in the order it was inserted .
|
|
/// This class is the base class for all cim classes.
|
|
/// </summary>
|
|
public abstract class CimParam : CimData
|
|
{
|
|
public CimParam(string className, string nameSpace)
|
|
: base(className, nameSpace)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Append New CIM Field
|
|
/// </summary>
|
|
/// <param name="name">Field name</param>
|
|
/// <param name="values">Array of field values.</param>
|
|
public override void AddField(string name, string[] values)
|
|
{
|
|
if (values == null)
|
|
throw new NullReferenceException();
|
|
if (ContainsField(name))
|
|
throw (new CimException(string.Format("AddField: Field \"{0}\" already exists", name)));
|
|
|
|
|
|
XmlElement root = _xmlMembers.DocumentElement;
|
|
foreach (string val in values)
|
|
{
|
|
//Create a new node.
|
|
XmlElement elem = _xmlMembers.CreateElement(name, _xmlNamespace);
|
|
//elem.InnerText = val;
|
|
elem.InnerXml = val;
|
|
root.AppendChild(elem);
|
|
}
|
|
}
|
|
}
|
|
}
|