Exemple #1
0
        static IImageProcess imageProcess;  //图像处理类
        public static bool Init(string filename)
        {
            try
            {
                byte[] assemblyBuffer = File.ReadAllBytes(filename);
                ass = Assembly.Load(assemblyBuffer);
                //ass = Assembly.LoadFrom(filename);
                foreach (var t in ass.GetTypes())
                {
                    if (t.GetInterface("IImageProcess") != null)
                    {
                        imageProcess = (IImageProcess)Activator.CreateInstance(t);
                    }
                }
                string pPath = Path.GetDirectoryName(filename);
                imageProcess.Init(pPath);
                return(true);
            }
            catch (Exception ee)
            {
                MessageBox.Show("加载配方初始化失败:" + ee.ToString());

                return(false);
            }
        }
Exemple #2
0
 static IImageProcess imageProcess;  //图像处理类
 public static bool init(string filename)
 {
     try
     {
         ass = Assembly.LoadFrom(filename);
         foreach (var t in ass.GetTypes())
         {
             if (t.GetInterface("IImageProcess") != null)
             {
                 imageProcess = (IImageProcess)Activator.CreateInstance(t);
             }
         }
         imageProcess.Init();
     }
     catch
     {
         MessageBox.Show("加载配方初始化失败");
         return(false);
     }
     return(true);
 }