/// <summary> /// This function provides a safe way to async-execute any exporter to write to a file directly. /// </summary> /// <param name="exp">The exporter to be used.</param> /// <param name="tt">A readonly copy of the current timetable.</param> /// <param name="filename"></param> /// <param name="pluginInterface">A reduced PluginInterface that provides limited core features from FPledit.</param> /// <param name="flags">Exporter flags.</param> /// <returns>A Task that has not been started yet, which can be used to execute the exporter.</returns> public static Task <bool> GetAsyncSafeExport(this IExport exp, Timetable tt, string filename, IReducedPluginInterface pluginInterface, string[]?flags = null) => new Task <bool>(() => exp.SafeExport(tt, filename, pluginInterface, flags));