Пример #1
0
 public static void PushUserJsons()
 {
     foreach (var userJson in UsernameForm.userJsons)
     {
         UsernameForm.createUserJsonByName(Utilities.randomString(16), userJson);
         ADB.RunAdbCommandToString("push \"" + Environment.CurrentDirectory + $"\\{userJson}\" " + " /sdcard/");
         File.Delete(userJson);
     }
 }
Пример #2
0
        //A lot of stuff to do when the form loads, centers the program,
        private void Form1_Load(object sender, EventArgs e)
        {
            this.CenterToScreen();

            SetTimerSpeed();

            etaLabel.Text   = "";
            speedLabel.Text = "";
            diskLabel.Text  = "";

            if (File.Exists(debugPath))
            {
                File.Delete(debugPath); //clear debug.log each start
            }
            try { downloadFiles(); } catch { notify("You must have internet access for initial downloads, you can try:\n1. Disabling the firewall and antivirus\n2. Delete every file from the sideloader besides the .exe\n3. Try a vpn\n"); }

            if (debugMode == false)
            {
                if (Properties.Settings.Default.checkForUpdates == true)
                {
                    checkForUpdate();
                }
            }

            RunAdbCommand("devices"); //check if there is any device connected

            ChangeTitlebarToDevice();

            if (line[1].Length > 1) //check for device connected
            {
                if (Properties.Settings.Default.firstRun == true)
                {
                    UsernameForm.createUserJson(randomString(16));
                    UsernameForm.pushUserJson();
                    UsernameForm.deleteUserJson();
                    Properties.Settings.Default.firstRun = false;
                    Properties.Settings.Default.Save();
                }
                showAvailableSpace();
            }

            intToolTips();

            listappsBtn();
        }
Пример #3
0
        private async void downloadInstallGameButton_Click(object sender, EventArgs e)
        {
            if (updatedConfig == false && Properties.Settings.Default.autoUpdateConfig == true) //check for config only once per program open and if setting enabled
            {
                ChangeTitle("Rookie's Sideloader | Updating rclone config");
                await Task.Run(() => updateConfig());
            }

            string gameName = gamesComboBox.SelectedItem.ToString();

            Debug.WriteLine(runRcloneCommand($"size \"VRP:Quest Games/{gameName}\" --config .\\a --json"));

            dynamic results = JsonConvert.DeserializeObject <dynamic>(runRcloneCommand($"size \"VRP:Quest Games/{gameName}\" --config .\\a --json"));

            long gameSize = results.bytes.ToObject <long>();

            DialogResult dialogResult = FlexibleMessageBox.Show($"Are you sure you want to download {gameName}? it has a size of {String.Format("{0:0.00}", (double)gameSize / 1000000)} MB", "Are you sure?", MessageBoxButtons.YesNo);

            if (dialogResult != DialogResult.Yes)
            {
                return;
            }

            int apkNumber = 0;
            int obbNumber = 0;


            Directory.CreateDirectory(Environment.CurrentDirectory + "\\" + gameName);

            string[] games;

            Thread t1 = new Thread(() =>
            {
                games = runRcloneCommand("copy --config .\\a \"VRP:Quest Games/" + gameName + "\" \"" + Environment.CurrentDirectory + "\\" + gameName + "\" --progress --drive-acknowledge-abuse --rc").Split('\n');
            });

            t1.IsBackground = true;
            t1.Start();

            ChangeTitle("Rookie's Sideloader | Pushing user.json");

            UsernameForm.createUserJson(randomString(16));

            UsernameForm.pushUserJson();

            UsernameForm.deleteUserJson();

            ChangeTitle("Rookie's Sideloader | Downloading game " + gameName);

            await Task.Delay(5000);

            int i = 0;

            while (wait)
            {
                try
                {
                    HttpResponseMessage response = await client.PostAsync("http://127.0.0.1:5572/core/stats", null);

                    string foo = await response.Content.ReadAsStringAsync();

                    Debug.WriteLine("RESP CONTENT " + foo);
                    results = JsonConvert.DeserializeObject <dynamic>(foo);

                    float downloadSpeed = results.speed.ToObject <float>();

                    long allSize = 0;

                    long downloaded = 0;


                    foreach (var obj in results.transferring)
                    {
                        allSize    += obj["size"].ToObject <long>();
                        downloaded += obj["bytes"].ToObject <long>();
                    }
                    allSize    /= 1000000;
                    downloaded /= 1000000;
                    Debug.WriteLine("Allsize: " + allSize + "\nDownloaded: " + downloaded + "\nValue: " + (((double)downloaded / (double)allSize) * 100));
                    try { progressBar.Value = Convert.ToInt32((((double)downloaded / (double)allSize) * 100)); } catch { }

                    i++;
                    downloadSpeed /= 1000000;
                    if (i == 4)
                    {
                        i = 0;
                        float seconds = (allSize - downloaded) / downloadSpeed;

                        TimeSpan time = TimeSpan.FromSeconds(seconds);

                        etaLabel.Text = "ETA: " + time.ToString(@"hh\:mm\:ss") + " left";
                    }

                    speedLabel.Text = "DLS: " + String.Format("{0:0.00}", downloadSpeed) + " mbps";
                }
                catch { }

                await Task.Delay(1000);
            }

            progressBar.Value = 0;
            ChangeTitle("Rookie's Sideloader | Installing game apk " + gameName);
            etaLabel.Text   = "ETA: Done";
            speedLabel.Text = "DLS: Done";

            AprilPrank();
            string[] files = Directory.GetFiles(Environment.CurrentDirectory + "\\" + gameName);

            Debug.WriteLine("Game Folder is: " + Environment.CurrentDirectory + "\\" + gameName);
            string output = "";

            Debug.WriteLine("FILES IN GAME FOLDER: ");
            foreach (string file in files)
            {
                Debug.WriteLine(file);
                string extension = Path.GetExtension(file);
                if (extension == ".apk")
                {
                    apkNumber++;
                    await Task.Run(() => Sideload(file));

                    output += allText;
                }
            }

            Debug.WriteLine(wrDelimiter);

            ChangeTitle("Rookie's Sideloader | Installing game obb " + gameName);

            string[] folders = Directory.GetDirectories(Environment.CurrentDirectory + "\\" + gameName);

            foreach (string folder in folders)
            {
                string[] obbs = Directory.GetFiles(folder);

                bool isObb = false;
                foreach (string currObb in obbs)
                {
                    string extension = Path.GetExtension(currObb);

                    if (extension == ".obb")
                    {
                        isObb = true;
                    }
                }

                if (isObb == true)
                {
                    obbNumber++;
                    await Task.Run(() => obbcopy(folder));
                }
            }

            if (Properties.Settings.Default.deleteAllAfterInstall)
            {
                ChangeTitle("Rookie's Sideloader | Deleting game files");
                Directory.Delete(Environment.CurrentDirectory + "\\" + gameName, true);
            }
            ChangeTitlebarToDevice();
            //notify("Game downloaded and installed " + apkNumber + " apks and " + obbNumber + " obb folders");
            notify($"Apk installation output: {output}\n");
            //Environment.CurrentDirectory + "\\" + gameName
        }
Пример #4
0
        private void userjsonButton_Click(object sender, EventArgs e)
        {
            UsernameForm form = new UsernameForm();

            form.Show();
        }