2023-03-19 15:13:24 +08:00
|
|
|
|
using RageCoop.Core.Scripting;
|
2023-02-13 20:44:50 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2023-03-19 15:13:24 +08:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-19 15:13:24 +08:00
|
|
|
|
[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
|
|
|
|
}
|
|
|
|
|
}
|