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