Skip to content

Commit 29fe38a

Browse files
author
ComputerElite
committed
Initial commit
1 parent e30c44a commit 29fe38a

43 files changed

Lines changed: 18378 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/bin
2+
/obj

AndroidTools.cs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using Android;
2+
using Android.App;
3+
using Android.Content;
4+
using Android.Content.PM;
5+
using System;
6+
using System.Collections.Generic;
7+
using Xamarin.Essentials;
8+
using static Xamarin.Essentials.Permissions;
9+
10+
namespace QuestAppVersionSwitcher.Core
11+
{
12+
public class AndroidService
13+
{
14+
public static List<App> GetInstalledApps()
15+
{
16+
List<App> inApps = new List<App>();
17+
IList<ApplicationInfo> apps = Android.App.Application.Context.PackageManager.GetInstalledApplications(PackageInfoFlags.MatchAll);
18+
for (int i = 0; i < apps.Count; i++)
19+
{
20+
inApps.Add(new App(apps[i].LoadLabel(Android.App.Application.Context.PackageManager), apps[i].PackageName));
21+
}
22+
return inApps;
23+
}
24+
25+
public static string FindAPKLocation(string package)
26+
{
27+
try
28+
{
29+
ApplicationInfo applicationInfo = Android.App.Application.Context.PackageManager.GetApplicationInfo(package, PackageInfoFlags.MatchAll);
30+
return (applicationInfo != null) ? applicationInfo.SourceDir : null;
31+
}
32+
catch (PackageManager.NameNotFoundException)
33+
{
34+
}
35+
return null;
36+
}
37+
38+
public static void InitiateUninstallPackage(string package)
39+
{
40+
Intent uninstallIntent = new Intent(Intent.ActionDelete, Android.Net.Uri.Parse("package:" + package));
41+
//uninstallIntent.AddFlags(ActivityFlags.NewTask);
42+
CoreService.context.StartActivity(uninstallIntent);
43+
}
44+
45+
public static bool IsPackageInstalled(string package)
46+
{
47+
bool installed = false;
48+
foreach(App a in GetInstalledApps())
49+
{
50+
if (a.PackageName == package) { installed = true; break; }
51+
}
52+
return installed;
53+
}
54+
55+
public static void InitiateInstallApk(string apkLocation)
56+
{
57+
Intent intent = new Intent(Intent.ActionView);
58+
intent.SetDataAndType(FileProvider.GetUriForFile(CoreService.context, CoreService.context.PackageName + ".provider", new Java.IO.File(apkLocation)), "application/vnd.android.package-archive");
59+
//intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);
60+
intent.SetFlags(ActivityFlags.GrantReadUriPermission);
61+
CoreService.context.StartActivity(intent);
62+
}
63+
}
64+
65+
public class App
66+
{
67+
public string AppName { get; set; }
68+
public string PackageName { get; set; }
69+
70+
public App(string appName, string packageName)
71+
{
72+
AppName = appName;
73+
PackageName = packageName;
74+
}
75+
}
76+
}

Assets/AboutAssets.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with your package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

Assets/html/index.html

Lines changed: 435 additions & 0 deletions
Large diffs are not rendered by default.

