Cleaned up a ton of code, fixed 2x crash errors from last update. Added timestamp to crashlog and debuglog, removed wall of test (gameslist entire contents) from debuglog to make it easier to read.
This commit is contained in:
102
ADB.cs
102
ADB.cs
@@ -12,11 +12,7 @@ namespace AndroidSideloader
|
||||
class ADB
|
||||
{
|
||||
static Process adb = new Process();
|
||||
<<<<<<< HEAD
|
||||
public static string adbFolderPath = "C:\\RSL\\2.1.1\\ADB";
|
||||
=======
|
||||
public static string adbFolderPath = "C:\\RSL\\2.1HF5\\ADB";
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
public static string adbFilePath = adbFolderPath + "\\adb.exe";
|
||||
public static string DeviceID = "";
|
||||
public static string package = "";
|
||||
@@ -66,10 +62,6 @@ namespace AndroidSideloader
|
||||
MessageBox.Show("Please check inside your headset for ADB DEBUGGING prompt, check box to \"Always allow from this computer.\" and hit OK.");
|
||||
ADB.WakeDevice();
|
||||
}
|
||||
if (error.Contains("not enough storage space"))
|
||||
{
|
||||
MessageBox.Show("There is not enough room on your device to install this package. Please clear AT LEAST 2x the amount of the app you are trying to install.");
|
||||
}
|
||||
Logger.Log(output);
|
||||
Logger.Log(error);
|
||||
return new ProcessOutput(output, error);
|
||||
@@ -127,11 +119,7 @@ namespace AndroidSideloader
|
||||
return new ProcessOutput(output, error);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public static ProcessOutput RunCommandToString(string result, string file = "")
|
||||
=======
|
||||
public static ProcessOutput RunCommandToString(string result, string path = "")
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
{
|
||||
string command = result;
|
||||
Properties.Settings.Default.ADBFolder = adbFolderPath;
|
||||
@@ -240,7 +228,6 @@ namespace AndroidSideloader
|
||||
private static bool dialogisup = false;
|
||||
public static void WakeDevice()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
string output = RunAdbCommandToString("shell input keyevent KEYCODE_WAKEUP").Error;
|
||||
RunAdbCommandToString("Devices");
|
||||
if (output.Contains("found"))
|
||||
@@ -332,95 +319,6 @@ namespace AndroidSideloader
|
||||
}
|
||||
}
|
||||
}
|
||||
=======
|
||||
RunAdbCommandToString("shell input keyevent KEYCODE_WAKEUP");
|
||||
string devicesout = RunAdbCommandToString("devices").Output;
|
||||
if (!devicesout.Contains("found"))
|
||||
{
|
||||
if (Properties.Settings.Default.IPAddress.Contains("connect"))
|
||||
{
|
||||
|
||||
RunAdbCommandToString(Properties.Settings.Default.IPAddress);
|
||||
string response = ADB.RunAdbCommandToString(Properties.Settings.Default.IPAddress).Output;
|
||||
|
||||
if (response.Contains("cannot"))
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Either your Quest is idle or you have rebooted the device.\nRSL's wireless ADB will persist on PC reboot but not on Quest reboot.\n\nNOTE: If you haven't rebooted your Quest it may be idle.\n\nTo prevent this press the HOLD button 2x prior to launching RSL. Or\nkeep your Quest plugged into power to keep it permanently \"awake\".\n\nHave you assigned your Quest a static IP in your router configuration?\n\nIf you no longer want to use Wireless ADB or your device was idle please hit CANCEL.", "DEVICE REBOOTED\\IDLE?", MessageBoxButtons.YesNoCancel);
|
||||
if (dialogResult == DialogResult.Cancel)
|
||||
{
|
||||
DialogResult dialogResult2 = MessageBox.Show("Press OK to remove your stored IP address.\nIf your Quest went idle press the HOLD button on the device twice then press CANCEL to reconnect.", "REMOVE STORED IP?", MessageBoxButtons.OKCancel);
|
||||
if (dialogResult2 == DialogResult.Cancel)
|
||||
ADB.WakeDevice();
|
||||
if (dialogResult2 == DialogResult.OK)
|
||||
{
|
||||
Properties.Settings.Default.IPAddress = "";
|
||||
Properties.Settings.Default.Save();
|
||||
ADB.WakeDevice();
|
||||
}
|
||||
|
||||
}
|
||||
else if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
MessageBox.Show("Connect your Quest to USB so we can reconnect to your saved IP address!");
|
||||
ADB.RunAdbCommandToString("devices");
|
||||
Thread.Sleep(250);
|
||||
ADB.RunAdbCommandToString("disconnect");
|
||||
Thread.Sleep(50);
|
||||
ADB.RunAdbCommandToString("connect");
|
||||
Thread.Sleep(50);
|
||||
ADB.RunAdbCommandToString("tcpip 5555");
|
||||
Thread.Sleep(500);
|
||||
ADB.RunAdbCommandToString(Properties.Settings.Default.IPAddress);
|
||||
MessageBox.Show($"Connected! We can now automatically enable wake on wifi. This makes it so Rookie can work wirelessly even if the device has entered \"sleep mode\". This setting is NOT permanent and resets upon Quest reboot just like wireless ADB functionality.\n\n After testing with this setting off and on the difference in battery usage seems nonexistent. We recommend this setting for the majority of users for ease of use purposes. If you click NO you must keep your Quest connected to a charger OR wake your device and then put it back on hold before using Rookie wirelessly. Do you want to enable wake on wifi?", "Enable Wake on Wifi?", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
|
||||
ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_available 1");
|
||||
ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_enabled 1");
|
||||
}
|
||||
if (dialogResult == DialogResult.No)
|
||||
{
|
||||
|
||||
Program.form.ChangeTitlebarToDevice();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (dialogResult == DialogResult.No)
|
||||
{
|
||||
MessageBox.Show("You must repeat the entire connection process, press OK to begin.", "Reconfigure Wireless ADB", MessageBoxButtons.OK);
|
||||
ADB.RunAdbCommandToString("devices");
|
||||
ADB.RunAdbCommandToString("tcpip 5555");
|
||||
MessageBox.Show("Press OK to get your Quest's local IP address.", "Obtain local IP address", MessageBoxButtons.OK);
|
||||
Thread.Sleep(1000);
|
||||
string input = ADB.RunAdbCommandToString("shell ip route").Output;
|
||||
|
||||
Properties.Settings.Default.WirelessADB = true;
|
||||
Properties.Settings.Default.Save();
|
||||
string[] strArrayOne = new string[] { "" };
|
||||
strArrayOne = input.Split(' ');
|
||||
if (strArrayOne[0].Length > 7)
|
||||
{
|
||||
string IPaddr = strArrayOne[8];
|
||||
string IPcmnd = "connect " + IPaddr + ":5555";
|
||||
MessageBox.Show($"Your Quest's local IP address is: {IPaddr}\n\nPlease disconnect your Quest then wait 2 seconds.\nOnce it is disconnected hit OK", "", MessageBoxButtons.OK);
|
||||
Thread.Sleep(2000);
|
||||
ADB.RunAdbCommandToString(IPcmnd);
|
||||
Properties.Settings.Default.IPAddress = IPcmnd;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
MessageBox.Show($"Connected! We can now automatically disable the Quest wifi chip from falling asleep. This makes it so Rookie can work wirelessly even if the device has entered \"sleep mode\". This setting is NOT permanent and resets upon Quest reboot, just like wireless ADB functionality.\n\nNOTE: This may cause the device battery to drain while it is in sleep mode at a very slightly increased rate. We recommend this setting for the majority of users for ease of use purposes. If you click NO you must keep your Quest connected to a charger or wake your device and then put it back on hold before using Rookie wirelessly. Do you want us to stop sleep mode from disabling wireless ADB?", "", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
|
||||
ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_available 1");
|
||||
ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_enabled 1");
|
||||
}
|
||||
Program.form.ChangeTitlebarToDevice();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
180
MainForm.cs
180
MainForm.cs
@@ -37,10 +37,6 @@ namespace AndroidSideloader
|
||||
|
||||
{
|
||||
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
t.Interval = 840000; // 14 mins between wakeup commands
|
||||
t.Tick += new EventHandler(timer_Tick);
|
||||
t.Start();
|
||||
@@ -49,7 +45,6 @@ namespace AndroidSideloader
|
||||
|
||||
private string oldTitle = "";
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
private async void Form1_Load(object sender, EventArgs e)
|
||||
@@ -224,8 +219,6 @@ namespace AndroidSideloader
|
||||
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -233,11 +226,8 @@ namespace AndroidSideloader
|
||||
}
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
public async void ChangeTitle(string txt, bool reset = true)
|
||||
{
|
||||
this.Invoke(() => { oldTitle = txt; this.Text = "Rookie's Sideloader | " + txt; });
|
||||
@@ -328,12 +318,8 @@ namespace AndroidSideloader
|
||||
ADB.DeviceID = GetDeviceID();
|
||||
Thread t1 = new Thread(() =>
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
output = ADB.RunAdbCommandToString("devices").Output;
|
||||
|
||||
=======
|
||||
output = ADB.RunAdbCommandToString("devices").Output;
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
});
|
||||
|
||||
|
||||
@@ -352,23 +338,18 @@ namespace AndroidSideloader
|
||||
foreach (string currLine in line)
|
||||
{
|
||||
if (i > 0 && currLine.Length > 0)
|
||||
{
|
||||
Devices.Add(currLine.Split(' ')[0]);
|
||||
devicesComboBox.Items.Add(currLine.Split(' ')[0]);
|
||||
Logger.Log(currLine.Split(' ')[0] + "\n", false);
|
||||
}
|
||||
Debug.WriteLine(currLine);
|
||||
{
|
||||
Devices.Add(currLine.Split(' ')[0]);
|
||||
devicesComboBox.Items.Add(currLine.Split(' ')[0]);
|
||||
Logger.Log(currLine.Split(' ')[0] + "\n", false);
|
||||
}
|
||||
Debug.WriteLine(currLine);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (devicesComboBox.Items.Count > 0)
|
||||
devicesComboBox.SelectedIndex = 0;
|
||||
foreach(var item in devicesComboBox.Items)
|
||||
{
|
||||
string result = $"{Properties.Settings.Default.ADBPath} shell -s {item} getprop ro.product.system.manufacturer";
|
||||
if (ADB.RunCommandToString(result).Output.Contains("Oculus"))
|
||||
devicesComboBox.SelectedItem = item;
|
||||
}
|
||||
|
||||
return devicesComboBox.SelectedIndex;
|
||||
}
|
||||
|
||||
@@ -517,88 +498,6 @@ namespace AndroidSideloader
|
||||
catch { HasInternet = false; }
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
private async void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
string adbFile = "C:\\RSL\\2.1HF5\\adb\\adb.exe";
|
||||
string adbDir = "C:\\RSL\\2.1HF5\\adb";
|
||||
string fileName = "";
|
||||
string destFile = "";
|
||||
Properties.Settings.Default.MainDir = Environment.CurrentDirectory;
|
||||
Properties.Settings.Default.Save();
|
||||
if (!File.Exists(adbFile))
|
||||
{
|
||||
Directory.CreateDirectory(adbDir);
|
||||
if (System.IO.Directory.Exists($"{Environment.CurrentDirectory}\\adb"))
|
||||
{
|
||||
string[] ADBfiles = System.IO.Directory.GetFiles($"{Properties.Settings.Default.MainDir}\\adb");
|
||||
|
||||
// Copy the files and overwrite destination files if they already exist.
|
||||
foreach (string s in ADBfiles)
|
||||
{
|
||||
fileName = System.IO.Path.GetFileName(s);
|
||||
destFile = System.IO.Path.Combine(adbDir, fileName);
|
||||
System.IO.File.Copy(s, destFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Properties.Settings.Default.ADBPath = adbFile;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
|
||||
ADB.RunAdbCommandToString("kill-server");
|
||||
if (File.Exists(Sideloader.CrashLogPath))
|
||||
{
|
||||
DialogResult dialogResult = FlexibleMessageBox.Show(this, $@"Looks like sideloader crashed last time, please make an issue at https://github.com/nerdunit/androidsideloader/issues
|
||||
Please don't forget to post the crash.log and fill in any details you can
|
||||
Do you want to delete the {Sideloader.CrashLogPath} (if you press yes, this message will not appear when you start the sideloader but please first report this issue)", "Crash Detected", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
File.Delete(Sideloader.CrashLogPath);
|
||||
}
|
||||
CheckForInternet();
|
||||
|
||||
if (HasInternet == true)
|
||||
Sideloader.downloadFiles();
|
||||
else
|
||||
FlexibleMessageBox.Show("Cannot connect to google dns, your internet may be down, won't use rclone or online features!");
|
||||
await Task.Delay(100);
|
||||
|
||||
if (!Directory.Exists(BackupFolder))
|
||||
Directory.CreateDirectory(BackupFolder);
|
||||
|
||||
if (Directory.Exists(Sideloader.TempFolder))
|
||||
{
|
||||
Directory.Delete(Sideloader.TempFolder, true);
|
||||
Directory.CreateDirectory(Sideloader.TempFolder);
|
||||
}
|
||||
|
||||
//Delete the Debug file if it is more than 5MB
|
||||
if (File.Exists(Logger.logfile))
|
||||
{
|
||||
long length = new System.IO.FileInfo(Logger.logfile).Length;
|
||||
if (length > 5000000) File.Delete(Logger.logfile);
|
||||
}
|
||||
|
||||
RCLONE.Init();
|
||||
try { Spoofer.spoofer.Init(); } catch { }
|
||||
|
||||
if (Properties.Settings.Default.CallUpgrade)
|
||||
{
|
||||
Properties.Settings.Default.Upgrade();
|
||||
Properties.Settings.Default.CallUpgrade = false;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
this.CenterToScreen();
|
||||
gamesListView.View = View.Details;
|
||||
gamesListView.FullRowSelect = true;
|
||||
gamesListView.GridLines = true;
|
||||
etaLabel.Text = "";
|
||||
speedLabel.Text = "";
|
||||
diskLabel.Text = "";
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
|
||||
|
||||
|
||||
@@ -1030,62 +929,6 @@ Do you want to delete the {Sideloader.CrashLogPath} (if you press yes, this mess
|
||||
gamesListView.EndUpdate();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
private async void Form1_Shown(object sender, EventArgs e)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
Thread.Sleep(10000);
|
||||
freeDisclaimer.Invoke(() => { freeDisclaimer.Dispose(); });
|
||||
}).Start();
|
||||
|
||||
Thread t1 = new Thread(() =>
|
||||
{
|
||||
if (!debugMode && Properties.Settings.Default.checkForUpdates)
|
||||
{
|
||||
Updater.AppName = "AndroidSideloader";
|
||||
Updater.Repostory = "nerdunit/androidsideloader";
|
||||
Updater.Update();
|
||||
}
|
||||
progressBar.Invoke(() => { progressBar.Style = ProgressBarStyle.Marquee; });
|
||||
ChangeTitle("Initializing Mirrors");
|
||||
initMirrors(true);
|
||||
ChangeTitle("Initializing Games");
|
||||
SideloaderRCLONE.initGames(currentRemote);
|
||||
if (!Directory.Exists(SideloaderRCLONE.ThumbnailsFolder) || !Directory.Exists(SideloaderRCLONE.NotesFolder))
|
||||
{
|
||||
MessageBox.Show("It seems you are missing the thumbnails and/or notes database, the first start of the sideloader takes a bit more time, so dont worry if it looks stuck!");
|
||||
}
|
||||
ChangeTitle("Syncing Game Photos");
|
||||
SideloaderRCLONE.UpdateGamePhotos(currentRemote);
|
||||
ChangeTitle("Checking for Updates on server...");
|
||||
SideloaderRCLONE.UpdateGameNotes(currentRemote);
|
||||
listappsbtn();
|
||||
});
|
||||
t1.SetApartmentState(ApartmentState.STA);
|
||||
t1.IsBackground = false;
|
||||
if (HasInternet)
|
||||
t1.Start();
|
||||
|
||||
showAvailableSpace();
|
||||
|
||||
intToolTips();
|
||||
|
||||
while (t1.IsAlive)
|
||||
await Task.Delay(100);
|
||||
ChangeTitle("GREEN = Up to date, ORANGE = Out of date - Checking installed app versions, please wait...");
|
||||
|
||||
initListView();
|
||||
ChangeTitle("Loaded");
|
||||
downloadInstallGameButton.Enabled = true;
|
||||
|
||||
progressBar.Style = ProgressBarStyle.Continuous;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
private void initMirrors(bool random)
|
||||
{
|
||||
int index = 0;
|
||||
@@ -1197,17 +1040,9 @@ without him none of this would be possible
|
||||
MessageBox.Show($"Connected! We can now automatically disable the Quest wifi chip from falling asleep. This makes it so Rookie can work wirelessly even if the device has entered \"sleep mode\". This setting is NOT permanent and resets upon Quest reboot, just like wireless ADB functionality.\n\nNOTE: This may cause the device battery to drain while it is in sleep mode at a very slightly increased rate. We recommend this setting for the majority of users for ease of use purposes. If you click NO you must keep your Quest connected to a charger or wake your device and then put it back on hold before using Rookie wirelessly. Do you want us to stop sleep mode from disabling wireless ADB?", "", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_available 1");
|
||||
ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_enabled 1");
|
||||
}
|
||||
=======
|
||||
|
||||
ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_available 1");
|
||||
ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_enabled 1");
|
||||
}
|
||||
Program.form.ChangeTitlebarToDevice();
|
||||
>>>>>>> + Added optional Wake on Wifi setting so Wireless ADB will still connect as long as device is not powered off or dead.
|
||||
}
|
||||
else
|
||||
MessageBox.Show("No device connected!");
|
||||
@@ -1355,7 +1190,6 @@ without him none of this would be possible
|
||||
while (gamesQueueList.Count > 0)
|
||||
{
|
||||
gameName = gamesQueueList.ToArray()[0];
|
||||
string packagename = Sideloader.gameNameToPackageName(gameName);
|
||||
string dir = Path.GetDirectoryName(gameName);
|
||||
string gameDirectory = Environment.CurrentDirectory + "\\" + gameName;
|
||||
string path = gameDirectory;
|
||||
|
||||
Reference in New Issue
Block a user