#region Disclaimer / License // Copyright (C) 2009, Kenneth Skovhede // http://www.hexad.dk, opensource@hexad.dk // // 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 Maestro.Packaging { /// /// Represents a resource item from a package /// public class ResourceItem { /// /// Initializes a new instance of the class. /// /// The resource path. /// The header path. /// The content path. public ResourceItem(string resourcePath, string headerPath, string contentPath) { m_originalResourcePath = m_resourcePath = resourcePath; m_headerpath = headerPath; m_contentpath = contentPath; m_entryType = EntryTypeEnum.Regular; m_items = new List(); m_isFolder = m_originalResourcePath.EndsWith("/"); } /// /// Initializes a new instance of the class. /// /// The ri. public ResourceItem(ResourceItem ri) { m_originalResourcePath = ri.m_originalResourcePath; m_headerpath = ri.m_headerpath; m_contentpath = ri.m_contentpath; m_resourcePath = ri.m_resourcePath; m_entryType = ri.m_entryType; m_isFolder = ri.m_isFolder; m_items = new List(); foreach (ResourceDataItem rdi in ri.m_items) m_items.Add(new ResourceDataItem(rdi)); } private string m_originalResourcePath; private string m_headerpath; private string m_contentpath; private string m_resourcePath; private EntryTypeEnum m_entryType; private List m_items; private bool m_isFolder; /// /// Gets or sets a value indicating whether this instance is folder. /// /// true if this instance is folder; otherwise, false. public bool IsFolder { get { return m_isFolder; } set { m_isFolder = true; } } /// /// Gets or sets the items. /// /// The items. public List Items { get { return m_items; } set { m_items = value; } } /// /// Gets or sets the type of the entry. /// /// The type of the entry. public EntryTypeEnum EntryType { get { return m_entryType; } set { m_entryType = value; } } /// /// Gets or sets the original resource path. /// /// The original resource path. public string OriginalResourcePath { get { return m_originalResourcePath; } set { m_originalResourcePath = value; } } /// /// Gets or sets the resource path. /// /// The resource path. public string ResourcePath { get { return m_resourcePath; } set { m_resourcePath = value; } } /// /// Gets or sets the contentpath. /// /// The contentpath. public string Contentpath { get { return m_contentpath; } set { m_contentpath = value; } } /// /// Gets or sets the headerpath. /// /// The headerpath. public string Headerpath { get { return m_headerpath; } set { m_headerpath = value; } } internal string GenerateUniqueName() { return this.ResourcePath.Replace("://", "_").Replace("/", "_").Replace(".", "_") + Guid.NewGuid().ToString(); } } }