From 97df9f0c65550b8f2529231d0a2ea4f830a1697b Mon Sep 17 00:00:00 2001 From: Asval Date: Sun, 23 Jun 2019 02:19:55 +0200 Subject: [PATCH] paks are now ignored if they are fully locked (trying to use fmodel while updating the game) --- FModel/MainWindow.cs | 18 ++---------------- FModel/Methods/Utilities/Utilities.cs | 2 +- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index 7bb40f19..4b2b3ccf 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -116,22 +116,8 @@ namespace FModel for (int i = 0; i < yourPaKs.Count(); i++) { string arCurrentUsedPak = yourPaKs.ElementAt(i); //SET CURRENT PAK - string arCurrentUsedPakGuid = ThePak.ReadPakGuid(Settings.Default.PAKsPath + "\\" + Path.GetFileName(arCurrentUsedPak)); //SET CURRENT PAK GUID - if (arCurrentUsedPakGuid == "0-0-0-0") - { - ThePak.mainPaksList.Add(new PaksEntry(Path.GetFileName(arCurrentUsedPak), arCurrentUsedPakGuid)); - AddPaKs(Path.GetFileName(arCurrentUsedPak)); //add to toolstrip - } - if (arCurrentUsedPakGuid != "0-0-0-0") - { - ThePak.dynamicPaksList.Add(new PaksEntry(Path.GetFileName(arCurrentUsedPak), arCurrentUsedPakGuid)); - AddPaKs(Path.GetFileName(arCurrentUsedPak)); //add to toolstrip - } - - //IT'S TRIGGERED WHEN FORTNITE IS RUNNING BUT FILES CAN BE READ AND I WANT IT TO BE TRIGGERED WHEN FILE IS FULLY LOCKED AND CAN'T BE USED AT ALL - //aka while you're updating the game - /*if (!Utilities.IsFileLocked(new System.IO.FileInfo(arCurrentUsedPak))) + if (!Utilities.IsFileLocked(new System.IO.FileInfo(arCurrentUsedPak))) { string arCurrentUsedPakGuid = ThePak.ReadPakGuid(Settings.Default.PAKsPath + "\\" + Path.GetFileName(arCurrentUsedPak)); //SET CURRENT PAK GUID @@ -146,7 +132,7 @@ namespace FModel AddPaKs(Path.GetFileName(arCurrentUsedPak)); //add to toolstrip } } - else { AppendText(Path.GetFileName(arCurrentUsedPak) + " is locked by another process.", Color.Red, true); }*/ + else { AppendText(Path.GetFileName(arCurrentUsedPak) + " is locked by another process.", Color.Red, true); } } } } diff --git a/FModel/Methods/Utilities/Utilities.cs b/FModel/Methods/Utilities/Utilities.cs index 394a4b52..7fe37304 100644 --- a/FModel/Methods/Utilities/Utilities.cs +++ b/FModel/Methods/Utilities/Utilities.cs @@ -102,7 +102,7 @@ namespace FModel FileStream stream = null; try { - stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.None); + stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); } catch (IOException) {