From c9fafcaef02cb4326e06f1993a922317c0c97bba Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Tue, 24 May 2022 18:12:17 +0800 Subject: [PATCH] Update Update --- .gitignore | 2 ++ .../TEngine/Runtime/FileSystem/FileSystem.cs | 23 +++++++++++++++++++ ProjectSettings/EditorBuildSettings.asset | 5 +++- .../src/TEngineCore/FileSystem/FileSystem.cs | 23 +++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bdd9bbb2..b1501cbc 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ /[Mm]emoryCaptures/ /EditorBuild/ # /[Aa]ssets/TResources/DLL/ +/[Aa]ssets/StreamingAssets +/BuildBundleInfo/ # Asset meta data should only be ignored when the corresponding asset is also ignored !/[Aa]ssets/**/*.meta diff --git a/Assets/TEngine/Runtime/FileSystem/FileSystem.cs b/Assets/TEngine/Runtime/FileSystem/FileSystem.cs index a5e9a70c..77ac5b70 100644 --- a/Assets/TEngine/Runtime/FileSystem/FileSystem.cs +++ b/Assets/TEngine/Runtime/FileSystem/FileSystem.cs @@ -126,5 +126,28 @@ namespace TEngine return File.OpenRead(filePath); #endif } + + /// + /// 从指定文件中读取字节串 + /// + /// 文件路径 + /// + public static byte[] ReadAllBytesFromOutOrInnerFolder(string filePath) + { + if (string.IsNullOrEmpty(filePath)) + return null; + + return ReadAllBytesFromOutFolder(filePath); + } + + private static byte[] ReadAllBytesFromOutFolder(string filePath) + { + if (!File.Exists(filePath)) + { + TLogger.LogError("file:[{0}] is not exist!, please check!", filePath); + return null; + } + return File.ReadAllBytes(filePath); + } } } \ No newline at end of file diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 0147887e..7d18d5d7 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -4,5 +4,8 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 - m_Scenes: [] + m_Scenes: + - enabled: 1 + path: Assets/NetDemo/TEngine-NetDemo.unity + guid: 961c85cf7d9a44549a13b94e9931e037 m_configObjects: {} diff --git a/TEngineHotUpdate/src/TEngineCore/FileSystem/FileSystem.cs b/TEngineHotUpdate/src/TEngineCore/FileSystem/FileSystem.cs index 75893358..2e746e56 100644 --- a/TEngineHotUpdate/src/TEngineCore/FileSystem/FileSystem.cs +++ b/TEngineHotUpdate/src/TEngineCore/FileSystem/FileSystem.cs @@ -126,5 +126,28 @@ namespace TEngineCore return File.OpenRead(filePath); #endif } + + /// + /// 从指定文件中读取字节串 + /// + /// 文件路径 + /// + public static byte[] ReadAllBytesFromOutOrInnerFolder(string filePath) + { + if (string.IsNullOrEmpty(filePath)) + return null; + + return ReadAllBytesFromOutFolder(filePath); + } + + private static byte[] ReadAllBytesFromOutFolder(string filePath) + { + if (!File.Exists(filePath)) + { + TLogger.LogError("file:[{0}] is not exist!, please check!", filePath); + return null; + } + return File.ReadAllBytes(filePath); + } } } \ No newline at end of file