change IList to IReadOnlyList (#21)

This commit is contained in:
CommonLoon102 2020-02-12 16:31:11 +00:00 committed by GitHub
parent 506ca164fd
commit 9f18b6365c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -11,7 +11,7 @@ namespace WebInterface.Services
{
public class CustomMapService : ICustomMapService
{
private static readonly List<string> crypticMaps = new List<string>()
private static readonly IReadOnlyList<string> crypticMaps = new List<string>()
{
"CPSL.MAP",
"CP01.MAP",
@ -29,14 +29,14 @@ namespace WebInterface.Services
"CPBB04.MAP",
};
private List<string> ListableCustomMaps => Directory.GetFiles(CommandLineUtils.BloodDir)
private IReadOnlyList<string> ListableCustomMaps => Directory.GetFiles(CommandLineUtils.BloodDir)
.Select(m => Path.GetFileName(m))
.Where(m => m.ToUpper().EndsWith(".MAP"))
.Where(m => !ContainsString(crypticMaps, m))
.OrderBy(m => m)
.ToList();
public IList<string> ListCustomMaps() => ListableCustomMaps;
public IReadOnlyList<string> ListCustomMaps() => ListableCustomMaps;
public byte[] GetCustomMapBytes(string map)
{

View File

@ -2,13 +2,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WebInterface.Services
{
public interface ICustomMapService
{
IList<string> ListCustomMaps();
IReadOnlyList<string> ListCustomMaps();
byte[] GetCustomMapBytes(string map);
string StoreTempCustomMap(IFormFile formFile);
}

View File

@ -1,4 +1,4 @@
@model List<string>
@model IReadOnlyList<string>
@{
ViewData["Title"] = "Custom Maps";
Layout = "~/Views/Shared/_Layout.cshtml";