Browse Source

Updated to 5.4

hellzerg 4 năm trước cách đây
mục cha
commit
320bd2e55b
8 tập tin đã thay đổi với 666 bổ sung22661 xóa
  1. 5 0
      CHANGELOG.md
  2. 596 380
      Optimizer/MainForm.Designer.cs
  3. 50 3
      Optimizer/MainForm.cs
  4. 1 22275
      Optimizer/MainForm.resx
  5. 1 1
      Optimizer/Program.cs
  6. 11 0
      Optimizer/Utilities.cs
  7. 1 1
      README.md
  8. 1 1
      version.txt

+ 5 - 0
CHANGELOG.md

@@ -2,6 +2,11 @@
 
 All notable changes to this project will be documented in this file.
 
+## [5.4] - 2020-12-17
+- Added: Run & install apps after downloading option
+- Critical bug fixes regarding app downloader
+- Properly save MSI packages
+
 ## [5.3] - 2020-12-17
 - Added: Icons in Common Apps
 - Added: Additional apps for downloading

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 596 - 380
Optimizer/MainForm.Designer.cs


+ 50 - 3
Optimizer/MainForm.cs

@@ -2006,12 +2006,14 @@ namespace Optimizer
             c32.Enabled = true;
 
             linkLabel1.Visible = !string.IsNullOrEmpty(downloadLog);
+
+            txtDownloadStatus.Text = "Finished";
         }
 
         string appNameTemp = string.Empty;
         int maxCount = 0;
         int count = 0;
-
+        Process p;
         string downloadLog = string.Empty;
 
         private async void btnDownloadApps_Click(object sender, EventArgs e)
@@ -2029,6 +2031,7 @@ namespace Optimizer
 
             foreach (Control c in Utilities.GetSelfAndChildrenRecursive(appsTab))
             {
+                if (c.Name == "cAutoInstall") continue;
                 if (c is CheckBox && ((CheckBox)c).Checked) maxCount++;
             }
 
@@ -2069,9 +2072,33 @@ namespace Optimizer
                 }
             }
 
+            if (cAutoInstall.Checked)
+            {
+                count = 0;
+                foreach (string a in Directory.GetFiles(txtDownloadFolder.Text, "*.*", SearchOption.TopDirectoryOnly))
+                {
+                    using (p = new Process())
+                    {
+                        count++;
+                        p.StartInfo.FileName = a;
+                        p.EnableRaisingEvents = true;
+                        p.StartInfo.WorkingDirectory = txtDownloadFolder.Text;
+
+                        // APP-SPECIFIC HACKS //
+                        if (a.Contains("Sumatra")) p.StartInfo.Arguments = " -install";
+                        // *** //
+
+                        txtDownloadStatus.Text = string.Format("{0}/{1} - Installing {2} ...", count, maxCount, Path.GetFileNameWithoutExtension(a));
+
+                        await p.RunAsync();
+                    };
+                }
+            }
+
             RenderAppDownloaderFree();  
         }
 
+        string fileExtension = ".exe";
         private async Task DownloadApp(AppInfo app, bool pref64)
         {
             try
@@ -2086,11 +2113,29 @@ namespace Optimizer
 
                     if (pref64)
                     {
-                        await downloader.DownloadFileTaskAsync(app.Link64, Path.Combine(txtDownloadFolder.Text, app.Title + "-x64.exe"));
+                        if (app.Link64.ToString().Contains(".msi"))
+                        {
+                            fileExtension = ".msi";
+                        }
+                        else
+                        {
+                            fileExtension = ".exe";
+                        }
+
+                        await downloader.DownloadFileTaskAsync(app.Link64, Path.Combine(txtDownloadFolder.Text, app.Title + "-x64" + fileExtension));
                     }
                     else
                     {
-                        await downloader.DownloadFileTaskAsync(app.Link, Path.Combine(txtDownloadFolder.Text, app.Title + "-x86.exe"));
+                        if (app.Link.ToString().Contains(".msi"))
+                        {
+                            fileExtension = ".msi";
+                        }
+                        else
+                        {
+                            fileExtension = ".exe";
+                        }
+
+                        await downloader.DownloadFileTaskAsync(app.Link, Path.Combine(txtDownloadFolder.Text, app.Title + "-x86" + fileExtension));
                     }
                 }
             }
@@ -2100,6 +2145,8 @@ namespace Optimizer
 
                 if (pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x64.exe")); } catch { }
                 if (!pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x86.exe")); } catch { }
+                if (pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x64.msi")); } catch { }
+                if (!pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x86.msi")); } catch { }
             }
         }
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 22275
Optimizer/MainForm.resx


+ 1 - 1
Optimizer/Program.cs

@@ -13,7 +13,7 @@ namespace Optimizer
         // Enter current version here
 
         internal readonly static float Major = 5;
-        internal readonly static float Minor = 3;
+        internal readonly static float Minor = 4;
 
         internal static string GetCurrentVersionTostring()
         {

+ 11 - 0
Optimizer/Utilities.cs

@@ -10,6 +10,7 @@ using System.Diagnostics;
 using System.ServiceProcess;
 using System.Management.Automation;
 using System.Drawing;
+using System.Threading.Tasks;
 
 namespace Optimizer
 {
@@ -554,5 +555,15 @@ namespace Optimizer
                 Application.Restart();
             }
         }
+
+        internal static Task RunAsync(this Process process)
+        {
+            var tcs = new TaskCompletionSource<object>();
+            process.EnableRaisingEvents = true;
+            process.Exited += (s, e) => tcs.TrySetResult(null);
+
+            if (!process.Start()) tcs.SetException(new Exception("Failed to start process."));
+            return tcs.Task;
+        }
     }
 }

+ 1 - 1
README.md

@@ -44,5 +44,5 @@ https://github.com/hellzerg/optimizer/blob/master/CHANGELOG.md
 
 ## Details: ##
 
-* Latest version: 5.3
+* Latest version: 5.4
 * Released: December 17, 2020

+ 1 - 1
version.txt

@@ -1 +1 @@
-5.3
+5.4

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác