Skip to content

Commit 59d3b25

Browse files
ComputerEliteComputerElite
authored andcommitted
Fix file copy types, add default mod cover
1 parent 866c7f2 commit 59d3b25

8 files changed

Lines changed: 53 additions & 24 deletions

File tree

QuestAppVersionSwitcher/Assets/html/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ <h2>You can download mods and cosmetics from the following sites. Only QMods are
373373
<div class="contentHeader headerMargin">
374374
Step 1
375375
</div>
376-
<div><b>Restoring a backup will overwrite your current installation. If you do not want to loose your current installtion you <u>must</u> backup it first.<br>To do this abort the restore process and create a backup.</b></div>
376+
<div><b>Restoring a backup will overwrite your current installation. If you do not want to lose your current installtion you <u>must</u> backup it first.<br>To do this abort the restore process and create a backup.</b></div>
377377
<br>
378378
<b>Selected backup:</b> <div class="selectedBackupName inline"></div> of <div class="inline packageName">some game</div>
379379
<br>
@@ -443,7 +443,7 @@ <h2>You can download mods and cosmetics from the following sites. Only QMods are
443443
<div class="contentHeader headerMargin">
444444
Step 2.1
445445
</div>
446-
Press continue after the installation finished. We'll then validate, wether the backup was successfully restored.
446+
Press continue after the installation finished. We'll then validate, whether the backup was successfully restored.
447447
<div id="step5box" class="textBox"></div>
448448
<div class="buttonSelectionContainer">
449449
<div class="buttonContainer buttonMargin">

