Files
RAGECOOP-V/Client/Scripting/ClientFile.cs

29 lines
693 B
C#
Raw Normal View History

using RageCoop.Core.Scripting;
2023-02-13 20:44:50 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
2023-02-13 20:44:50 +08:00
using System.Threading.Tasks;
namespace RageCoop.Client.Scripting
{
public class ClientFile : ResourceFile
{
2023-02-27 11:54:02 +08:00
public ClientFile() {
GetStream = GetStreamMethod;
}
[JsonInclude]
2023-02-27 11:54:02 +08:00
public string FullPath { get; internal set; }
Stream GetStreamMethod()
{
if (IsDirectory)
{
return File.Open(FullPath, FileMode.Open);
}
throw new InvalidOperationException("Cannot open directory as file");
}
2023-02-13 20:44:50 +08:00
}
}