void ReadWomConfigurationAsync() { string host = ServerMotd.Substring(ServerMotd.IndexOf("cfg=") + 4); string url = "http://" + host; url = url.Replace("$U", game.Username); // NOTE: this (should, I did test this) ensure that if the user quickly changes to a // different world, the environment settings from the last world are not loaded in the // new world if the async 'get request' didn't complete before the new world was loaded. womCounter++; womEnvIdentifier = "womenv_" + womCounter; game.AsyncDownloader.DownloadPage(url, true, womEnvIdentifier); sendWomId = true; }
void HandleLevelInit() { if (gzipStream != null) { return; } game.Map.Reset(); prevScreen = game.activeScreen; if (prevScreen is LoadingMapScreen) { prevScreen = null; } prevCursorVisible = game.CursorVisible; game.SetNewScreen(new LoadingMapScreen(game, ServerName, ServerMotd), false); if (ServerMotd.Contains("cfg=")) { ReadWomConfigurationAsync(); } receivedFirstPosition = false; gzipHeader = new GZipHeaderReader(); // Workaround because built in mono stream assumes that the end of stream // has been reached the first time a read call returns 0. (MS.NET doesn't) #if __MonoCS__ gzipStream = new DeflateStream(gzippedMap, true); #else gzipStream = new DeflateStream(gzippedMap, CompressionMode.Decompress); if (OpenTK.Configuration.RunningOnMono) { throw new InvalidOperationException("You must compile ClassicalSharp with __MonoCS__ defined " + "to run on Mono, due to a limitation in Mono."); } #endif mapSizeIndex = 0; mapIndex = 0; receiveStart = DateTime.UtcNow; }