using System.Xml.Linq;
using Vrh.XmlProcessing;
namespace Vrh.OneReport
{
///
/// A "DefaultFolder" elemet reprezentáló osztály.
/// "General" és "Report" elemben is előfordul.
///
public class FolderElement : XmlLinqBase
{
#region AttributeNames static class
///
/// Az XML fájlban ilyen attribútum nevek találhatóak egy "Output" elemben.
///
public static class AttributeNames
{
///
/// 'action' attribútum név.
///
public const string EXPORT = "Export";
///
/// 'file' attribútum név.
///
public const string FILE = "File";
///
/// 'folder' attribútum név.
///
public const string RDL = "Rdl";
}
#endregion AttributeNames static class
#region Properties
///
/// Exportok számára alapértelmezett mappa.
///
public string Export { get; set; }
///
/// Az oputput-ok (riportok) számára alapértelmezett mappa.
///
public string File { get; set; }
///
/// Az RDL fájlok forrásmappája.
///
public string Rdl { get; set; }
#endregion Properties
#region Constructor
///
/// Példány létrehozása egy XElement alapján.
///
/// A "DefaultFolder" elem.
///
/// Egy FolderElement objektum, mely alapértelmezett értékeket tartalmaz.
///
public FolderElement(XElement xelement, FolderElement defaultFolder = null)
{
if (xelement != null)
{
this.Export = GetValue(
xelement.Attribute(AttributeNames.EXPORT),
defaultFolder == null ? "" : defaultFolder.Export
);
this.File = GetValue(
xelement.Attribute(AttributeNames.FILE),
defaultFolder == null ? "" : defaultFolder.File
);
this.Rdl = GetValue(
xelement.Attribute(AttributeNames.RDL),
defaultFolder == null ? "" : defaultFolder.Rdl
);
}
else
{
if (defaultFolder != null)
{
this.Export = defaultFolder.Export;
this.File = defaultFolder.File;
this.Rdl = defaultFolder.Rdl;
}
}
}
#endregion Constructor
}
}