#region Copyright
// Diagnostic Explorer, a .Net diagnostic toolset
// Copyright (C) 2010 Cameron Elliot
//
// This file is part of Diagnostic Explorer.
//
// Diagnostic Explorer is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Diagnostic Explorer is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Diagnostic Explorer. If not, see <http://www.gnu.org/licenses/>.
//
// http://diagexplorer.sourceforge.net/
#endregion
using System;
using System.Runtime.Serialization;
using System.Xml.Serialization;
namespace DiagnosticExplorer
{
[DataContract(Namespace = "http://diagnosticexplorer.com/2010")]
public class Property
{
public Property()
{
}
public Property(string name)
: this(name, null, null, null)
{
}
public Property(string name, string category)
: this(name, category, null, null)
{
}
public Property(string name, string category, string value) : this(name, category, value, null)
{
}
public Property(string name, string category, string value, string description)
{
Name = name;
Category = category;
Value = value;
Description = description;
}
[DataMember]
public string Name { get; set; }
[DataMember]
public string Category { get; set; }
[DataMember]
public string Value { get; set; }
[DataMember(Order = 2, IsRequired = false)]
public string Description { get; set; }
public override string ToString()
{
string cat = string.IsNullOrEmpty(Category)
? "" : string.Format("{0}.", Category);
string descr = string.IsNullOrEmpty(Description)
? "" : string.Format(" ({0})", Description);
return string.Format("{0}{1} = [{2}]{3}", cat, Name, Value, descr);
}
}
}