Skip to content

Commit

Permalink
Merge pull request #1068 from shananas/master
Browse files Browse the repository at this point in the history
Fix unable to extract due to hardcoded gameDataLocation
  • Loading branch information
Vladabdf authored Jun 19, 2024
2 parents b6b366e + ff9b8c7 commit 1c9a5ce
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions OpenKh.Tools.ModsManager/ViewModels/SetupWizardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public bool IsGameSelected
PC => (!string.IsNullOrEmpty(PcReleaseLocation) &&
Directory.Exists(PcReleaseLocation) &&
(File.Exists(Path.Combine(PcReleaseLocation, "EOSSDK-Win64-Shipping.dll")) ||
File.Exists(Path.Combine(PcReleaseLocation, "steam_api64.dll"))))||
File.Exists(Path.Combine(PcReleaseLocation, "steam_api64.dll"))))||
(!string.IsNullOrEmpty(PcReleaseLocationKH3D) &&
Directory.Exists(PcReleaseLocationKH3D) &&
(File.Exists(Path.Combine(PcReleaseLocationKH3D, "EOSSDK-Win64-Shipping.dll")) ||
Expand Down Expand Up @@ -273,14 +273,14 @@ public string PcReleaseSelections
{
get
{
if (Directory.Exists(PcReleaseLocation) && (File.Exists(Path.Combine(PcReleaseLocation, "EOSSDK-Win64-Shipping.dll")) ||
if (Directory.Exists(PcReleaseLocation) && (File.Exists(Path.Combine(PcReleaseLocation, "EOSSDK-Win64-Shipping.dll")) ||
File.Exists(Path.Combine(PcReleaseLocation, "steam_api64.dll"))) &&
Directory.Exists(PcReleaseLocationKH3D) && (File.Exists(Path.Combine(PcReleaseLocationKH3D, "EOSSDK-Win64-Shipping.dll")) ||
Directory.Exists(PcReleaseLocationKH3D) && (File.Exists(Path.Combine(PcReleaseLocationKH3D, "EOSSDK-Win64-Shipping.dll")) ||
File.Exists(Path.Combine(PcReleaseLocationKH3D, "steam_api64.dll"))))
{
return _pcReleasesSelected = "both";
}
else if (Directory.Exists(PcReleaseLocation) && (File.Exists(Path.Combine(PcReleaseLocation, "EOSSDK-Win64-Shipping.dll")) ||
else if (Directory.Exists(PcReleaseLocation) && (File.Exists(Path.Combine(PcReleaseLocation, "EOSSDK-Win64-Shipping.dll")) ||
File.Exists(Path.Combine(PcReleaseLocation, "steam_api64.dll"))))
{

Expand Down Expand Up @@ -446,7 +446,7 @@ public bool OverrideGameDataFound
OnPropertyChanged(nameof(GameDataNotFoundVisibility));
OnPropertyChanged(nameof(GameDataFoundVisibility));
}

}
public string PcReleaseLanguage
{
Expand Down Expand Up @@ -479,9 +479,9 @@ public string GameDataLocation
}

public bool IsNotExtracting { get; private set; }
public bool IsGameDataFound => (IsNotExtracting && GameService.FolderContainsUniqueFile(GameId, Path.Combine(GameDataLocation, "kh2")) ||
(GameEdition == PC && (GameService.FolderContainsUniqueFile("kh2", Path.Combine(GameDataLocation, "kh2")) ||
GameService.FolderContainsUniqueFile("kh1", Path.Combine(GameDataLocation, "kh1")) ||
public bool IsGameDataFound => (IsNotExtracting && GameService.FolderContainsUniqueFile(GameId, Path.Combine(GameDataLocation, "kh2")) ||
(GameEdition == PC && (GameService.FolderContainsUniqueFile("kh2", Path.Combine(GameDataLocation, "kh2")) ||
GameService.FolderContainsUniqueFile("kh1", Path.Combine(GameDataLocation, "kh1")) ||
Directory.Exists(Path.Combine(GameDataLocation, "bbs", "message")) ||
Directory.Exists(Path.Combine(GameDataLocation, "Recom", "SYS"))))||
Directory.Exists(Path.Combine(GameDataLocation, "kh3d","setdata"))||
Expand Down Expand Up @@ -548,7 +548,7 @@ public bool IsLastPanaceaVersionInstalled
// DLL into the right place. So don't bother.
PanaceaInstalled = true;
return true;
}
}

byte[] CalculateChecksum(string fileName) =>
System.Security.Cryptography.MD5.Create().Using(md5 =>
Expand Down Expand Up @@ -592,10 +592,10 @@ bool IsEqual(byte[] left, byte[] right)
else if (File.Exists(PanaceaDestinationLocation) && File.Exists(PanaceaAlternateLocation))
{
return IsEqual(CalculateChecksum(PanaceaSourceLocation),
CalculateChecksum(PanaceaDestinationLocation)) ||
CalculateChecksum(PanaceaDestinationLocation)) ||
IsEqual(CalculateChecksum(PanaceaSourceLocation),
CalculateChecksum(PanaceaAlternateLocation));
}
}
else
{
PanaceaInstalled = false;
Expand All @@ -619,8 +619,8 @@ public SetupWizardViewModel()
FileDialog.OnFolder(path => PcReleaseLocationKH3D = path));
SelectGameDataLocationCommand = new RelayCommand(_ =>
FileDialog.OnFolder(path => GameDataLocation = path));
ExtractGameDataCommand = new RelayCommand(async _ =>
{
ExtractGameDataCommand = new RelayCommand(async _ =>
{
BEGIN:
try
{
Expand Down Expand Up @@ -807,7 +807,7 @@ public SetupWizardViewModel()
{
MessageBox.Show("Launcher \"Other\" does not support auto detect game installation. If you wish to use this feature select either EGS or Steam on the dropdown above", "Unsupported", MessageBoxButton.OK);
}

});
InstallPanaceaCommand = new RelayCommand(AlternateName =>
{
Expand Down Expand Up @@ -896,7 +896,7 @@ public SetupWizardViewModel()
OnPropertyChanged(nameof(IsLastPanaceaVersionInstalled));
OnPropertyChanged(nameof(PanaceaInstalledVisibility));
OnPropertyChanged(nameof(PanaceaNotInstalledVisibility));
PanaceaInstalled = true;
PanaceaInstalled = true;
}
});
RemovePanaceaCommand = new RelayCommand(_ =>
Expand All @@ -915,7 +915,7 @@ public SetupWizardViewModel()
PanaceaDestinationLocation = Path.Combine(PcReleaseLocationKH3D, "DBGHELP.dll");
PanaceaAlternateLocation = Path.Combine(PcReleaseLocationKH3D, "version.dll");
PanaceaDependenciesLocation = Path.Combine(PcReleaseLocationKH3D, "dependencies");
}
}
else if (PanaceaDestinationLocation == null || PanaceaAlternateLocation == null || PanaceaDestinationLocation == null)
{
MessageBox.Show(
Expand Down Expand Up @@ -946,7 +946,7 @@ public SetupWizardViewModel()
OnPropertyChanged(nameof(IsLastPanaceaVersionInstalled));
OnPropertyChanged(nameof(PanaceaInstalledVisibility));
OnPropertyChanged(nameof(PanaceaNotInstalledVisibility));
PanaceaInstalled = false;
PanaceaInstalled = false;
});
InstallLuaBackendCommand = new RelayCommand(installed =>
{
Expand All @@ -969,7 +969,7 @@ public SetupWizardViewModel()
{
MessageBox.Show(
$"Unable to extract \"{Path.GetFileName(DownPath)}\" as it is not a zip file. You may have to install it manually.",
"Run error", MessageBoxButton.OK, MessageBoxImage.Error);
"Run error", MessageBoxButton.OK, MessageBoxImage.Error);
File.Delete(DownPath);
File.Delete(TempExtractionLocation);
return;
Expand All @@ -982,7 +982,7 @@ public SetupWizardViewModel()
else
{
DestinationCollection = PcReleaseLocationKH3D;
}
}
if (DestinationCollection == null)
{
MessageBox.Show(
Expand Down Expand Up @@ -1203,12 +1203,12 @@ public SetupWizardViewModel()
OnPropertyChanged(nameof(LuaBackendFoundVisibility));
OnPropertyChanged(nameof(LuaBackendNotFoundVisibility));
}
}
}
}
});
RemoveLuaBackendCommand = new RelayCommand(_ =>
{

if (GameCollection == 0 && PcReleaseLocation == null || GameCollection == 1 && PcReleaseLocationKH3D == null)
{
MessageBox.Show(
Expand Down Expand Up @@ -1324,7 +1324,7 @@ await _gameDataExtractionService.ExtractKh2Ps2EditionAsync(
var langFolder = (ConfigurationService.PCVersion == "Steam" && _pcReleaseLanguage == "en") ? "dt" : _pcReleaseLanguage;

await _gameDataExtractionService.ExtractKhPcEditionAsync(
gameDataLocation: @"H:\Tmp\ModsManagerPcExtractionRoot",
gameDataLocation: gameDataLocation,
onProgress: CreateOnProgressProcessor(),
getKhFilePath: fileName
=> Path.Combine(
Expand Down

0 comments on commit 1c9a5ce

Please sign in to comment.