using SteamWare; using System; namespace MoonProTablet { public class utility { /// /// formatta la durata in minuti in un modo "human readable" gg/min/ore /// /// minuti /// public static string formatDurata(object min) { string answ = ""; DateTime tempo = new DateTime(); double minuti = 0; try { minuti = Convert.ToDouble(min); tempo = tempo.AddMinutes(minuti); } catch { } if (minuti < memLayer.ML.confReadInt("maxMinuti")) { answ = string.Format("{0}m {1}s", tempo.Minute, tempo.Second); } else if (minuti < memLayer.ML.confReadInt("maxOre")) { answ = string.Format("{0}h {1}m", tempo.Hour, tempo.Minute); } else { answ = string.Format("{0}gg {1}h {2}m", tempo.DayOfYear, tempo.Hour, tempo.Minute); } return answ; } } }