private static void SendFileToBuffer(this PlayerInstance ch, SystemFileTypes fileType) { var path = SystemConstants.GetSystemFile(fileType); using (var proxy = new TextReaderProxy(new StreamReader(path))) { var buffer = proxy.ReadToEnd(); ch.Descriptor.WriteToBuffer(buffer, buffer.Length); } }
private static void SendFileToBuffer(CharacterInstance ch, SystemFileTypes fileType) { string path = SystemConstants.GetSystemFile(fileType); using (TextReaderProxy proxy = new TextReaderProxy(new StreamReader(path))) { string buffer = proxy.ReadToEnd(); comm.write_to_buffer(ch.Descriptor, buffer, buffer.Length); } }
public static string GetSystemFile(SystemFileTypes file) { if (SystemFiles.ContainsKey(file)) { var kvp = SystemFiles[file]; return(kvp.Value ? GetSystemDirectory(SystemDirectoryTypes.System) + kvp.Key : kvp.Key); } return(string.Empty); }
public void LoadMap(SystemFileTypes fileType, IEnumerable <string> map) { var path = SystemConstants.GetSystemFile(fileType); using (var proxy = new TextReaderProxy(new StreamReader(path))) { IEnumerable <string> lines = proxy.ReadIntoList(); if (!lines.Any()) { throw new InvalidDataException($"Missing data for {fileType}"); } map.ToList().AddRange(lines); } }