#region Disclaimer / License // Copyright (C) 2015, The Duplicati Team // http://www.duplicati.com, info@duplicati.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 Duplicati.License { /// /// Class that represents a single license entry /// public class LicenseEntry { /// /// The component title /// public readonly string Title; /// /// The homepage of the component /// public string Url; /// /// The license for the component /// public readonly string License; /// /// The json data /// public string Jsondata; /// /// Constructs a new license entry /// /// The component title /// The homepage of the component /// The license for the component public LicenseEntry(string title, string urlfile, string licensefile, string jsonfile) { Title = title; if (!string.IsNullOrEmpty(urlfile) && System.IO.File.Exists(urlfile)) Url = System.IO.File.ReadAllText(urlfile).Trim(); License = System.IO.File.ReadAllText(licensefile); if (License.IndexOf("\r\n", StringComparison.Ordinal) < 0) License = License.Replace("\n", "\r\n").Replace("\r", "\r\n"); if (Environment.NewLine != "\r\n") License = License.Replace("\r\n", Environment.NewLine); if (jsonfile != null) Jsondata = System.IO.File.ReadAllText(jsonfile); } /// /// Returns the title of the item as the identification /// /// The item title public override string ToString() { return Title; } } }