Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
        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);
            }
        }