using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using RainmeterStudio.Core.Model;
using RainmeterStudio.Core.Utils;
namespace RainmeterStudio.Core.Storage
{
///
/// Represents a reference that can be serialized
///
public class SerializableReference
{
///
/// Gets or sets the name of the reference
///
[XmlElement("storagePath")]
public string StoragePath
{
get
{
// Return only relative paths
if (Path.IsPathRooted(Reference.StoragePath))
{
return PathHelper.GetRelativePath(Reference.StoragePath);
}
return Reference.StoragePath;
}
set
{
Reference = new Reference(value, ProjectPath);
}
}
///
/// Gets or sets the path of the reference
///
[XmlElement("projectPath")]
public string ProjectPath
{
get
{
return Reference.ProjectPath;
}
set
{
Reference = new Reference(StoragePath, value);
}
}
///
/// Gets or sets the (immutable) reference
///
[XmlIgnore]
public Reference Reference
{
get;
set;
}
///
/// Initializes this serializable reference
///
public SerializableReference()
{
}
///
/// Initializes this serializable reference
///
/// Reference to use
public SerializableReference(Reference reference)
{
Reference = reference;
}
}
}