Exemple #1
0
        static void Main(string[] arguments)
        {
            var runPath = AppDomain.CurrentDomain.BaseDirectory;

            using (SerilogSupport.InitLogger(new Uri(string.Concat(runPath, "serilog.config"))))
            {
                AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
                    var ex = args.ExceptionObject as Exception;
                    Logging.Log().Error(ex, "Unhandled exception: {ExceptionObject} (isTerminating: {IsTerminating})", args.ExceptionObject, args.IsTerminating);
                };
                Logging.Log().Information("Version: {ApplicationVersion}", typeof(Program).Assembly.GetName().Version);
                var assemblyLocation = typeof(Program).Assembly.Location;

                if (assemblyLocation != null)
                {
                    var productVersion = FileVersionInfo.GetVersionInfo(assemblyLocation).ProductVersion;
                    Logging.Log().Information("Product Version: {ApplicationVersion}", typeof(Program).Assembly.GetName().Version);
                }

                var       environment = EnvironmentResolver.GetEnvironmentName();
                IAppCache cache       = new CachingService {
                    DefaultCacheDuration = 60 * 5
                };
                IConfigReader        configReader = ConfigReaderFactory.Create(cache, environment, "API");
                IWebApiConfiguration webApiConfig = new WebApiConfig(configReader);

                Host.Run(() => new ServiceApp(webApiConfig));

                Logging.Log().Information("Application terminated.");
            }
        }
Exemple #2
0
        private static void NewMethod()
        {
            var factory = new ConfigReaderFactory();

            var reader = factory.Create(ConfigType.CsProj);

//            var packages = reader
//                .Read(@"<PackagesConfig>").ToList();
            var packages = reader
                           .Read(@"D:\Development\Programming\Projects\NuGetReporter\NuGetReporter.Cmdlet\NuGetReporter.Cmdlet.csproj")
                           .ToList();
        }
Exemple #3
0
        static void Main(string[] argss)
        {
            ServicePointManager.ServerCertificateValidationCallback =
                delegate(object s, X509Certificate certificate,
                         X509Chain chain, SslPolicyErrors sslPolicyErrors)
            { return(true); };

            var       environment = EnvironmentResolver.GetEnvironmentName();
            IAppCache cache       = new CachingService {
                DefaultCacheDuration = 60 * 5
            };
            IConfigReader        configReader = ConfigReaderFactory.Create(cache, environment, "WORKER");
            IWorkerConfiguration workerConfig = new WorkerConfig(configReader);

            Host.Run(() => new ServiceApp(workerConfig));
        }