From 058016c13d5d65b87b39aeb119ebdd0bca653c5d Mon Sep 17 00:00:00 2001 From: Noah Stolk <31079637+NoahStolk@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:32:56 +0100 Subject: [PATCH] Request read permissions only --- CHANGELOG.md | 6 ++++++ .../Conversion/ContentFileReader.cs | 2 +- src/DevilDaggersInfo.Tools/ContentManager.cs | 4 ++-- src/DevilDaggersInfo.Tools/DevilDaggersInfo.Tools.csproj | 2 +- .../Ui/ModManager/ModsDirectory/Data/ModFile.cs | 2 +- .../Ui/ModManager/ModsDirectory/ModInstallationWindow.cs | 2 +- .../Ui/ModManager/ModsDirectory/ModPreviewWindow.cs | 2 +- .../Ui/ModManager/ModsDirectory/ModsDirectoryLogic.cs | 2 +- 8 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b11a1806..49c11e1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.10.3.0] - 2024-01-02 + +### Fixed + +- Fixed requesting read/write permissions for files when only read permissions are needed. + ## [0.10.2.1] - 2024-01-02 ### Fixed diff --git a/src/DevilDaggersInfo.Tools.Engine.Content/Conversion/ContentFileReader.cs b/src/DevilDaggersInfo.Tools.Engine.Content/Conversion/ContentFileReader.cs index 178b6804..af1d23dd 100644 --- a/src/DevilDaggersInfo.Tools.Engine.Content/Conversion/ContentFileReader.cs +++ b/src/DevilDaggersInfo.Tools.Engine.Content/Conversion/ContentFileReader.cs @@ -19,7 +19,7 @@ public static DecompiledContentFile Read(string contentFilePath) if (!File.Exists(contentFilePath)) throw new InvalidOperationException("Content file does not exist."); - using FileStream fs = new(contentFilePath, FileMode.Open); + using FileStream fs = new(contentFilePath, FileMode.Open, FileAccess.Read); using BinaryReader br = new(fs); ushort tocEntryCount = br.ReadUInt16(); diff --git a/src/DevilDaggersInfo.Tools/ContentManager.cs b/src/DevilDaggersInfo.Tools/ContentManager.cs index 0ad43771..b8a3c36b 100644 --- a/src/DevilDaggersInfo.Tools/ContentManager.cs +++ b/src/DevilDaggersInfo.Tools/ContentManager.cs @@ -78,11 +78,11 @@ public static void Initialize() new(AssetType.Audio, "jump3")); ModBinary ddBinary; - using (FileStream fs = new(UserSettings.ResDdPath, FileMode.Open)) + using (FileStream fs = new(UserSettings.ResDdPath, FileMode.Open, FileAccess.Read)) ddBinary = new(fs, ddReadFilter); ModBinary audioBinary; - using (FileStream fs = new(UserSettings.ResAudioPath, FileMode.Open)) + using (FileStream fs = new(UserSettings.ResAudioPath, FileMode.Open, FileAccess.Read)) audioBinary = new(fs, audioReadFilter); Content = new( diff --git a/src/DevilDaggersInfo.Tools/DevilDaggersInfo.Tools.csproj b/src/DevilDaggersInfo.Tools/DevilDaggersInfo.Tools.csproj index 8062314b..fe5a8b3f 100644 --- a/src/DevilDaggersInfo.Tools/DevilDaggersInfo.Tools.csproj +++ b/src/DevilDaggersInfo.Tools/DevilDaggersInfo.Tools.csproj @@ -4,7 +4,7 @@ ddinfo-tools true SA1633 - 0.10.2.0 + 0.10.3.0 Icon.ico true false diff --git a/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/Data/ModFile.cs b/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/Data/ModFile.cs index 307e6f03..b0a6aa63 100644 --- a/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/Data/ModFile.cs +++ b/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/Data/ModFile.cs @@ -21,7 +21,7 @@ public static ModFile FromPath(string filePath) long fileSize = 0; try { - using FileStream fs = new(filePath, FileMode.Open); + using FileStream fs = new(filePath, FileMode.Open, FileAccess.Read); fileSize = fs.Length; using BinaryReader reader = new(fs); ModBinaryToc modBinaryToc = ModBinaryToc.FromReader(reader); diff --git a/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModInstallationWindow.cs b/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModInstallationWindow.cs index 134c3b76..0212817f 100644 --- a/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModInstallationWindow.cs +++ b/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModInstallationWindow.cs @@ -33,7 +33,7 @@ public static void LoadEffectiveAssets() try { - using FileStream fs = new(filePath, FileMode.Open); + using FileStream fs = new(filePath, FileMode.Open, FileAccess.Read); using BinaryReader reader = new(fs); mods.Add(new(ModBinaryToc.FromReader(reader), fileName)); } diff --git a/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModPreviewWindow.cs b/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModPreviewWindow.cs index c30dc7b0..32ce9d5b 100644 --- a/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModPreviewWindow.cs +++ b/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModPreviewWindow.cs @@ -41,7 +41,7 @@ public static void LoadChunks() try { - using FileStream fs = new(filePath, FileMode.Open); + using FileStream fs = new(filePath, FileMode.Open, FileAccess.Read); _modFileSize = fs.Length; using BinaryReader reader = new(fs); ModBinaryToc modBinaryToc = ModBinaryToc.FromReader(reader); diff --git a/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModsDirectoryLogic.cs b/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModsDirectoryLogic.cs index 4b8aa265..0d0958ba 100644 --- a/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModsDirectoryLogic.cs +++ b/src/DevilDaggersInfo.Tools/Ui/ModManager/ModsDirectory/ModsDirectoryLogic.cs @@ -202,7 +202,7 @@ public static void ToggleProhibitedAssets(string fileName) try { string path = Path.Combine(UserSettings.ModsDirectory, fileName); - using FileStream fs = new(path, FileMode.Open); + using FileStream fs = new(path, FileMode.Open, FileAccess.Read); using BinaryReader reader = new(fs); ModBinaryToc modBinaryToc = ModBinaryToc.FromReader(reader);