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; }
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; }