public static SIImage New(ITracer aTracer, FileInfo aFileInfo) { SIImage ret = null; // if (aFileInfo.Exists) { Stream fileStream = aFileInfo.OpenRead(); try { // If creating the image succeeds then we transfer ownership // of the file stream ret = SIImage.New(aTracer, fileStream, aFileInfo.FullName); if (ret == null) { fileStream.Close(); } } catch (Exception) { fileStream.Close(); } } // return(ret); }
public static SIImage New(ITracer aTracer, Stream aStream, string aName) { SIImage ret = null; // PluginManager <SIFactory> imageFactories = new PluginManager <SIFactory>(); imageFactories.LoadFromCallingAssembly(); foreach (SIFactory factory in imageFactories) { ret = factory.CreateImage(aTracer, aStream, aName); if (ret != null) { break; } } // return(ret); }
public static SIImage New(ITracer aTracer, string aFileName) { return(SIImage.New(aTracer, new FileInfo(aFileName))); }