Exemplo n.º 1
0
        public static ContainerBuilder RegisterApplicationServices(this ContainerBuilder builder, ICubesEnvironment cubes)
        {
            foreach (var application in cubes.GetApplicationInstances())
            {
                application.RegisterServices(builder);
            }

            return(builder);
        }
Exemplo n.º 2
0
        public static IConfigurationBuilder AddApplicationsConfiguration(this IConfigurationBuilder configuration,
                                                                         ICubesEnvironment cubes)
        {
            foreach (var application in cubes.GetApplicationInstances())
            {
                application.ConfigureAppConfiguration(configuration, cubes);
            }

            return(configuration);
        }
Exemplo n.º 3
0
        public IActionResult GetApplicationsUIOptions()
        {
            var settings = cubesEnvironment
                           .GetApplicationInstances()
                           .SelectMany(app => app.GetUIConfig())
                           .OrderBy(app => app.DisplayName)
                           .ToList();

            return(Ok(settings));
        }
Exemplo n.º 4
0
        public static IServiceCollection AddApplicationsServices(this IServiceCollection services,
                                                                 IConfiguration configuration,
                                                                 ICubesEnvironment cubes)
        {
            services.AddSingleton(cubes);
            foreach (var application in cubes.GetApplicationInstances())
            {
                application.ConfigureServices(services, configuration);
            }

            return(services);
        }
Exemplo n.º 5
0
        public ActionResult <string> Ping()
        {
            var envInfo = cubesEnvironment.GetEnvironmentInformation();
            var proc    = Process.GetCurrentProcess();

            if (proc == null || proc.MainModule == null)
            {
                throw new Exception("Could not get Cubes process information");
            }
            var asm = Assembly.GetEntryAssembly();

            if (asm == null)
            {
                throw new Exception("Could not get Cubes entry assembly information");
            }

            var info = new
            {
                ProcID = proc.Id,
                proc.ProcessName,
                Executable    = Path.GetFileName(proc.MainModule.FileName),
                Assembly      = asm.GetName().Name,
                WorkingFolder = Path.GetDirectoryName(asm.Location),
                Machine       = proc.MachineName,
                envInfo.Hostname,
                CoreVersion = envInfo.BuildVersion,
                Build       = envInfo.IsDebug ? "DEBUG" : "RELEASE",
                envInfo.BuildInformation,
                LiveSince        = envInfo.LiveSince.ToString("yyyy-MM-dd HH:mm:ss"),
                ServerTime       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                WorkingSet       = Math.Round(proc.WorkingSet64 / 1024M / 1024M, 2),
                PeakWorkingSet   = Math.Round(proc.PeakWorkingSet64 / 1024M / 1024M, 2),
                Threads          = proc.Threads.Count,
                LoadedAssemblies = cubesEnvironment.GetLoadedAssemblies(),
                ConfiguredApps   = cubesEnvironment.GetLoadedeApplications(),
                ActivatedApps    = cubesEnvironment.GetApplicationInstances().Select(app => app.GetType().Name)
            };

            return(Ok(info));
        }