Beispiel #1
0
        public IKeySetting CreateBy(CommandPair commandPair)
        {
            var keySettingType = Keys[commandPair.CommandLevel];
            var keySetting     = (IKeySetting)Activator.CreateInstance(keySettingType, new object[] { commandPair.Key, commandPair.Paramater });

            keySetting.Accept <ICommandExcute>(CommandConverter);
            return(keySetting);
        }
Beispiel #2
0
 /// <summary>
 /// 创建处理目标
 /// </summary>
 /// <returns></returns>
 public IExcuteTarget CreateTarget()
 {
     if (Value.Contains(CommandParser.ParamterSplit))
     {
         var           p              = Value.Split(CommandParser.ParamterSplit[0]);
         string        dir            = p[0];
         string        searchConditon = p[1];
         var           files          = searchConditon.GetFiles(dir);
         IExcuteTarget targetHeader   = null;
         IExcuteTarget targetTail     = null;
         for (int index = 0, length = files.Count; index < length; index++)
         {
             if (index == 0)
             {
                 var         commandPair   = new CommandPair("-f", files[index]);
                 IKeySetting fileSearchKey = KeyFactory.Instance.CreateBy(commandPair);
                 targetHeader = ((ITarget)fileSearchKey).CreateTarget();
                 targetTail   = targetHeader;
             }
             else
             {
                 var         commandPair   = new CommandPair("-f", files[index]);
                 IKeySetting fileSearchKey = KeyFactory.Instance.CreateBy(commandPair);
                 targetTail.NextTarget = ((ITarget)fileSearchKey).CreateTarget();
                 targetTail            = targetTail.NextTarget;
             }
         }
         return(targetHeader);
     }
     //当时文件的情况
     if (File.Exists(Value))
     {
         var target = new GitFile(Value, CommandExcute);
         return(target);
     }
     return(default(IExcuteTarget));
 }