#region Disclaimer / License
// Copyright (C) 2010, Jackie Ng
// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie@gmail.com
//
// This library 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 2.1 of the License, or (at your option) any later version.
//
// This library 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 this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OSGeo.MapGuide.MaestroAPI.Resource
{
///
/// Represents a unique resource type / version pair
///
public class ResourceTypeDescriptor
{
///
/// Initializes a new instance of the class.
///
/// Type of the res.
/// The ver.
public ResourceTypeDescriptor(ResourceTypes resType, string ver)
: this(resType.ToString(), ver)
{ }
private ResourceTypeDescriptor(string resType, string ver)
{
Check.NotEmpty(resType, "resType");
Check.NotEmpty(ver, "ver");
this.ResourceType = resType;
this.Version = ver;
}
///
/// Gets the name of the validating XML schema
///
public string XsdName
{
get
{
return ResourceType + "-" + Version + ".xsd";
}
}
///
/// Gets or sets the type of the resource.
///
/// The type of the resource.
public string ResourceType { get; set; }
///
/// Gets or sets the version.
///
/// The version.
public string Version { get; set; }
///
/// Determines whether the specified is equal to this instance.
///
/// The to compare with this instance.
///
/// true if the specified is equal to this instance; otherwise, false.
///
///
/// The parameter is null.
///
public override bool Equals(object obj)
{
var desc = obj as ResourceTypeDescriptor;
if (desc == null)
return false;
return this.ToString() == desc.ToString();
}
///
/// Returns a that represents this instance.
///
///
/// A that represents this instance.
///
public override string ToString()
{
return this.ResourceType + this.Version;
}
///
/// Returns a hash code for this instance.
///
///
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
///
public override int GetHashCode()
{
return this.ToString().GetHashCode();
}
///
/// Application Definition v1.0.0
///
public static ResourceTypeDescriptor ApplicationDefinition
{
get { return new ResourceTypeDescriptor("ApplicationDefinition", "1.0.0"); }
}
///
/// Feature Source v1.0.0
///
public static ResourceTypeDescriptor FeatureSource
{
get { return new ResourceTypeDescriptor("FeatureSource", "1.0.0"); }
}
///
/// Drawing Source v1.0.0
///
public static ResourceTypeDescriptor DrawingSource
{
get { return new ResourceTypeDescriptor("DrawingSource", "1.0.0"); }
}
///
/// Layer Definition v1.0.0
///
public static ResourceTypeDescriptor LayerDefinition
{
get { return new ResourceTypeDescriptor("LayerDefinition", "1.0.0"); }
}
///
/// Load Procedure v1.0.0
///
public static ResourceTypeDescriptor LoadProcedure
{
get { return new ResourceTypeDescriptor("LoadProcedure", "1.0.0"); }
}
///
/// Map Definition v1.0.0
///
public static ResourceTypeDescriptor MapDefinition
{
get { return new ResourceTypeDescriptor("MapDefinition", "1.0.0"); }
}
///
/// Print Layout v1.0.0
///
public static ResourceTypeDescriptor PrintLayout
{
get { return new ResourceTypeDescriptor("PrintLayout", "1.0.0"); }
}
///
/// Symbol Library v1.0.0
///
public static ResourceTypeDescriptor SymbolLibrary
{
get { return new ResourceTypeDescriptor("SymbolLibrary", "1.0.0"); }
}
///
/// Symbol Definition v1.0.0
///
public static ResourceTypeDescriptor SymbolDefinition
{
get { return new ResourceTypeDescriptor("SymbolDefinition", "1.0.0"); }
}
///
/// Web Layout v1.0.0
///
public static ResourceTypeDescriptor WebLayout
{
get { return new ResourceTypeDescriptor("WebLayout", "1.0.0"); }
}
}
}