public bool SetMOTD(string data, string language, string password) { if (password != PassPhrase) { return(false); } WAD.TWADFile WADFile = new WAD.TWADFile(Convert.FromBase64String(data), "motd-mp-" + language + ".txt"); DWStorage.FlushPublisherFiles(); return(WAD.Manager.AddFileToWAD(WADFile, language)); }
public bool AddWAD(string filename, string fileData, string password) { if (password != PassPhrase) { return(false); } byte[] FileData = Convert.FromBase64String(fileData); File.WriteAllBytes(@"data/pub/" + filename, FileData); DWStorage.FlushPublisherFiles(); return(true); }
private static void Generate() { while (true) { try { Log.Debug("Generating Heatmap"); List <Coordinates> PlayerCoordinates = GetPlayerCoordinates(); MemoryStream mStream = new MemoryStream(); BinaryWriter Writer = new BinaryWriter(mStream); for (int i = 255; i >= 0; i--) { for (int j = 0; j < 256; j++) { if (PlayerCoordinates.Contains(new Coordinates(j, i))) { Writer.Write((byte)0x01); } else { Writer.Write((byte)0x00); } } } byte[] Compressed = ZlibStream.CompressBuffer(mStream.ToArray()); FileStream HeatmapFile = File.Create("data/pub/heatmap.raw", Compressed.Length); HeatmapFile.Write(Compressed, 0, Compressed.Length); HeatmapFile.Close(); DWStorage.FlushPublisherFiles(); } catch (Exception ex) { Log.Error(String.Format("Heatmap Generation Failed: {0}", ex)); } Thread.Sleep(300000); } }
private void redirectPacket(MessageData data) { data.Arguments["handled"] = false; var type = data.Get <int>("type"); var crypt = data.Get <bool>("crypt"); bool routed = false; try { if (!crypt && (type == 28 || type == 12 || type == 26)) { DWAuther.DW_PacketReceived(data); routed = true; //Log.Debug("got auth packet"); } if (crypt && type == 28) { DWGroups.DW_PacketReceived(data); routed = true; } if (type == 7) { DWLobby.DW_PacketReceived(data); routed = true; //Log.Debug("got lobby packet"); } if (type == 6) { DWMessaging.DW_PacketReceived(data); routed = true; //Log.Debug("got service packet"); } if (type == 21) { DWMatch.DW_PacketReceived(data); routed = true; //Log.Debug("got match packet"); } if ((type == 10) || (type == 18) || (type == 23) || (type == 8 || type == 50 || type == 4 || type == 58)) { DWStorage.DW_PacketReceived(data); routed = true; //Log.Debug("got storage packet"); } if (type == 12 && crypt) { DWTitles.DW_PacketReceived(data); routed = true; //Log.Debug("got Title packet"); } if (type == 8) { DWProfiles.DW_PacketReceived(data); routed = true; } if (type == 27) { DWDML.DW_PacketReceived(data); } if (type == 67) { DWEventLog.DW_PacketReceived(data); } } catch (Exception e) { Log.Error("Exception: " + e.ToString()); } /*if(routed == false) * { * Log.Debug("UNHANDLED PACKET: " + type); * }*/ try { if (crypt && !data.Get <bool>("handled")) { DWRouter.Unknown(data, DWRouter.GetMessage(data)); } } catch { Log.Error("UNKNOWN FAILED, THIS CONNECTION CAN BE CONSIDERED DEAD."); // disconnect to prevent pollution of system TCPHandler.ForceDisconnect(data); } }