Files
limanapp/EgwControlCenter.Core/Models/ReleaseDTO.cs
T
2024-09-18 18:51:41 +02:00

80 lines
2.6 KiB
C#

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
{
/// <summary>
/// Codice/Nome applicativo
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
/// </summary>
public string VersText { get; set; } = "a.b";
/// <summary>
/// Oggetto versione calcolato da VersNum
/// </summary>
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;
}
}
/// <summary>
/// Verifica se sia permessa la versione quando viene valutata la versione massima consentita
/// </summary>
public bool IsPermitted { get; set; } = false;
/// <summary>
/// Data di release
/// </summary>
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
/// <summary>
/// Tag associati a versione, comma separated
/// </summary>
public string RelTags { get; set; } = "";
/// <summary>
/// Url pagina web di changelog (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
public string UrlChangelog { get; set; } = "http://releases.egalware.com";
/// <summary>
/// Url pagina web di changelog estesa (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
public string UrlChangelogExt { get; set; } = "http://releases.egalware.com";
/// <summary>
/// Attivo/Pubblico (qui calcolato, attivo se la data di release è passata, poi potrebbe essere gestito a parte da DB)
/// </summary>
public bool IsActive { get; set; } = false;
}
}