using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace RainmeterStudio.Core.Model
{
///
/// Reference to a file or folder
///
public class Reference
{
///
/// Gets the name of the reference
///
public string Name { get; private set; }
///
/// Gets the path of the reference
///
public string Path { get; private set; }
///
/// Initializes the reference
///
/// Name of reference
/// Path to item referenced
public Reference(string name, string path = null)
{
Name = name;
Path = path;
}
///
/// Compares a reference to another objects
///
/// Another object
/// True if objects are equal
public override bool Equals(object obj)
{
var other = obj as Reference;
// Types are different, so not equal
if (other == null)
return false;
// Compare using string equals
return String.Equals(Name, other.Name) && String.Equals(Path, other.Path);
}
///
/// Obtains the hash code of this reference
///
/// Hash code
public override int GetHashCode()
{
int hash = (Name == null) ? 0 : Name.GetHashCode();
hash = hash * 7 + ((Path == null) ? 0 : Path.GetHashCode());
return hash;
}
}
}