Make all collections readonly in API surface
This commit is contained in:
parent
8b07f9ecde
commit
5f3199acf3
|
@ -111,7 +111,7 @@ namespace BizHawk.Client.Common
|
|||
return null;
|
||||
}
|
||||
|
||||
public Dictionary<string, ulong> GetRegisters()
|
||||
public IReadOnlyDictionary<string, ulong> GetRegisters()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
|
@ -73,23 +72,16 @@ namespace BizHawk.Client.Common
|
|||
_movieSession.Movie.Save();
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetHeader()
|
||||
{
|
||||
var table = new Dictionary<string, string>();
|
||||
if (_movieSession.Movie.NotActive())
|
||||
{
|
||||
return table;
|
||||
}
|
||||
foreach (var (k, v) in _movieSession.Movie.HeaderEntries) table[k] = v;
|
||||
return table;
|
||||
}
|
||||
public IReadOnlyDictionary<string, string> GetHeader()
|
||||
=> _movieSession.Movie.NotActive()
|
||||
? new Dictionary<string, string>()
|
||||
: _movieSession.Movie.HeaderEntries.ToDictionary(static kvp => kvp.Key, static kvp => kvp.Value);
|
||||
|
||||
public List<string> GetComments() => _movieSession.Movie.Comments.ToList();
|
||||
public IReadOnlyList<string> GetComments()
|
||||
=> _movieSession.Movie.Comments.ToList();
|
||||
|
||||
public List<string> GetSubtitles() =>
|
||||
_movieSession.Movie.Subtitles
|
||||
.Select(s => s.ToString())
|
||||
.ToList();
|
||||
public IReadOnlyList<string> GetSubtitles()
|
||||
=> _movieSession.Movie.Subtitles.Select(static s => s.ToString()).ToList();
|
||||
|
||||
public string Filename() => _movieSession.Movie.Filename;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace BizHawk.Client.Common
|
|||
int FrameCount();
|
||||
object Disassemble(uint pc, string name = "");
|
||||
ulong? GetRegister(string name);
|
||||
Dictionary<string, ulong> GetRegisters();
|
||||
IReadOnlyDictionary<string, ulong> GetRegisters();
|
||||
void SetRegister(string register, int value);
|
||||
long TotalExecutedCycles();
|
||||
string GetSystemId();
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace BizHawk.Client.Common
|
|||
void SetRerecordCounting(bool counting);
|
||||
void Stop();
|
||||
double GetFps();
|
||||
Dictionary<string, string> GetHeader();
|
||||
List<string> GetComments();
|
||||
List<string> GetSubtitles();
|
||||
IReadOnlyDictionary<string, string> GetHeader();
|
||||
IReadOnlyList<string> GetComments();
|
||||
IReadOnlyList<string> GetSubtitles();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public IEnumerable<T> EnumerateValues<T>(LuaTable table) => table.Values.Cast<T>();
|
||||
|
||||
public LuaTable ListToTable<T>(IList<T> list, int indexFrom = 1)
|
||||
public LuaTable ListToTable<T>(IReadOnlyList<T> list, int indexFrom = 1)
|
||||
{
|
||||
var table = _lua.NewTable();
|
||||
for (int i = 0, l = list.Count; i != l; i++) table[indexFrom + i] = list[i];
|
||||
|
|
Loading…
Reference in New Issue