Exemplo n.º 1
0
 //	Adds new option
 public void AddOption(EngineOption option)
 {
     if (EngineOptions == null)
     {
         EngineOptions = new List <EngineOption>();
     }
     EngineOptions.Add(option);
 }
Exemplo n.º 2
0
        protected List <EngineContext> getRealContexts(List <EngineContext> contexts, RunContext runContext)
        {
            return(contexts.Select(context =>
            {
                if (context.Stdin == EngineContext.stdinType.NotUse &&
                    string.IsNullOrEmpty(runContext.File) &&
                    context.Specification.Schema.AcceptMask == false)
                {
                    return context.Specification.Schema.Extensions.Select(x =>
                    {
                        return Directory.GetFiles(context.WorkingDirectory, x, SearchOption.AllDirectories).ToList();
                    }).SelectMany(x => x).ToList()
                    .Select(x =>
                    {
                        var lo = new EngineOptions();
                        context.RunOptions.Select(y =>
                        {
                            if (y.Key == "{path}")
                            {
                                return new KeyValuePair <string, string>(y.Key, Path.GetFileName(x)
                                                                         .Replace(Path.GetFullPath(context.WorkingDirectory), string.Empty)
                                                                         .TrimStart('/')
                                                                         .TrimStart('\\'));
                            }
                            return y;
                        }).ToList().ForEach(z => lo.Add(z.Key, z.Value));

                        return new EngineContext()
                        {
                            ConfigOptions = context.ConfigOptions,
                            Stdin = context.Stdin,
                            WorkingDirectory = Path.GetDirectoryName(x),
                            Specification = context.Specification,
                            RunOptions = lo,
                            Project = context.Project
                        };
                    }).ToList();
                }
                else
                {
                    return new List <EngineContext>()
                    {
                        context
                    };
                }
            }).SelectMany(x => x).ToList());
        }