Example #1
0
        private static Type Parse(string[] args, out Match[] matches, out int stopIndex)
        {
            var handlerType = typeof(ExecHandler);
            int priority    = int.MinValue;

            matches = new Match[args.Length];
            for (int i = 0; i < args.Length; i++)
            {
                var m = rParseArg.Match(args[i]);
                matches[i] = m;
                if (!m.Success)
                {
                    stopIndex = i;
                    return(handlerType);
                }
                if (string.IsNullOrEmpty(m.Groups.SuccessOrEmpty(2)))
                {
                    stopIndex = i + 1;
                    return(handlerType);
                }
                HandlerMeta.DoTypeMatch(m, ref handlerType, ref priority);
            }
            stopIndex = args.Length;
            return(handlerType);
        }
Example #2
0
 public static void LoadPlugins()
 {
     foreach (var file in Directory.GetFiles(Path.GetDirectoryName(EnvironmentHelper.ExecPath), "*.elevator-plugin.dll"))
     {
         try {
             HandlerMeta.LoadAssembly(Assembly.LoadFile(file));
         } catch { }
     }
 }
Example #3
0
 protected override void HandleArgument(int index, Match match)
 {
     if (match == null)
     {
         AppendEmptyArgument(index == stopIndex - 1);
         return;
     }
     if (!HandlerMeta.HandleArgument(this as IHandler, match))
     {
         AppendArgument(match);
     }
 }
Example #4
0
 public static bool ComparePriority <THandler>(Match match, ref int priority) where THandler : IHandler =>
 HandlerMeta <THandler> .ComparePriority(match, ref priority);
Example #5
0
 public static bool HandleArgument <THandler>(this THandler handler, Match match) where THandler : IHandler =>
 HandlerMeta <THandler> .HandleArgument(handler, match);