public bool Converter(FileConverterContext context) { foreach (var conveter in _conveters) { if (context.IsConvertSuccess) { conveter.Convert(context); } } return(true); }
private FileConverterPath GetConvertPath(FileConverterContext context) { foreach (var path in _conveterPaths) { if (path.CanConvert(context)) { return(path); } } foreach (var path in _calcConveterPathsCache) { if (path.CanConvert(context)) { return(path); } } return(CalculateConvertPath(context)); }
public bool ConverterAsync(FileConverterContext context) { return(true); }
public bool CanConvert(FileConverterContext context) { return(TargetType == context.TargetType && AcceptTypes.Contains(context.InputType)); }
//需要使用最短路径算法,感觉有点复杂。这也是实际算法应用的一个挑战,乱复制就有多份了。 private FileConverterPath CalculateConvertPath(FileConverterContext context) { throw new NotImplementedException(); }
public bool ConverterAsync(FileConverterContext context) { var path = GetConvertPath(context); return(path.ConverterAsync(context)); }
public Task <FileConverterContext> ConvertAsync(FileConverterContext context) { throw new NotImplementedException(); }
public FileConverterContext Convert(FileConverterContext context) { throw new NotImplementedException(); }