/// <summary> /// Create an EULA file if it's set to false or it doesn't exist /// </summary> public static void CreateEULA(string dir) { if (string.IsNullOrEmpty(dir)) { return;// } if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string eula = Path.Combine(dir, "eula.txt"); if (!File.Exists(eula) || File.ReadAllText(eula).Contains("eula=false")) { File.WriteAllText(eula, string.Format(eulaString, UnixDate.GetUniversalDate())); } }
/// <summary> /// Encodes the current properties as a server.properties file /// </summary> /// <returns>The encoded value</returns> public string Encode() { var sb = new StringBuilder(); // append header and date sb.AppendLine(header); sb.Append("#"); sb.AppendLine(UnixDate.GetUniversalDate()); // append every property foreach (var property in Properties) { sb.AppendLine(property.ToString()); } // extra line sb.AppendLine(); return(sb.ToString()); }