public static void towizfile(string line) { var outline = string.Empty; if (!string.IsNullOrEmpty(line)) { var filler = 78 - line.Length; if (filler < 1) { filler = 1; } filler /= 2; for (var x = 0; x < filler; x++) { outline += " "; } outline += line; } outline += "\r\n"; using ( var proxy = new TextWriterProxy(new StreamWriter(SystemConstants.GetSystemFile(SystemFileTypes.Wizards), true))) { proxy.Write(outline); } }
public static void fwrite_variables(CharacterInstance ch, TextWriterProxy proxy) { foreach (var vd in ch.Variables) { proxy.Write("#VARIABLE\n"); proxy.Write("Type {0}\n", vd.Type); proxy.Write("Flags {0}\n", vd.Flags); proxy.Write("Vnum {0}\n", vd.vnum); proxy.Write("Ctime {0}\n", vd.CTime.ToFileTimeUtc()); proxy.Write("Mtime {0}\n", vd.MTime.ToFileTimeUtc()); proxy.Write("Rtime {0}\n", vd.RTime.ToFileTimeUtc()); proxy.Write("Tag {0}~\n", vd.Tag); switch (vd.Type) { case VariableTypes.String: proxy.Write("Str {0}~\n", vd.Data.ToString()); break; case VariableTypes.ExtendedBit: proxy.Write("Xbit {9}\n", vd.Data.ToString()); break; case VariableTypes.Integer: proxy.Write("Int {0}\n", (long)vd.Data); break; } proxy.Write("End\n\n"); } }
public static void append_to_file(string file, string str) { using (var proxy = new TextWriterProxy(new StreamWriter(file, true))) { proxy.Write("{0}\n", str); } }
public static void shutdown_mud(string reason) { var path = SystemConstants.GetSystemFile(SystemFileTypes.Shutdown); using (var proxy = new TextWriterProxy(new StreamWriter(path, true))) { proxy.Write("{0}\n", reason); } }
public void Save(TextWriterProxy proxy) { proxy.Write("#LOGINMSG\n"); proxy.Write("Name {0}~\n", Name); if (!Text.IsNullOrEmpty()) { proxy.Write("Text {0}~\n", Text); } proxy.Write("Type {0}\n", Type); proxy.Write("End\n"); }
public static void append_file(CharacterInstance ch, string file, string str) { if (ch.IsNpc() || string.IsNullOrEmpty(str)) { return; } using (var proxy = new TextWriterProxy(new StreamWriter(file, true))) { proxy.Write("[{0}] {1}: {2}\n", ch.CurrentRoom?.ID ?? 0, ch.Name, str); } }
public void Save() { string path = SystemConstants.GetSystemDirectory(SystemDirectoryTypes.System) + "time.dat"; using (TextWriterProxy proxy = new TextWriterProxy(new StreamWriter(path))) { proxy.Write("#TIME\n"); proxy.Write("Mhour {0}\n", Hour); proxy.Write("Mday {0}\n", Day); proxy.Write("Mmonth {0}\n", Month); proxy.Write("Myear {0}\n", Year); proxy.Write("End\n\n"); proxy.Write("#END\n"); } }
public override void Save() { if (Character == null) { return; } using (var proxy = new TextWriterProxy(new StreamWriter(Filename))) { /*foreach (NoteData note in Character.NoteList) * { * proxy.Write("#COMMENT\n"); * proxy.Write("sender {0}~\n", note.Sender); * proxy.Write("date {0}~\n", note.DateSent); * proxy.Write("to {0}~\n", note.RecipientList); * proxy.Write("subject {0}~\n", note.Subject); * proxy.Write("text\n{0}~\n", note.Text); * }*/ } }
public void Save() { using (var proxy = new TextWriterProxy(new StreamWriter(WeatherFile))) { for (var y = 0; y < Height; y++) { for (var x = 0; x < Width; x++) { var cell = GetCellFromMap(x, y); proxy.Write("#CELL {0} {1}\n", x, y); proxy.Write("Climate {0}\n", cell.Climate); proxy.Write("Hemisphere {0}\n", cell.Hemisphere); proxy.Write("State {0}\n", $"{cell.CloudCover} {cell.Energy} {cell.Humidity} {cell.Precipitation} {cell.Pressure} {cell.Temperature} {cell.WindSpeedX} {cell.WindSpeedY}"); proxy.Write("End\n\n"); } } proxy.Write("\n#END\n\n"); } }
public static void do_typo(CharacterInstance ch, string argument) { ch.SetColor(ATTypes.AT_PLAIN); if (CheckFunctions.CheckIfEmptyString(ch, argument, "Usage: 'typo <message>' (your location is automatically recorded)")) { if (ch.Trust >= LevelConstants.GetLevel(ImmortalTypes.Ascendant)) { ch.SendTo("Usage: 'typo list' or 'typo clear now'"); } return; } if (!argument.EqualsIgnoreCase("clear now") || ch.Trust < LevelConstants.GetLevel(ImmortalTypes.Ascendant)) { return; } var path = SystemConstants.GetSystemFile(SystemFileTypes.Typo); using (var proxy = new TextWriterProxy(new StreamWriter(path, false))) proxy.Write(string.Empty); ch.SendTo("Typo file cleared."); }
public void Write_3Args_Test() { TextWriterProxy proxy = new TextWriterProxy(new StringWriter()); proxy.Write("{0} {1} {2} tests", 3, "super", "huge"); }
public void WriteTest() { TextWriterProxy proxy = new TextWriterProxy(new StringWriter()); proxy.Write("test"); }
public void Write_ArrayArgs_Test() { TextWriterProxy proxy = new TextWriterProxy(new StringWriter()); proxy.Write("{0} {1} {2} tests of {3} {4}", new object[] { 4, "super", "huge", "an", "array" }); }
public void Write_2Args_Test() { TextWriterProxy proxy = new TextWriterProxy(new StringWriter()); proxy.Write("{0} {1} tests", 2, "big"); }
public void Write_1Arg_Test() { TextWriterProxy proxy = new TextWriterProxy(new StringWriter()); proxy.Write("{0} test", 1); }
/// <summary> /// /// </summary> /// <param name="proxy"></param> /// <param name="value"></param> /// <param name="args"></param> public static void Write(this TextWriterProxy proxy, string value, params object[] args) => proxy.Write(string.Format(value, args));
/// <summary> /// Writes four arguments to the TextWriterProxy /// </summary> /// <param name="proxy"></param> /// <param name="value"></param> /// <param name="arg1"></param> /// <param name="arg2"></param> /// <param name="arg3"></param> /// <param name="arg4"></param> public static void Write(this TextWriterProxy proxy, string value, object arg1, object arg2, object arg3, object arg4) => proxy.Write(value, new[] { arg1, arg2, arg3, arg4 });