Assets/html/style.css

Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
body {
2+
margin: 0px;
3+
color: #FFFFFF;
4+
font-family: 'Open Sans';
5+
line-height: 1.3;
6+
}
7+
8+
.menuContainer {
9+
background-color: #414141;
10+
width: 100%;
11+
height: 100%;
12+
display: flex;
13+
flex-wrap: nowrap;
14+
15+
}
16+
17+
.sidebar {
18+
background-color: #242424;
19+
width: fit-content;
20+
}
21+
22+
.content {
23+
height: 100%;
24+
width: 100%;
25+
overflow-y: scroll;
26+
}
27+
28+
.contentItem {
29+
height: 100%;
30+
width: 100%;
31+
padding: 20px;
32+
}
33+
34+
.contentHeader {
35+
font-size: 130%;
36+
margin-bottom: 30px;
37+
}
38+
39+
.contentHeaderDescription {
40+
font-size: 60%;
41+
display: inline;
42+
margin-left: 20px;
43+
}
44+
45+
.menuItem {
46+
padding: 20px;
47+
display: flex;
48+
align-items: center;
49+
color: #595959;
50+
}
51+
52+
.selected {
53+
color: #FFFFFF;
54+
background-color: #414141;
55+
}
56+
57+
.menuItem:hover {
58+
background-color: #5B5B5B;
59+
color: #FFFFFF;
60+
}
61+
62+
.header {
63+
padding: 20px;
64+
display: flex;
65+
flex-direction: column;
66+
}
67+
68+
.inline {
69+
display: inline;
70+
}
71+
72+
.buttonContainer {
73+
display: flex;
74+
align-items: center;
75+
margin-top: 10px;
76+
}
77+
78+
.button {
79+
border-radius: 5px;
80+
font-size: 100%;
81+
background-color: #5B5B5B;
82+
width: fit-content;
83+
height: fit-content;
84+
padding: 5px;
85+
cursor: pointer;
86+
flex-shrink: 0;
87+
user-select: none;
88+
}
89+
90+
.button:hover {
91+
background-color: #505050;
92+
}
93+
94+
.buttonLabel {
95+
display: inline;
96+
font-size: 90%;
97+
margin-left: 20px;
98+
}
99+
100+
.about {
101+
margin-top: 40px;
102+
}
103+
104+
.list {
105+
display: flex;
106+
flex-wrap: wrap;
107+
max-height: 90%;
108+
background-color: #1F1F1F;
109+
height: fit-content;
110+
color: #FFFFFF;
111+
width: fit-content;
112+
overflow-y: scroll;
113+
}
114+
115+
.listContainer {
116+
display: flex;
117+
align-items: center;
118+
justify-content: center;
119+
width: 100%;
120+
position: fixed;
121+
height: 100%;
122+
}
123+
124+
.smallListContainer {
125+
padding: 10px;
126+
display: flex;
127+
align-items: center;
128+
width: 90%;
129+
max-height: 300;
130+
overflow-y: scroll;
131+
}
132+
133+
.listItem {
134+
padding: 10px;
135+
width: 100%;
136+
color: #FFFFFF;
137+
height: 30px;
138+
display: flex;
139+
align-items: center;
140+
cursor: pointer;
141+
}
142+
143+
.listItemSelected {
144+
background-color: #115992;
145+
}
146+
147+
.listItem:hover {
148+
background-color: #5B5B5B;
149+
color: #FFFFFF;
150+
}
151+
152+
.hidden {
153+
display: none;
154+
}
155+
156+
input {
157+
padding: 5px;
158+
width: 70%;
159+
border: none;
160+
color: #EEEEEE;
161+
background-color: #202225;
162+
}
163+
164+
code {
165+
padding: 5px;
166+
border-radius: 3px;
167+
background-color: #202225;
168+
border: 1px solid black;
169+
}
170+
171+
.headerMargin {
172+
margin-top: 40px;
173+
}
174+
175+
.labelMargin {
176+
margin-right: 10px;
177+
}
178+
179+
.buttonSelectionContainer {
180+
display: flex;
181+
}
182+
183+
.buttonMargin {
184+
margin-left: 20px;
185+
}
186+
187+
.restoreStep {
188+
padding: 20px;
189+
background-color: #1F1F1F;
190+
}
191+
192+
.darken {
193+
background-color: #00000055;
194+
}
195+
196+
.textBox {
197+
margin-top: 20px;
198+
}
199+
200+
#backupList {
201+
width: 100%;
202+
}
203+
204+
205+
.lds-ellipsis {
206+
display: inline-block;
207+
position: relative;
208+
width: 80px;
209+
height: 80px;
210+
margin: 20px;
211+
}
212+
.lds-ellipsis div {
213+
position: absolute;
214+
top: 33px;
215+
width: 13px;
216+
height: 13px;
217+
border-radius: 50%;
218+
background: #1a83da;
219+
animation-timing-function: cubic-bezier(0, 1, 1, 0);
220+
}
221+
.lds-ellipsis div:nth-child(1) {
222+
left: 8px;
223+
animation: lds-ellipsis1 0.6s infinite;
224+
}
225+
.lds-ellipsis div:nth-child(2) {
226+
left: 8px;
227+
animation: lds-ellipsis2 0.6s infinite;
228+
}
229+
.lds-ellipsis div:nth-child(3) {
230+
left: 32px;
231+
animation: lds-ellipsis2 0.6s infinite;
232+
}
233+
.lds-ellipsis div:nth-child(4) {
234+
left: 56px;
235+
animation: lds-ellipsis3 0.6s infinite;
236+
}
237+
@keyframes lds-ellipsis1 {
238+
0% {
239+
transform: scale(0);
240+
}
241+
100% {
242+
transform: scale(1);
243+
}
244+
}
245+
@keyframes lds-ellipsis3 {
246+
0% {
247+
transform: scale(1);
248+
}
249+
100% {
250+
transform: scale(0);
251+
}
252+
}
253+
@keyframes lds-ellipsis2 {
254+
0% {
255+
transform: translate(0, 0);
256+
}
257+
100% {
258+
transform: translate(24px, 0);
259+
}
260+
}
261+

ClientModels.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Collections.Generic;
2+
3+
namespace QuestAppVersionSwitcher.ClientModels
4+
{
5+
public class About
6+
{
7+
public string version { get; set; } = "";
8+
public List<string> browserIPs { get; set; } = new List<string>();
9+
}
10+
11+
public class AppBackup
12+
{
13+
public string backupName { get; set; } = "";
14+
public string backupLocation { get; set; } = "";
15+
public bool containsGamedata { get; set; } = false;
16+
17+
public AppBackup(string name, bool gamedata, string location)
18+
{
19+
this.backupName = name;
20+
this.containsGamedata = gamedata;
21+
this.backupLocation = location;
22+
}
23+
}
24+
25+
public class BackupList
26+
{
27+
public List<AppBackup> backups { get; set; } = new List<AppBackup>();
28+
public string lastRestored { get; set; } = "";
29+
}
30+
}

0 commit comments

Comments
 (0)