#region "Header"
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#endregion
//
using System.Collections.Generic;
//
namespace DeviceMap
{
///
/// Device data
///
/// eberhard speer jr.
/// Apache DeviceMap Project .Net version
/// ported from Reza Naghibi's Device.java
internal sealed class Device
{
//
private string builderType = string.Empty;
private string deviceId = string.Empty;
private string deviceParent = string.Empty;
private Pattern pattern;
private IDictionary properties;
#region "Properties"
///
/// Property dictionary
///
/// IDictionary(Of String, String)
/// -
public IDictionary Attributes
{
get { return properties; }
set { properties = value; }
}
///
/// Unique Id
///
/// String
/// -
public string Id
{
get { return deviceId; }
set { deviceId = value; }
}
///
/// Unique Parent Id
///
/// String
/// -
public string ParentId
{
get { return deviceParent; }
set { deviceParent = value; }
}
///
/// Pattern collection
///
/// Pattern
/// Collection of patterns to match with User-Agent string
public Pattern Patterns
{
get { return pattern; }
}
///
/// Builder type
///
/// String
/// used to destinguish between 'simple' and 'two-step' device builders
public string Type
{
get { return builderType; }
set { builderType = value; }
}
#endregion
#region "Constructor"
///
/// Default new Device
///
/// -
public Device()
{
pattern = new Pattern();
}
#endregion
#region "Functions"
///
/// To String override
///
/// String
/// -
public override string ToString()
{
return string.Format(Constants.DEVICE_TOSTRING_FORMAT, deviceId, deviceParent, builderType, pattern.ToString(), properties.ToString());
}
#endregion
}
}