/// <summary> /// Ported from format_date /// </summary> public string FormatDate(Date when, FormatTypeEnum formatType = FormatTypeEnum.FMT_PRINTED, string format = null) { if (formatType == FormatTypeEnum.FMT_WRITTEN) { return(WrittenDateIO.Format(when)); } else if (formatType == FormatTypeEnum.FMT_CUSTOM && format != null) { DateIO dateIO; if (TempDateIO.TryGetValue(format, out dateIO)) { return(dateIO.Format(when)); } else { dateIO = new DateIO(format, false); TempDateIO.Add(format, dateIO); return(dateIO.Format(when)); } } else if (formatType == FormatTypeEnum.FMT_PRINTED) { return(PrintedDateIO.Format(when)); } throw new InvalidOperationException("formatter"); }
public void TimesShutdown() { if (IsInitialized) { InputDateTimeIO = null; TimelogDateTimeIO = null; WrittenDateTimeIO = null; WrittenDateIO = null; PrintedDateTimeIO = null; PrintedDateIO = null; Readers.Clear(); TempDateIO.Clear(); TempDateTimeIO.Clear(); // [DM] Reset custom epoch settings Epoch = null; IsInitialized = false; } }