1using System.Reflection;
8 public Dictionary<string, FileInfo>
FModFiles = [];
13 modInfo.LoadOrder = int.MinValue + 1;
22 modInfo.Name = $
"[FastDebug]{modInfo.Name}";
28 NuGetVersion =
new NuGetVersion(1, 0, 0),
31 Link =
"https://gitee.com/SC-SPM/SurvivalcraftApi",
33 Description =
"Debug uncompressed mod. 调试未压缩模组",
34 ScVersion =
"2.4.0.0",
35 PackageName =
"fastdebug"
44 if (
string.IsNullOrEmpty(path)) {
51 if (f.EndsWith(
".scmod")) {
54 string abpath = $
"{path}/{f}";
55 string FilenameInZip = abpath.Substring(basepath.Length + 1);
56 if (FilenameInZip.StartsWith(
"Assets/")) {
57 string name = FilenameInZip.Substring(7);
59 MemoryStream memoryStream =
new();
61 stream.CopyTo(memoryStream);
76 public override void GetFiles(
string extension, Action<string, Stream> action) {
78 Loader?.GetModFiles(extension, action, out skip);
82 foreach (KeyValuePair<string, FileInfo> item
in FModFiles) {
83 if (item.Key.EndsWith(extension)) {
84 using (Stream fs = item.Value.OpenRead()) {
86 action?.Invoke(item.Key, fs);
89 Log.
Error($
"GetFile {item.Key} Error:{e}");
96 public override bool GetFile(
string filename, Action<Stream> stream) {
98 bool loaderReturns =
false;
99 Loader?.GetModFile(filename, stream, out skip, out loaderReturns);
101 return loaderReturns;
103 if (
FModFiles.TryGetValue(filename, out FileInfo fileInfo)) {
104 using (Stream fs = fileInfo.OpenRead()) {
108 catch (Exception e) {
109 Log.
Error($
"GetFile {filename} Error:{e}");
117 public override bool GetAssetsFile(
string filename, Action<Stream> stream) =>
GetFile($
"Assets/{filename}", stream);
static void Error(object message)
static string GetSystemPath(string path)
static IEnumerable< string > ListDirectoryNames(string path)
static IEnumerable< string > ListFileNames(string path)
static Stream OpenFile(string path, OpenFileMode openFileMode)
void SetContentStream(Stream stream)
static void Add(ContentInfo contentInfo)
void ReadDirResouces(string basepath, string path)
override bool GetFile(string filename, Action< Stream > stream)
获取指定文件
override void InitResources()
初始化Content资源
override bool GetAssetsFile(string filename, Action< Stream > stream)
Dictionary< string, FileInfo > FModFiles
override void GetFiles(string extension, Action< string, Stream > action)
获取指定后缀文件列表,带.
virtual void LoadIcon(Stream stream)
static NuGetVersion APINuGetVersion
static ModInfo DeserializeJson(string json)
static string APIVersionString
static string StreamToString(Stream stream)