private static void LoadUSyncConfiguration()
 {
     var uSyncConfigurationProvider =
         new USyncConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/uSyncSettings.config"),
             new HttpContextPathResolver());
     uSyncConfiguration = uSyncConfigurationProvider.GetConfiguration();
 }
        private static void LoadUSyncConfiguration()
        {
            var uSyncConfigurationProvider =
                new USyncConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/uSyncSettings.config"),
                                               new HttpContextPathResolver());

            uSyncConfiguration = uSyncConfigurationProvider.GetConfiguration();
        }
        public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            try
            {
                var uSyncConfigurationProvider = new USyncConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/uSyncSettings.config"), new HttpContextPathResolver());
                var configurationProvider      = new CodeGeneratorConfigurationFileProvider(HttpContext.Current.Server.MapPath("~/config/CodeGen.config"));

                uSyncConfiguration = uSyncConfigurationProvider.GetConfiguration();

                dataTypesProvider = new USyncDataTypeProvider(uSyncConfiguration.USyncFolder);

                dataTypes     = dataTypesProvider.GetDataTypes();
                configuration = configurationProvider.GetConfiguration();

                generatorFactory = CreateFactory <CodeGeneratorFactory>(configuration.GeneratorFactory);
                parserFactory    = CreateFactory <ParserFactory>(configuration.ParserFactory);

                paths.Add("DocumentType", HttpContext.Current.Server.MapPath(configuration.DocumentTypes.ModelPath));
                paths.Add("MediaType", HttpContext.Current.Server.MapPath(configuration.MediaTypes.ModelPath));

                XmlDoc.Saved += OnDocumentTypeSaved;

                if (configuration.DocumentTypes.GenerateXml)
                {
                    globalStart = DateTime.Now;
                    LogHelper.Info <CodeGenerator>(() => "Parsing typed documenttype models");
                    GenerateXml(configuration.DocumentTypes);
                    LogHelper.Info <CodeGenerator>(() => String.Format("Parsing typed documenttype models done. Took {0:MM\\:ss}", DateTime.Now - globalStart));
                }
                if (configuration.MediaTypes.GenerateXml)
                {
                    globalStart = DateTime.Now;
                    LogHelper.Info <CodeGenerator>(() => "Parsing typed mediatype models");
                    GenerateXml(configuration.MediaTypes);
                    LogHelper.Info <CodeGenerator>(() => String.Format("Parsing typed mediatype models done. Took {0:MM\\:ss}", DateTime.Now - globalStart));
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error <CodeGenerator>("Parsing typed models failed", ex);
            }
        }
		public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
		{
			var uSyncConfigurationProvider = new USyncConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/uSyncSettings.config"), new HttpContextPathResolver());
			var configurationProvider = new CodeGeneratorConfigurationFileProvider(HttpContext.Current.Server.MapPath("~/config/CodeGen.config"));

			uSyncConfiguration = uSyncConfigurationProvider.GetConfiguration();
			
			dataTypesProvider = new USyncDataTypeProvider(uSyncConfiguration.USyncFolder);
	
			dataTypes = dataTypesProvider.GetDataTypes();
			configuration = configurationProvider.GetConfiguration();

			paths.Add("DocumentType", HttpContext.Current.Server.MapPath(configuration.DocumentTypes.ModelPath));
			paths.Add("MediaType", HttpContext.Current.Server.MapPath(configuration.MediaTypes.ModelPath));

			XmlDoc.Saved += OnDocumentTypeSaved;

			if (configuration.DocumentTypes.GenerateXml)
				GenerateXml(configuration.DocumentTypes);
			if (configuration.MediaTypes.GenerateXml)
				GenerateXml(configuration.MediaTypes);
		}