Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 public static SIImage New(ITracer aTracer, string aFileName)
 {
     return(SIImage.New(aTracer, new FileInfo(aFileName)));
 }