added Custom Download Directories
This commit is contained in:
@@ -194,6 +194,9 @@
|
||||
<setting name="TrailersOn" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="downloadDir" serializeAs="String">
|
||||
<value>Enviroment.CurrentDirectory</value>
|
||||
</setting>
|
||||
</AndroidSideloader.Properties.Settings>
|
||||
<AndroidADB.Sideloader.Properties.Settings>
|
||||
<setting name="checkForUpdates" serializeAs="String">
|
||||
|
||||
55
MainForm.cs
55
MainForm.cs
@@ -2378,7 +2378,7 @@ Things you can try:
|
||||
gameName = gamesQueueList.ToArray()[0];
|
||||
string packagename = Sideloader.gameNameToPackageName(gameName);
|
||||
string dir = Path.GetDirectoryName(gameName);
|
||||
string gameDirectory = Environment.CurrentDirectory + "\\" + gameName;
|
||||
string gameDirectory = Properties.Settings.Default.downloadDir + "\\" + gameName;
|
||||
string path = gameDirectory;
|
||||
|
||||
string gameNameHash = string.Empty;
|
||||
@@ -2414,9 +2414,9 @@ Things you can try:
|
||||
if (doDownload)
|
||||
{
|
||||
// only delete after extraction; allows for resume if the fetch fails midway.
|
||||
if (Directory.Exists($"{Environment.CurrentDirectory}\\{gameName}"))
|
||||
if (Directory.Exists($"{Properties.Settings.Default.downloadDir}\\{gameName}"))
|
||||
{
|
||||
Directory.Delete($"{Environment.CurrentDirectory}\\{gameName}", true);
|
||||
Directory.Delete($"{Properties.Settings.Default.downloadDir}\\{gameName}", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2427,7 +2427,7 @@ Things you can try:
|
||||
t1 = new Thread(() =>
|
||||
{
|
||||
string rclonecommand =
|
||||
$"copy \":http:/{gameNameHash}/\" \"{Environment.CurrentDirectory}\\{gameNameHash}\" --progress --rc";
|
||||
$"copy \":http:/{gameNameHash}/\" \"{Properties.Settings.Default.downloadDir}\\{gameNameHash}\" --progress --rc";
|
||||
gameDownloadOutput = RCLONE.runRcloneCommand_PublicConfig(rclonecommand, Properties.Settings.Default.BandwidthLimit);
|
||||
});
|
||||
}
|
||||
@@ -2442,7 +2442,7 @@ Things you can try:
|
||||
_ = Logger.Log($"rclone copy \"{currentRemote}:{SideloaderRCLONE.RcloneGamesFolder}/{gameName}\"");
|
||||
t1 = new Thread(() =>
|
||||
{
|
||||
gameDownloadOutput = RCLONE.runRcloneCommand_DownloadConfig($"copy \"{currentRemote}:{SideloaderRCLONE.RcloneGamesFolder}/{gameName}\" \"{Environment.CurrentDirectory}\\{gameName}\" --progress --rc", Properties.Settings.Default.BandwidthLimit);
|
||||
gameDownloadOutput = RCLONE.runRcloneCommand_DownloadConfig($"copy \"{currentRemote}:{SideloaderRCLONE.RcloneGamesFolder}/{gameName}\" \"{Properties.Settings.Default.downloadDir}\\{gameName}\" --progress --rc", Properties.Settings.Default.BandwidthLimit);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2516,19 +2516,19 @@ Things you can try:
|
||||
{
|
||||
if (hasPublicConfig)
|
||||
{
|
||||
if (Directory.Exists($"{Environment.CurrentDirectory}\\{gameNameHash}"))
|
||||
if (Directory.Exists($"{Properties.Settings.Default.downloadDir}\\{gameNameHash}"))
|
||||
{
|
||||
Directory.Delete($"{Environment.CurrentDirectory}\\{gameNameHash}", true);
|
||||
Directory.Delete($"{Properties.Settings.Default.downloadDir}\\{gameNameHash}", true);
|
||||
}
|
||||
|
||||
if (Directory.Exists($"{Environment.CurrentDirectory}\\{gameName}"))
|
||||
if (Directory.Exists($"{Properties.Settings.Default.downloadDir}\\{gameName}"))
|
||||
{
|
||||
Directory.Delete($"{Environment.CurrentDirectory}\\{gameName}", true);
|
||||
Directory.Delete($"{Properties.Settings.Default.downloadDir}\\{gameName}", true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.Delete(Environment.CurrentDirectory + "\\" + gameName, true);
|
||||
Directory.Delete(Properties.Settings.Default.downloadDir + "\\" + gameName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -2576,10 +2576,10 @@ Things you can try:
|
||||
try
|
||||
{
|
||||
ChangeTitle("Extracting " + gameName, false);
|
||||
Zip.ExtractFile($"{Environment.CurrentDirectory}\\{gameNameHash}\\{gameNameHash}.7z.001", $"{Environment.CurrentDirectory}", PublicConfigFile.Password);
|
||||
if (Directory.Exists($"{Environment.CurrentDirectory}\\{gameNameHash}"))
|
||||
Zip.ExtractFile($"{Properties.Settings.Default.downloadDir}\\{gameNameHash}\\{gameNameHash}.7z.001", $"{Properties.Settings.Default.downloadDir}", PublicConfigFile.Password);
|
||||
if (Directory.Exists($"{Properties.Settings.Default.downloadDir}\\{gameNameHash}"))
|
||||
{
|
||||
Directory.Delete($"{Environment.CurrentDirectory}\\{gameNameHash}", true);
|
||||
Directory.Delete($"{Properties.Settings.Default.downloadDir}\\{gameNameHash}", true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -2600,19 +2600,19 @@ Things you can try:
|
||||
ChangeTitle("Installing game apk " + gameName, false);
|
||||
etaLabel.Text = "ETA: Wait for install...";
|
||||
speedLabel.Text = "DLS: Finished";
|
||||
if (File.Exists(Environment.CurrentDirectory + "\\" + gameName + "\\install.txt"))
|
||||
if (File.Exists(Properties.Settings.Default.downloadDir + "\\" + gameName + "\\install.txt"))
|
||||
{
|
||||
isinstalltxt = true;
|
||||
}
|
||||
|
||||
if (File.Exists(Environment.CurrentDirectory + "\\" + gameName + "\\Install.txt"))
|
||||
if (File.Exists(Properties.Settings.Default.downloadDir + "\\" + gameName + "\\Install.txt"))
|
||||
{
|
||||
isinstalltxt = true;
|
||||
}
|
||||
|
||||
string[] files = Directory.GetFiles(Environment.CurrentDirectory + "\\" + gameName);
|
||||
string[] files = Directory.GetFiles(Properties.Settings.Default.downloadDir + "\\" + gameName);
|
||||
|
||||
Debug.WriteLine("Game Folder is: " + Environment.CurrentDirectory + "\\" + gameName);
|
||||
Debug.WriteLine("Game Folder is: " + Properties.Settings.Default.downloadDir + "\\" + gameName);
|
||||
Debug.WriteLine("FILES IN GAME FOLDER: ");
|
||||
foreach (string file in files)
|
||||
{
|
||||
@@ -2667,13 +2667,13 @@ Things you can try:
|
||||
}
|
||||
|
||||
Debug.WriteLine(wrDelimiter);
|
||||
if (Directory.Exists($"{Properties.Settings.Default.MainDir}\\{gameName}\\{packagename}"))
|
||||
if (Directory.Exists($"{Properties.Settings.Default.downloadDir}\\{gameName}\\{packagename}"))
|
||||
{
|
||||
Thread obbThread = new Thread(() =>
|
||||
{
|
||||
|
||||
ChangeTitle($"Copying {packagename} obb to device...");
|
||||
output += ADB.RunAdbCommandToString($"push \"{Properties.Settings.Default.MainDir}\\{gameName}\\{packagename}\" \"/sdcard/Android/obb\"");
|
||||
output += ADB.RunAdbCommandToString($"push \"{Properties.Settings.Default.downloadDir}\\{gameName}\\{packagename}\" \"/sdcard/Android/obb\"");
|
||||
Program.form.ChangeTitle("");
|
||||
})
|
||||
{
|
||||
@@ -2701,7 +2701,7 @@ Things you can try:
|
||||
if (Properties.Settings.Default.deleteAllAfterInstall)
|
||||
{
|
||||
ChangeTitle("Deleting game files", false);
|
||||
try { Directory.Delete(Environment.CurrentDirectory + "\\" + gameName, true); } catch (Exception ex) { _ = FlexibleMessageBox.Show(Program.form, $"Error deleting game files: {ex.Message}"); }
|
||||
try { Directory.Delete(Properties.Settings.Default.downloadDir + "\\" + gameName, true); } catch (Exception ex) { _ = FlexibleMessageBox.Show($"Error deleting game files: {ex.Message}"); }
|
||||
}
|
||||
|
||||
//Remove current game
|
||||
@@ -2739,7 +2739,7 @@ Things you can try:
|
||||
|
||||
private async Task<bool> compareOBBSizes(string packagename, string gameName, ProcessOutput output)
|
||||
{
|
||||
if (!Directory.Exists($"{Properties.Settings.Default.MainDir}\\{gameName}\\{packagename}"))
|
||||
if (!Directory.Exists($"{Properties.Settings.Default.downloadDir}\\{gameName}\\{packagename}"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -2747,7 +2747,7 @@ Things you can try:
|
||||
{
|
||||
ChangeTitle("Comparing obbs...");
|
||||
ADB.WakeDevice();
|
||||
DirectoryInfo localFolder = new DirectoryInfo($"{Properties.Settings.Default.MainDir}/{gameName}/{packagename}/");
|
||||
DirectoryInfo localFolder = new DirectoryInfo($"{Properties.Settings.Default.downloadDir}/{gameName}/{packagename}/");
|
||||
long totalLocalFolderSize = localFolderSize(localFolder) / (1024 * 1024);
|
||||
string totalRemoteFolderSize = ADB.RunAdbCommandToString($"shell du -m /sdcard/Android/obb/{packagename}").Output;
|
||||
string firstreplacedtotalRemoteFolderSize = Regex.Replace(totalRemoteFolderSize, "[^c]*$", "");
|
||||
@@ -2762,12 +2762,12 @@ Things you can try:
|
||||
if (om == DialogResult.Yes)
|
||||
{
|
||||
ChangeTitle("Retrying push");
|
||||
if (Directory.Exists($"{Properties.Settings.Default.MainDir}\\{gameName}\\{packagename}"))
|
||||
if (Directory.Exists($"{Properties.Settings.Default.downloadDir}\\{gameName}\\{packagename}"))
|
||||
{
|
||||
Thread obbThread = new Thread(() =>
|
||||
{
|
||||
ChangeTitle($"Copying {packagename} obb to device...");
|
||||
output += ADB.RunAdbCommandToString($"push \"{Properties.Settings.Default.MainDir}\\{gameName}\\{packagename}\" \"/sdcard/Android/obb\"");
|
||||
output += ADB.RunAdbCommandToString($"push \"{Properties.Settings.Default.downloadDir}\\{gameName}\\{packagename}\" \"/sdcard/Android/obb\"");
|
||||
Program.form.ChangeTitle("");
|
||||
})
|
||||
{
|
||||
@@ -3376,9 +3376,10 @@ Things you can try:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!enviromentCreated) {
|
||||
await CreateEnviroment();
|
||||
enviromentCreated = true;
|
||||
if (!enviromentCreated)
|
||||
{
|
||||
await CreateEnviroment();
|
||||
enviromentCreated = true;
|
||||
}
|
||||
webView21.Show();
|
||||
string query = CurrentGameName + " VR trailer";
|
||||
|
||||
710
Properties/Settings.Designer.cs
generated
710
Properties/Settings.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -185,5 +185,8 @@
|
||||
<Setting Name="TrailersOn" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="downloadDir" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Enviroment.CurrentDirectory</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
30
SettingsForm.Designer.cs
generated
30
SettingsForm.Designer.cs
generated
@@ -47,6 +47,8 @@ namespace AndroidSideloader
|
||||
this.btnOpenDebug = new AndroidSideloader.RoundButton();
|
||||
this.lblMibs = new System.Windows.Forms.Label();
|
||||
this.trailersOn = new System.Windows.Forms.CheckBox();
|
||||
this.setDownloadDirectory = new AndroidSideloader.RoundButton();
|
||||
this.downloadDirectorySetter = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkForUpdatesCheckBox
|
||||
@@ -330,6 +332,31 @@ namespace AndroidSideloader
|
||||
this.trailersOn.UseVisualStyleBackColor = false;
|
||||
this.trailersOn.CheckedChanged += new System.EventHandler(this.trailersOn_CheckedChanged);
|
||||
//
|
||||
// setDownloadDirectory
|
||||
//
|
||||
this.setDownloadDirectory.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
this.setDownloadDirectory.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
|
||||
this.setDownloadDirectory.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25)))));
|
||||
this.setDownloadDirectory.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.setDownloadDirectory.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F);
|
||||
this.setDownloadDirectory.ForeColor = System.Drawing.Color.White;
|
||||
this.setDownloadDirectory.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25)))));
|
||||
this.setDownloadDirectory.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25)))));
|
||||
this.setDownloadDirectory.Location = new System.Drawing.Point(29, 482);
|
||||
this.setDownloadDirectory.Name = "setDownloadDirectory";
|
||||
this.setDownloadDirectory.Radius = 5;
|
||||
this.setDownloadDirectory.Size = new System.Drawing.Size(285, 31);
|
||||
this.setDownloadDirectory.Stroke = true;
|
||||
this.setDownloadDirectory.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74)))));
|
||||
this.setDownloadDirectory.TabIndex = 23;
|
||||
this.setDownloadDirectory.Text = "Set Download Directory";
|
||||
this.setDownloadDirectory.Transparency = false;
|
||||
this.setDownloadDirectory.Click += new System.EventHandler(this.setDownloadDirectory_Click);
|
||||
//
|
||||
// downloadDirectorySetter
|
||||
//
|
||||
this.downloadDirectorySetter.RootFolder = System.Environment.SpecialFolder.MyComputer;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -338,6 +365,7 @@ namespace AndroidSideloader
|
||||
this.BackgroundImage = global::AndroidSideloader.Properties.Resources.pattern_cubes_1_1_1_0_0_0_1__000000_212121;
|
||||
this.ClientSize = new System.Drawing.Size(342, 524);
|
||||
this.Controls.Add(this.trailersOn);
|
||||
this.Controls.Add(this.setDownloadDirectory);
|
||||
this.Controls.Add(this.lblMibs);
|
||||
this.Controls.Add(this.btnOpenDebug);
|
||||
this.Controls.Add(this.btnResetDebug);
|
||||
@@ -391,5 +419,7 @@ namespace AndroidSideloader
|
||||
private RoundButton btnOpenDebug;
|
||||
private System.Windows.Forms.Label lblMibs;
|
||||
private System.Windows.Forms.CheckBox trailersOn;
|
||||
private RoundButton setDownloadDirectory;
|
||||
private System.Windows.Forms.FolderBrowserDialog downloadDirectorySetter;
|
||||
}
|
||||
}
|
||||
@@ -197,6 +197,15 @@ namespace AndroidSideloader
|
||||
_ = Process.Start($"{Environment.CurrentDirectory}\\debuglog.txt");
|
||||
}
|
||||
}
|
||||
|
||||
private void setDownloadDirectory_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (downloadDirectorySetter.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Properties.Settings.Default.downloadDir = downloadDirectorySetter.SelectedPath;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="downloadDirectorySetter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user