public static void ForEach <TModule>(this IBootSequence bootSequence, Action <TModule> action)
     where TModule : ISImplModule
 {
     foreach (var module in bootSequence.FilterBy <TModule>())
     {
         action.Invoke(module);
     }
 }
 public static async Task ForEachAsync <TModule>(this IBootSequence bootSequence, Func <TModule, Task> action)
     where TModule : ISImplModule
 {
     foreach (var module in bootSequence.FilterBy <TModule>())
     {
         await action.Invoke(module);
     }
 }
Esempio n. 3
0
        public void ConfigureHostBuilder(ISImplHostBuilder hostBuilder)
        {
            BootSequence.ForEach <IHostBuilderConfigureModule>(module =>
            {
                module.ConfigureHostBuilder(hostBuilder);
            });

            // we need re-calc
            _bootSequence1 = _bootSequenceFactory.New();
        }
Esempio n. 4
0
 public VerboseBootSequence(IBootSequence bootSequence)
 {
     _bootSequence = bootSequence;
 }
Esempio n. 5
0
        private static void RunService(string[] args)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.SetData("APP_CONFIG_FILE", "ServiceCore.dll.config");
            bool flag = true;

            if (args[0] == "/force")
            {
                flag = false;
                args = args.Skip(1).ToArray <string>();
            }
            bool flag2       = false;
            int  periodMilis = 0;

            if (args[0].ToLower() == "/process_performance".ToLower())
            {
                flag2       = true;
                periodMilis = int.Parse(args[1]) * 1000;
                args        = args.Skip(2).ToArray <string>();
            }
            string privateBinPath = string.Format("{0}", Path.Combine(Path.GetDirectoryName(args[0]), (IntPtr.Size == 4) ? "x86" : "x64"));

            object[] parameters = args.Skip(4).ToArray <string>();
            string   text       = args[0];
            string   text2      = args[1];
            string   text3      = args[2];
            string   title      = args[3];

            currentDomain.AssemblyResolve += delegate(object s, ResolveEventArgs e)
            {
                string assemblyFile = string.Format("{0}\\{1}.dll", privateBinPath, e.Name.Substring(0, e.Name.IndexOf(",")));
                return(Assembly.LoadFrom(assemblyFile));
            };
            Assembly assembly = Assembly.LoadFrom(text);

            if (assembly == null)
            {
                throw new ApplicationException(string.Format("Invalid Assembly Name {0}", text));
            }
            Type type = assembly.GetType(text2, false, true);

            if (type == null)
            {
                throw new ApplicationException(string.Format("Invalid Type Name {0}", text2));
            }
            MethodInfo method = type.GetMethod(text3, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

            if (method == null)
            {
                throw new ApplicationException(string.Format("Invalid Method Name {0}", text3));
            }
            Console.Title = title;
            object obj = method.Invoke(null, parameters);

            if (flag2)
            {
                IQueryPerformance[] perfArray = null;
                if (obj is IQueryPerformance)
                {
                    perfArray = new IQueryPerformance[]
                    {
                        obj as IQueryPerformance
                    };
                }
                else if (obj is IQueryPerformance[])
                {
                    perfArray = (obj as IQueryPerformance[]);
                }
                Program.performanceWriter = new ProcessPerformanceWriter(perfArray, periodMilis);
                Program.performanceWriter.Initialize();
            }
            IBootSequence bootSequence = (obj is IBootSequence) ? (obj as IBootSequence) : null;

            if (bootSequence != null && obj != null && flag)
            {
                return;
            }
            Console.WriteLine("launched");
            Program.launched.Set();
        }