예제 #1
0
파일: Core.cs 프로젝트: moyakiki/tesseract
        static void SelectBackend()
        {
            Type[] types = Assembly.GetExecutingAssembly().GetTypes();

            foreach (Type t in types)
            {
                if (t.GetInterface("IBackend") != null)
                {
                    IBackend b = (IBackend)Activator.CreateInstance(t);

                    if (!b.CanUse())
                    {
                        Debug.Info("Unable to use backend " + t.Name);
                    }
                    else
                    {
                        backend = b;
                        Debug.Info("Using backend " + t.Name);
                        return;
                    }
                }
            }

            Debug.Fatal("Unable to find suitable backend");
        }