QuestAppVersionSwitcher/Assets/html/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function UpdateCosmeticsTypes() {
8383
if(!fvalue) {
8484
fvalue = value.fileType
8585
}
86-
html += `<option class="listItem" value="${value.fileType}">${value.name}</option>`
86+
html += `<option class="listItem" value="${value.fileType}">${value.name} (${value.fileType})</option>`
8787
}
8888
}
8989
document.getElementById("availableAfterModdingTypes").style.display = htmlAvailableAfterModding != "" ? "block" : "none"
@@ -266,7 +266,7 @@ function FormatMod(mod, active = true) {
266266
return `
267267
<div class="mod">
268268
<div class="leftRightSplit">
269-
<img class="modCover" src="/mods/cover?id=${mod.Id}">
269+
<img class="modCover" src="/mods/cover?id=${mod.Id}" onerror="this.src = 'https://raw.githubusercontent.com/ComputerElite/ComputerElite.github.io/main/assets/ModCover.png'" >
270270
<div class="upDownSplit spaceBetween">
271271
<div class="upDownSplit">
272272
<div class="leftRightSplit nomargin">

QuestAppVersionSwitcher/Cosmetics/Cosmetics.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Net;
99
using System.Text.Json;
1010
using System.Text.Json.Serialization;
11+
using QuestAppVersionSwitcher.Mods;
1112
using static Android.Graphics.Path;
1213

1314
namespace QuestAppVersionSwitcher
@@ -76,6 +77,30 @@ public static Cosmetics LoadCosmetics()
7677
}
7778
return cos;
7879
}
80+
81+
public void AddCopyType(string packageId, FileCopyType type)
82+
{
83+
if(!games.ContainsKey(packageId)) games.Add(packageId, new CosmeticsGame());
84+
foreach (string extension in type.SupportedExtensions)
85+
{
86+
games[packageId].fileTypes[extension] = new CosmeticType()
87+
{
88+
directory = type.Path,
89+
fileType = extension,
90+
name = type.NamePlural,
91+
requiresModded = true
92+
};
93+
}
94+
}
95+
96+
public void RemoveCopyType(string packageId, FileCopyType type)
97+
{
98+
if (!games.ContainsKey(packageId)) return;
99+
foreach (string extension in type.SupportedExtensions)
100+
{
101+
games[packageId].fileTypes.Remove(extension);
102+
}
103+
}
79104
}
80105

81106
public class CosmeticsGame

QuestAppVersionSwitcher/Mods/OtherFilesManager.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
using QuestAppVersionSwitcher.Core;
1+
using System;
2+
using QuestAppVersionSwitcher.Core;
23
using System.Collections.Generic;
34
using System.Diagnostics;
45
using System.IO;
56
using System.Linq;
67
using System.Text.Json;
8+
using Java.Util.Logging;
79

810
namespace QuestAppVersionSwitcher.Mods
911
{
@@ -54,13 +56,10 @@ public List<FileCopyType> GetFileCopyTypes(string extension)
5456
/// <param name="type">The <see cref="FileCopyType"/> to add</param>
5557
public void RegisterFileCopy(string packageId, FileCopyType type)
5658
{
57-
if (!_copyIndex.TryGetValue(packageId, out var copyTypes))
58-
{
59-
copyTypes = new List<FileCopyType>();
60-
_copyIndex[packageId] = copyTypes;
61-
}
62-
63-
copyTypes.Add(type);
59+
ComputerUtils.Android.Logging.Logger.Log("supported: " + String.Join(", ", type.SupportedExtensions));
60+
ComputerUtils.Android.Logging.Logger.Log(type.Path);
61+
ComputerUtils.Android.Logging.Logger.Log(type.NameSingular);
62+
CoreVars.cosmetics.AddCopyType(packageId, type);
6463
}
6564

6665
/// <summary>
@@ -70,7 +69,7 @@ public void RegisterFileCopy(string packageId, FileCopyType type)
7069
/// <param name="type">The <see cref="FileCopyType"/> to remove</param>
7170
public void RemoveFileCopy(string packageId, FileCopyType type)
7271
{
73-
_copyIndex[packageId].Remove(type);
72+
CoreVars.cosmetics.RemoveCopyType(packageId, type);
7473
}
7574
}
7675
}

QuestAppVersionSwitcher/Mods/QPMod.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,17 @@ public QPMod(QModProvider provider, QModManifest manifest, ModManager modManager
5151
Manifest = manifest;
5252
_modManager = modManager;
5353

54-
FileCopyTypes = manifest.CopyExtensions.Select(copyExt => new FileCopyType()
54+
FileCopyTypes = manifest.CopyExtensions.Select(copyExt =>
5555
{
56-
NameSingular = $"{manifest.Name} .{copyExt.Extension} file",
57-
NamePlural = $"{manifest.Name} .{copyExt.Extension} files",
58-
Path = copyExt.Destination,
59-
SupportedExtensions = new List<string> { copyExt.Destination }
56+
string destination = copyExt.Destination;
57+
if (!destination.EndsWith(Path.DirectorySeparatorChar)) destination += Path.DirectorySeparatorChar;
58+
return new FileCopyType()
59+
{
60+
NameSingular = $"{manifest.Name} .{copyExt.Extension} file",
61+
NamePlural = $"{manifest.Name} .{copyExt.Extension} files",
62+
Path = destination,
63+
SupportedExtensions = new List<string> { "." + copyExt.Extension }
64+
};
6065
}).ToList();
6166
}
6267

QuestAppVersionSwitcher/Properties/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.9.7" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="45">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.9.8" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="46">
33
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="29" />
44
<uses-permission android:name="oculus.permission.handtracking" />
55
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />

QuestAppVersionSwitcher/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
// Minor Version
2323
// Build Number
2424
// Revision
25-
[assembly: AssemblyVersion("1.9.7.0")]
26-
[assembly: AssemblyFileVersion("1.9.7.0")]
25+
[assembly: AssemblyVersion("1.9.8.0")]
26+
[assembly: AssemblyFileVersion("1.9.8.0")]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<SelectedDevice>Google Pixel 6</SelectedDevice>
5-
<ActiveDebugProfile>Google Pixel 6 %28Android 13.0 - API 33%29</ActiveDebugProfile>
4+
<SelectedDevice>Android Emulator</SelectedDevice>
5+
<ActiveDebugProfile>Android Emulator</ActiveDebugProfile>
66
<DefaultDevice>Pixel_5_API_30</DefaultDevice>
77
<AndroidDesignerPreferredTheme>AppTheme</AndroidDesignerPreferredTheme>
88
<AndroidDesignerPreferredDevice>automotive_1024p_landscape</AndroidDesignerPreferredDevice>
9-
<SelectedPlatformGroup>PhysicalDevice</SelectedPlatformGroup>
9+
<SelectedPlatformGroup>Emulator</SelectedPlatformGroup>
1010
</PropertyGroup>
1111
</Project>

0 commit comments

Comments
 (0)