Beispiel #1
0
        private static Type GetCompererTypeForParms(IImageCompererParms parms)
        {
            Type[] types         = Assembly.GetExecutingAssembly().GetTypes();
            var    compererTypes = types
                                   .Where(t => t.IsSubclassOf(typeof(ImageCompererBase)) &&
                                          !t.IsAbstract &&
                                          t.GetConstructor(new Type[] { typeof(string), typeof(string), parms.GetType() }) != null);

            var comprerType = compererTypes.First();

            return(comprerType);
        }
Beispiel #2
0
        public virtual ImageCompererBase Create(string image1Path, string image2Path, IImageCompererParms parms)
        {
            var comprerType = GetCompererTypeForParms(parms);

            var comperer = Activator.CreateInstance(comprerType, image1Path, image2Path, parms);

            return(comperer as ImageCompererBase);
        }
 public void LoadDiffIamge(Image DiffImage, string DiffFilePath, string RecivedFilePath, string ApprovedFilePath, IImageCompererParms CurrnentParms)
 {
     using (TempFile tmp = new TempFile(DiffFilePath)) //remove the file after using
         using (var comperer = compererFactory.Create(RecivedFilePath, ApprovedFilePath, CurrnentParms))
         {
             comperer.SaveDiffIamgeTo(DiffFilePath);
             if (!comperer.NoFileExists)
             {
                 imageLoader.LoadImage(DiffImage, DiffFilePath);
             }
         }
 }