예제 #1
0
파일: Host.cs 프로젝트: Ivony/HelloWorld
        public static void Initailze( HttpConfiguration configuration )
        {
            var configPath = ConfigurationManager.AppSettings["DataPath"] ?? "Data";
              var dataRoot = Path.Combine( HostingEnvironment.ApplicationPhysicalPath, configPath );

              UserService = new JsonUserService( dataRoot );
              DataService = new JsonDataService( dataRoot );
              MessageService = new TextFileMessageService( dataRoot );

              var typeResolver = new HttpRuntimeTypeResolver( configuration.Services.GetAssembliesResolver() );

              var rules = StarveGameRules.CreateInstance( typeResolver );
              GameHost.Initialize( rules, DataService, MessageService );

              configuration.Services.Replace( typeof( IContentNegotiator ), new JsonContentNegotiator() );
              configuration.Formatters.JsonFormatter.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
        }
예제 #2
0
파일: Host.cs 프로젝트: Ivony/HelloWorld
        public static void Initailze(HttpConfiguration configuration)
        {
            var configPath = ConfigurationManager.AppSettings["DataPath"] ?? "Data";
            var dataRoot   = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, configPath);

            UserService    = new JsonUserService(dataRoot);
            DataService    = new JsonDataService(dataRoot);
            MessageService = new TextFileMessageService(dataRoot);



            var typeResolver = new HttpRuntimeTypeResolver(configuration.Services.GetAssembliesResolver());


            var rules = StarveGameRules.CreateInstance(typeResolver);

            GameHost.Initialize(rules, DataService, MessageService);



            configuration.Services.Replace(typeof(IContentNegotiator), new JsonContentNegotiator());
            configuration.Formatters.JsonFormatter.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
        }