chore: fix more warnings.

This commit is contained in:
redxef 2024-11-11 18:00:55 +01:00
parent 12d98c46cb
commit 1f961ccb0c
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921
4 changed files with 14 additions and 6 deletions

View file

@ -126,6 +126,12 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
public static Boolean operator <=(Integer a, Integer b) {
return (a._value <= b._value) ? Boolean.TRUE : Boolean.FALSE;
}
public override int GetHashCode() {
return base.GetHashCode();
}
public override bool Equals(object? other) {
return base.Equals(other);
}
public static Boolean operator ==(Integer a, Integer b) {
return (a._value == b._value) ? Boolean.TRUE : Boolean.FALSE;
}

View file

@ -7,7 +7,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
using FunctionLater = Func<Executor, IEnumerable<Expression>, Expression>;
public interface IEnvironment<K, V> {
public V Get(K k);
public V? Get(K k);
public void Set(K k, V v);
public IEnvironment<K, V>? Find(K k);
public IEnvironment<K, V> Parent(bool recursive);
@ -377,7 +377,11 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
if (_environment.Find(s.Name()) is not IEnvironment<string, Expression> env) {
throw new ApplicationException($"Could not find '{s.Name()}'");
}
return env.Get(s.Name());
var r_ = env.Get(s.Name());
if (r_ is null) {
throw new ApplicationException($"Could not find '{s.Name()}'");
}
return r_;
case Boolean b:
return b;
case Integer i:

View file

@ -14,7 +14,7 @@ namespace Jellyfin.Plugin.SmartPlaylist {
_fileSystem = fileSystem;
}
private async Task<SmartPlaylistDto> LoadPlaylistAsync(string filename) {
var r = File.ReadAllText(filename);
var r = await File.ReadAllTextAsync(filename);
if (r.Equals("")) {
r = "{}";
}
@ -46,7 +46,7 @@ namespace Jellyfin.Plugin.SmartPlaylist {
public async Task SaveSmartPlaylistAsync(SmartPlaylistDto smartPlaylist) {
string filename = _fileSystem.GetSmartPlaylistFilePath(smartPlaylist.Id);
var text = new SerializerBuilder().Build().Serialize(smartPlaylist);
File.WriteAllText(filename, text);
await File.WriteAllTextAsync(filename, text);
}
private void DeleteSmartPlaylistById(SmartPlaylistId smartPlaylistId) {
try {

View file

@ -1,5 +1,3 @@
using Xunit;
using Lisp_Environment = Jellyfin.Plugin.SmartPlaylist.Lisp.Environment;
using Lisp_Boolean = Jellyfin.Plugin.SmartPlaylist.Lisp.Boolean;
using Lisp_Object = Jellyfin.Plugin.SmartPlaylist.Lisp.Object;
using Jellyfin.Plugin.SmartPlaylist.Lisp;