using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwControlCenter.Core.Models
{
public class ReleaseDTO
{
///
/// Codice/Nome applicativo
///
public string CodApp { get; set; } = "";
///
/// Versione applicativo formato semver numerico 4 blocchi
///
public string VersNum { get; set; } = "0.0.0.0";
///
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
///
public string VersText { get; set; } = "a.b";
///
/// Oggetto versione calcolato da VersNum
///
public Version VersVal
{
get
{
Version answ = new Version();
try
{
// solo se è una versione valida: SemVer = 2/3 punti
int numPunti = VersNum.Length - VersNum.Replace(".", "").Length;
if (numPunti >= 2 && numPunti <= 3)
{
answ = !string.IsNullOrEmpty(VersNum) ? new Version(VersNum) : new Version();
}
}
catch { }
return answ;
}
}
///
/// Verifica se sia permessa la versione quando viene valutata la versione massima consentita
///
public bool IsPermitted { get; set; } = false;
///
/// Data di release
///
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
///
/// Tag associati a versione, comma separated
///
public string RelTags { get; set; } = "";
///
/// Url pagina web di changelog (traduzione gestita sul sito target) - calcolato da CodApp + vers
///
public string UrlChangelog { get; set; } = "http://releases.egalware.com";
///
/// Url pagina web di changelog estesa (traduzione gestita sul sito target) - calcolato da CodApp + vers
///
public string UrlChangelogExt { get; set; } = "http://releases.egalware.com";
///
/// Attivo/Pubblico (qui calcolato, attivo se la data di release è passata, poi potrebbe essere gestito a parte da DB)
///
public bool IsActive { get; set; } = false;
}
}