Ejemplo n.º 1
0
        public static void Load()
        {
            var pload = new PluginLoadExecuter();

            if (pload.plugins != null)
            {
                foreach (var p in pload.plugins)
                {
                    PluginManager.Register(p);
                }
            }

            if (pload.filters != null)
            {
                foreach (var f in pload.filters)
                {
                    FilterRegistrant.RegisterFilter(f.GetType());
                }
            }

            if (pload.uploaders != null)
            {
                foreach (var u in pload.uploaders)
                {
                    UploaderManager.RegisterUploader(u);
                }
            }

            if (pload.resolvers != null)
            {
                foreach (var r in pload.resolvers)
                {
                    UploaderManager.RegisterResolver(r);
                }
            }

            // shorteners are no longer supported.

            /*
             * if(pload.shorteners != null)
             *  foreach (var s in pload.shorteners)
             *  {
             *      ShortenManager.RegisterShortener(s);
             *  }
             */

            if (pload.extractors != null)
            {
                foreach (var e in pload.extractors)
                {
                    ShortenManager.RegisterExtractor(e);
                }
            }
        }
Ejemplo n.º 2
0
            public static Expression Missing(DispatchExpression e, SymbolTable s, Type t)
            {
                Type type;

                if (e.DispatchType == DispatchTypes.Method &&
                    !s.ExistsKey(DispatchTypes.Method, e.Name) &&
                    (type = FilterRegistrant.GetFilter(e.Name).FirstOrDefault()) != null
                    )
                {
                    return(YacqExpression.Dispatch(
                               s,
                               DispatchTypes.Constructor,
                               YacqExpression.TypeCandidate(type),
                               null,
                               e.Arguments
                               )
                           .Method(s, "Filter", YacqExpression.Identifier(s, "it")));
                }
                return(DispatchExpression.DefaultMissing(e, s, t));
            }
Ejemplo n.º 3
0
 private IEnumerable <string> GetFilterDescriptions()
 {
     foreach (var s in FilterRegistrant.FilterKeys.OrderBy(s => s))
     {
         int localcount = 0;
         foreach (var type in FilterRegistrant.GetFilter(s))
         {
             if (type != null)
             {
                 FilterBase inst = null;
                 var        ci   = type.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)[0];
                 if (ci != null)
                 {
                     inst = ci.Invoke(new object[0]) as FilterBase;
                 }
                 if (inst != null)
                 {
                     if (inst.IsOnlyForTranscender &&
                         !Setting.Instance.ExperienceProperty.IsTranscender)
                     {
                         continue;
                     }
                     if (inst.Identifier != s) // hit by alias
                     {
                         continue;
                     }
                     if (localcount > 0)
                     {
                         yield return(s + "(" + localcount + "): " + inst.Description);
                     }
                     else
                     {
                         yield return(s + ": " + inst.Description);
                     }
                 }
             }
         }
     }
 }