More usage of code page 437.

This commit is contained in:
UnknownShadow200 2016-06-21 21:10:44 +10:00
parent 8fb745c434
commit 5bf5a7e779
4 changed files with 9 additions and 11 deletions

View File

@ -39,7 +39,7 @@ namespace MCGalaxy {
public static void Load() {
if (!File.Exists("text/awardsList.txt")) {
using (StreamWriter w = new StreamWriter("text/awardsList.txt")) {
using (CP437Writer w = new CP437Writer("text/awardsList.txt")) {
w.WriteLine("#This is a full list of awards. The server will load these and they can be awarded as you please");
w.WriteLine("#Format is:");
w.WriteLine("# AwardName : Description of award goes after the colon");
@ -80,7 +80,7 @@ namespace MCGalaxy {
}
public static void Save() {
using (StreamWriter w = new StreamWriter("text/awardsList.txt")) {
using (CP437Writer w = new CP437Writer("text/awardsList.txt")) {
w.WriteLine("# This is a full list of awards. The server will load these and they can be awarded as you please");
w.WriteLine("# Format is:");
w.WriteLine("# AwardName : Description of award goes after the colon");

View File

@ -47,7 +47,7 @@ namespace MCGalaxy.Games {
public static void SaveList() {
lock (readLock)
using (StreamWriter w = new CP437Writer("extra/teams.txt"))
using (CP437Writer w = new CP437Writer("extra/teams.txt"))
foreach (var pair in TeamsList)
{
w.WriteLine("Name=" + pair.Value.Name);

View File

@ -155,7 +155,7 @@ namespace MCGalaxy {
}
} else {
Server.s.Log("custom$s.txt does not exist, creating");
using (StreamWriter w = new StreamWriter("text/custom$s.txt")) {
using (CP437Writer w = new CP437Writer("text/custom$s.txt")) {
w.WriteLine("// This is used to create custom $s");
w.WriteLine("// If you start the line with a // it wont be used");
w.WriteLine("// It should be formatted like this:");

View File

@ -18,18 +18,16 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace MCGalaxy {
public sealed class GroupProperties {
public static void InitAll() {
string[] lines = File.ReadAllLines("properties/ranks.properties");
List<string> lines = CP437Reader.ReadAllLines("properties/ranks.properties");
Group grp = null;
int version = 1;
if (lines.Length > 0 && lines[0].StartsWith("#Version ")) {
if (lines.Count > 0 && lines[0].StartsWith("#Version ")) {
try { version = int.Parse(lines[0].Remove(0, 9)); }
catch { Server.s.Log("The ranks.properties version header is invalid! Ranks may fail to load!"); }
}
@ -129,7 +127,7 @@ namespace MCGalaxy {
grp.OverseerMaps = osmaps;
break;
case "prefix":
grp.prefix = CP437Reader.ConvertToRaw(value);
grp.prefix = value;
break;
}
@ -152,7 +150,7 @@ namespace MCGalaxy {
/// <summary> Save givenList group </summary>
/// <param name="givenList">The list of groups to save</param>
public static void SaveGroups(List<Group> givenList) {
using (StreamWriter w = new StreamWriter("properties/ranks.properties")) {
using (CP437Writer w = new CP437Writer("properties/ranks.properties")) {
w.WriteLine("#Version 3");
w.WriteLine("#RankName = string");
w.WriteLine("#\tThe name of the rank, use capitalization.");
@ -200,7 +198,7 @@ namespace MCGalaxy {
w.WriteLine("MOTD = " + grp.MOTD);
w.WriteLine("FileName = " + grp.fileName);
w.WriteLine("OSMaps = " + grp.OverseerMaps);
w.WriteLine("Prefix = " + CP437Writer.ConvertToUnicode(grp.prefix));
w.WriteLine("Prefix = " + grp.prefix);
w.WriteLine();
}
}