using System; namespace FileInterface.Scheduler { public sealed class CustomFunctionCallResult { public bool Success { get; set; } public string Message { get; set; } public static CustomFunctionCallResult Ok(string message) { return new CustomFunctionCallResult { Success = true, Message = message ?? "OK" }; } public static CustomFunctionCallResult Fail(string message) { return new CustomFunctionCallResult { Success = false, Message = message ?? "CustomFunction failed" }; } } public interface ICustomFunctionInvoker { CustomFunctionCallResult Invoke(string customFunctionName, string[] inArgs); } /// /// Lets the existing FileInterface IMS code remain untouched. Wire the current /// IMS CustomFunction call into this delegate in Program.cs / service startup. /// public sealed class DelegateCustomFunctionInvoker : ICustomFunctionInvoker { private readonly Func _handler; public DelegateCustomFunctionInvoker(Func handler) { if (handler == null) throw new ArgumentNullException("handler"); _handler = handler; } public CustomFunctionCallResult Invoke(string customFunctionName, string[] inArgs) { return _handler(customFunctionName, inArgs); } } }