scrap paths directly
This commit is contained in:
parent
13a076ad79
commit
c6a0b39ded
3 changed files with 60 additions and 51 deletions
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
public record InstallationParts
|
||||
{
|
||||
public bool OculusClientExists { get; init; }
|
||||
public bool PicoClientExists { get; init; }
|
||||
public bool AndroidAdminExists { get; init; }
|
||||
public bool AndroidContentExists { get; init; }
|
||||
public bool WindowsContentExists { get; init; }
|
||||
public bool WindowsAdminExists { get; init; }
|
||||
public bool WindowsServerExists { get; init; }
|
||||
public string? OculusClientPath { get; init; }
|
||||
public string? PicoClientPath { get; init; }
|
||||
public string? AndroidAdminPath { get; init; }
|
||||
public string? AndroidContentPath { get; init; }
|
||||
public string? WindowsContentPath { get; init; }
|
||||
public string? WindowsAdminPath { get; init; }
|
||||
public string? WindowsServerPath { get; init; }
|
||||
}
|
||||
|
|
@ -9,13 +9,13 @@ public class ZipScrapper
|
|||
{
|
||||
return new InstallationParts
|
||||
{
|
||||
AndroidContentExists = DoesAndroidContentExists(archive),
|
||||
OculusClientExists = DoesOculusClientExists(archive),
|
||||
PicoClientExists = DoesPicoClientExists(archive),
|
||||
AndroidAdminExists = DoesAndroidAdminExists(archive),
|
||||
WindowsAdminExists = DoesPcAdminExists(archive),
|
||||
WindowsContentExists = DoesWindowsContentExists(archive),
|
||||
WindowsServerExists = DoesServerExists(archive),
|
||||
AndroidContentPath = DoesAndroidContentExists(archive),
|
||||
OculusClientPath = DoesOculusClientExists(archive),
|
||||
PicoClientPath = DoesPicoClientExists(archive),
|
||||
AndroidAdminPath = DoesAndroidAdminExists(archive),
|
||||
WindowsAdminPath = DoesPcAdminExists(archive),
|
||||
WindowsContentPath = DoesWindowsContentExists(archive),
|
||||
WindowsServerPath = DoesServerExists(archive),
|
||||
};
|
||||
// Console.WriteLine($"Contents of {archive}:");
|
||||
// Console.WriteLine("----------------------------------");
|
||||
|
|
@ -36,54 +36,63 @@ public class ZipScrapper
|
|||
return outputPath;
|
||||
}
|
||||
|
||||
private static bool DoesPicoClientExists(ZipArchive archive)
|
||||
private static string? DoesPicoClientExists(ZipArchive archive)
|
||||
{
|
||||
return archive.Entries
|
||||
.Any(entry => entry.Name.Contains("MetaforcePico")
|
||||
var entry = archive.Entries.FirstOrDefault(entry =>
|
||||
entry.Name.Contains("MetaforcePico")
|
||||
&& entry.Name.EndsWith(".apk"));
|
||||
return entry?.FullName;
|
||||
}
|
||||
|
||||
private static bool DoesOculusClientExists(ZipArchive archive)
|
||||
private static string? DoesOculusClientExists(ZipArchive archive)
|
||||
{
|
||||
return archive.Entries
|
||||
.Any(entry => entry.Name.Contains("MetaforceOculus")
|
||||
var entry = archive.Entries.FirstOrDefault(entry =>
|
||||
entry.Name.Contains("MetaforceOculus")
|
||||
&& entry.Name.EndsWith(".apk"));
|
||||
return entry?.FullName;
|
||||
}
|
||||
|
||||
private static bool DoesAndroidAdminExists(ZipArchive archive)
|
||||
private static string? DoesAndroidAdminExists(ZipArchive archive)
|
||||
{
|
||||
return archive.Entries
|
||||
.Any(entry => entry.Name.Contains("MetaforceAdmin")
|
||||
var entry = archive.Entries.FirstOrDefault(entry =>
|
||||
entry.Name.Contains("MetaforceAdmin")
|
||||
&& entry.Name.EndsWith(".apk"));
|
||||
return entry?.FullName;
|
||||
}
|
||||
|
||||
private static bool DoesAndroidContentExists(ZipArchive archive)
|
||||
private static string? DoesAndroidContentExists(ZipArchive archive)
|
||||
{
|
||||
return archive.Entries
|
||||
.Any(entry => entry.Name.Contains("Content_Android")
|
||||
var entry = archive.Entries.FirstOrDefault(entry =>
|
||||
entry.Name.Contains("Content_Android")
|
||||
&& entry.Name.EndsWith(".zip"));
|
||||
return entry?.FullName;
|
||||
}
|
||||
|
||||
private static bool DoesWindowsContentExists(ZipArchive archive)
|
||||
private static string? DoesWindowsContentExists(ZipArchive archive)
|
||||
{
|
||||
return archive.Entries
|
||||
.Any(entry => entry.Name.Contains("Content_StandaloneWindows")
|
||||
var entry = archive.Entries.FirstOrDefault(entry =>
|
||||
entry.Name.Contains("Content_StandaloneWindows")
|
||||
&& entry.Name.EndsWith(".zip"));
|
||||
return entry?.FullName;
|
||||
}
|
||||
|
||||
private static bool DoesPcAdminExists(ZipArchive archive)
|
||||
private static string? DoesPcAdminExists(ZipArchive archive)
|
||||
{
|
||||
return archive.Entries
|
||||
.Any(entry => entry.FullName.Contains("MetaforceAdminPC")
|
||||
&& entry.Name.EndsWith(".exe") && !entry.Name.Contains("UnityCrashHandler") &&
|
||||
var entry = archive.Entries.FirstOrDefault(entry =>
|
||||
entry.FullName.Contains("MetaforceAdminPC") &&
|
||||
entry.Name.EndsWith(".exe")
|
||||
&& !entry.Name.Contains("UnityCrashHandler") &&
|
||||
!entry.Name.Contains("crashpad_handler"));
|
||||
return entry?.FullName;
|
||||
}
|
||||
|
||||
private static bool DoesServerExists(ZipArchive archive)
|
||||
private static string? DoesServerExists(ZipArchive archive)
|
||||
{
|
||||
return archive.Entries
|
||||
.Any(entry => entry.FullName.Contains("MetaforceServer")
|
||||
&& entry.Name.EndsWith(".exe") && !entry.Name.Contains("UnityCrashHandler") &&
|
||||
var entry = archive.Entries.FirstOrDefault(entry =>
|
||||
entry.FullName.Contains("MetaforceServer") &&
|
||||
entry.Name.EndsWith(".exe")
|
||||
&& !entry.Name.Contains("UnityCrashHandler") &&
|
||||
!entry.Name.Contains("crashpad_handler"));
|
||||
return entry?.FullName;
|
||||
}
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ public partial class NewInstallationDialog : Window
|
|||
InstallButton.Click += OnInstallClick;
|
||||
}
|
||||
|
||||
private async void RefreshCheckboxes()
|
||||
private void RefreshCheckboxes()
|
||||
{
|
||||
var serverCheckbox = ServerCheckBox;
|
||||
var pcAdminCheckbox = PcAdminCheckBox;
|
||||
|
|
@ -67,7 +67,6 @@ public partial class NewInstallationDialog : Window
|
|||
private async void OnInstallClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
using var archive = ZipFile.OpenRead(_zipPath);
|
||||
|
||||
}
|
||||
|
||||
private void UpdateCheckboxes()
|
||||
|
|
@ -78,25 +77,25 @@ public partial class NewInstallationDialog : Window
|
|||
var androidAdminCheckbox = AndroidAdminCheckbox;
|
||||
var vrClientCheckbox = VrClientCheckbox;
|
||||
|
||||
if (!_installationParts.WindowsServerExists)
|
||||
if (string.IsNullOrEmpty(_installationParts.WindowsServerPath))
|
||||
{
|
||||
serverCheckbox.IsEnabled = false;
|
||||
serverCheckbox.Content += "\nCouldn't find directory with server";
|
||||
}
|
||||
|
||||
if (!_installationParts.WindowsAdminExists)
|
||||
if (string.IsNullOrEmpty(_installationParts.WindowsAdminPath))
|
||||
{
|
||||
pcAdminCheckbox.IsEnabled = false;
|
||||
pcAdminCheckbox.Content += "\nCouldn't find directory with PC admin";
|
||||
}
|
||||
|
||||
if (!_installationParts.WindowsContentExists)
|
||||
if (string.IsNullOrEmpty(_installationParts.WindowsContentPath))
|
||||
{
|
||||
pcAdminCheckbox.IsEnabled = false;
|
||||
pcAdminCheckbox.Content += "\nCouldn't find windows content";
|
||||
}
|
||||
|
||||
if (!_installationParts.AndroidContentExists)
|
||||
if (string.IsNullOrEmpty(_installationParts.AndroidContentPath))
|
||||
{
|
||||
vrClientCheckbox.IsEnabled = false;
|
||||
vrClientCheckbox.Content += "\nCouldn't find android content";
|
||||
|
|
@ -104,7 +103,8 @@ public partial class NewInstallationDialog : Window
|
|||
androidAdminCheckbox.Content += "\nCouldn't find android content";
|
||||
}
|
||||
|
||||
if (!_installationParts.PicoClientExists && !_installationParts.OculusClientExists)
|
||||
if (string.IsNullOrEmpty(_installationParts.PicoClientPath) &&
|
||||
string.IsNullOrEmpty(_installationParts.OculusClientPath))
|
||||
{
|
||||
vrClientCheckbox.IsEnabled = false;
|
||||
vrClientCheckbox.Content += "\nCouldn't find any VR clients";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue