Browse Source

rename: rename IStream to ILuaIOStream

Akeit0 7 months ago
parent
commit
299ab4d3fb
2 changed files with 8 additions and 8 deletions
  1. 5 5
      src/Lua/IO/ILuaFileSystem.cs
  2. 3 3
      src/Lua/Standard/FileHandle.cs

+ 5 - 5
src/Lua/IO/ILuaFileSystem.cs

@@ -6,14 +6,14 @@ public interface ILuaFileSystem
 {
     public bool IsReadable(string path);
     public ValueTask<LuaFileContent> ReadFileContentAsync(string path, CancellationToken cancellationToken);
-    public IStream? Open(string path, LuaFileOpenMode mode, bool throwError);
+    public ILuaIOStream? Open(string path, LuaFileOpenMode mode, bool throwError);
     public void Rename(string oldName, string newName);
     public void Remove(string path);
     public string DirectorySeparator { get; }
     public string GetTempFileName();
 }
 
-public interface IStream : IDisposable
+public interface ILuaIOStream : IDisposable
 {
     public ValueTask<string?> ReadLineAsync(CancellationToken cancellationToken);
     public ValueTask<string> ReadToEndAsync(CancellationToken cancellationToken);
@@ -72,12 +72,12 @@ public sealed class FileSystem : ILuaFileSystem
         return new(new LuaFileContent(bytes));
     }
 
-    public IStream? Open(string path, LuaFileOpenMode luaMode, bool throwError)
+    public ILuaIOStream? Open(string path, LuaFileOpenMode luaMode, bool throwError)
     {
         var (mode, access) = GetFileMode(luaMode);
         try
         {
-            return new StreamWrapper(File.Open(path, mode, access));
+            return new LuaIOStreamWrapper(File.Open(path, mode, access));
         }
         catch (Exception)
         {
@@ -111,7 +111,7 @@ public sealed class FileSystem : ILuaFileSystem
     }
 }
 
-public sealed class StreamWrapper(Stream innerStream) : IStream
+public sealed class LuaIOStreamWrapper(Stream innerStream) : ILuaIOStream
 {
     StreamReader? reader;
     StreamWriter? writer;

+ 3 - 3
src/Lua/Standard/FileHandle.cs

@@ -33,7 +33,7 @@ public class FileHandle : ILuaUserData
         }
     });
 
-    IStream stream;
+    ILuaIOStream stream;
     bool isClosed;
 
     public bool IsClosed => Volatile.Read(ref isClosed);
@@ -48,9 +48,9 @@ public class FileHandle : ILuaUserData
         fileHandleMetatable[Metamethods.Index] = IndexMetamethod;
     }
 
-    public FileHandle(Stream stream) : this(new StreamWrapper(stream)) { }
+    public FileHandle(Stream stream) : this(new LuaIOStreamWrapper(stream)) { }
 
-    public FileHandle(IStream stream)
+    public FileHandle(ILuaIOStream stream)
     {
         this.stream = stream;
     }