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