26 static string FloatToStringNoZeroDecimalEndings(
float value,
int lenDec)
28 return value.ToString(lenDec: lenDec).ToFloat().ToString();
33 static string FormatDateTime(
int year,
int month,
int day,
int hour,
int minute,
int second)
35 return string.Format(
"%1 %2", FormatDate(year, month, day), FormatTime(hour, minute, second));
41 static string FormatDate(
int year,
int month,
int day)
45 return string.Format(
"%1-%2-%3", year.ToString(4), month.ToString(2), day.ToString(2));
50 static string FormatTime(
int totalSeconds)
52 int hour, minute, second;
54 return FormatTime(hour, minute, second);
59 static string FormatTime(
int hour,
int minute,
int second)
61 return string.Format(
"%1:%2:%3", hour.ToString(2), minute.ToString(2), second.ToString(2));
80 string returnString =
"";
86 returnString += days.ToString();
92 returnString += ReturnTimeTypeString(days, hours, ((hideLeadingZeroes &
ETimeFormatParam.HOURS) == 0) +1);
98 returnString += ReturnTimeTypeString(hours, minutes, ((hideLeadingZeroes &
ETimeFormatParam.MINUTES) == 0) +1);
104 returnString += ReturnTimeTypeString(minutes, seconds, ((hideLeadingZeroes &
ETimeFormatParam.SECONDS) == 0) +1);
113 protected static string ReturnTimeTypeString(
int prevTimeTypeAmount,
int currentTimeTypeAmount,
int numberLength)
115 if (prevTimeTypeAmount > -1)
116 return ":" + currentTimeTypeAmount.ToString(numberLength);
118 return currentTimeTypeAmount.ToString(numberLength);
133 int days, hours, minutes, seconds;
134 SCR_DateTimeHelper.GetDayHourMinuteSecondFromSeconds(totalSeconds, days, hours, minutes, seconds);
135 return GetTimeFormatting(days, hours, minutes, seconds, hideEmpty, hideLeadingZeroes);
150 int days, hours, minutes, seconds;
151 SCR_DateTimeHelper.GetDayHourMinuteSecondFromSeconds(totalSeconds, days, hours, minutes, seconds);
152 return GetTimeFormatting(days, hours, minutes, -1,
ETimeFormatParam.SECONDS | hideEmpty, hideLeadingZeroes);
185 protected static string GetTimeSinceEventString(
int amount,
string oneUnit,
string manyUnits)
188 return WidgetManager.Translate(oneUnit, amount);
190 return WidgetManager.Translate(manyUnits, amount);
196 static string GetTimeSinceEventImprecise(
int timeDiffSeconds)
198 if (timeDiffSeconds < 0)
201 int days, hours, minutes, remainingSeconds;
202 SCR_DateTimeHelper.GetDayHourMinuteSecondFromSeconds(timeDiffSeconds, days, hours, minutes, remainingSeconds);
205 return GetTimeSinceEventString(days,
"#AR-Date_DayAgo_LC",
"#AR-Date_DaysAgo_LC");
207 return GetTimeSinceEventString(hours,
"#AR-Time_HourAgo_LC",
"#AR-Time_HoursAgo_LC");
209 return GetTimeSinceEventString(minutes,
"#AR-Time_MinuteAgo_LC",
"#AR-Time_MinutesAgo_LC");
218 static string FormatFrequencies(notnull set<int> frequencies, set<int> highlightFrequencies =
null)
220 if (frequencies.IsEmpty())
224 float accurateFrequency;
225 foreach (
int i,
int frequency : frequencies)
229 accurateFrequency = frequency;
230 if (highlightFrequencies && highlightFrequencies.Contains(frequency))
231 text +=
string.Format(
"<color rgba='226,168,79,255'>%1</color>", accurateFrequency / 1000);
233 text += (accurateFrequency / 1000).ToString();
235 return text +
" #AR-VON_FrequencyUnits_MHz";