This commit is contained in:
JFronny 2020-06-21 16:46:34 +02:00
parent 0f48d64121
commit b3bf4f7026
11 changed files with 58 additions and 25 deletions

View File

@ -43,7 +43,8 @@ namespace Installer
progress.Visible = true;
WebClient client = new WebClient();
Step(1, "Downloading metadata");
XElement meta = XDocument.Load("https://gitlab.com/JFronny/UpTool2/-/jobs/artifacts/master/raw/meta.xml?job=uptool")
XElement meta = XDocument
.Load("https://gitlab.com/JFronny/UpTool2/-/jobs/artifacts/master/raw/meta.xml?job=uptool")
.Element("meta");
Step(2, "Downloading binary");
byte[] dl = client.DownloadData(meta.Element("File").Value);
@ -136,4 +137,4 @@ Online: {meta.Element("Hash").Value.ToUpper()}");
updateAppsBox.Checked = false;
}
}
}
}

View File

@ -12,7 +12,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-rc0002" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-rc0003" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20253.1" />
</ItemGroup>

View File

@ -79,4 +79,4 @@ Online: {UpdateCheck.AppHash}");
RepoManagement.FetchRepos();
}
}
}
}

View File

@ -15,7 +15,7 @@
<ApplicationIcon>..\UpTool2.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CC-Functions.Misc" Version="1.1.7468.32091" />
<PackageReference Include="CC-Functions.Misc" Version="1.1.7474.36199" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20253.1" />
</ItemGroup>
</Project>

View File

@ -132,6 +132,12 @@ namespace UpTool2
BackgroundImage = (Bitmap) app.Icon,
BackgroundImageLayout = ImageLayout.Stretch
};
sidebarIcon.Paint += (sender, args) =>
{
args.Graphics.Clear(sidebarIcon.BackColor);
args.Graphics.DrawImage(sidebarIcon.BackgroundImage, args.ClipRectangle,
new Rectangle(new Point(0, 0), sidebarIcon.BackgroundImage.Size), GraphicsUnit.Pixel);
};
bool updateable = !app.Local && (app.Status & Status.Updatable) == Status.Updatable;
sidebarIcon.Click += (sender, e) =>
{
@ -193,9 +199,13 @@ namespace UpTool2
private void ClearSelection()
{
action_install.Enabled = false;
action_install.ResetBackColor();
action_remove.Enabled = false;
action_remove.ResetBackColor();
action_update.Enabled = false;
action_update.ResetBackColor();
action_run.Enabled = false;
action_run.ResetBackColor();
infoPanel_Title.Text = "";
infoPanel_Description.Text = "";
}
@ -294,21 +304,23 @@ Build Date: {buildTime:dd.MM.yyyy}", "UpTool2");
private void changesButton_Click(object sender, EventArgs e)
{
TaskPreview.Show(ref _tasks);
progressBar1.Maximum = _tasks.Count;
progressBar1.Value = 0;
foreach (IAppTask task in _tasks)
if (TaskPreview.Show(ref _tasks, true))
{
task.Run();
progressBar1.PerformStep();
progressBar1.Maximum = _tasks.Count;
progressBar1.Value = 0;
foreach (IAppTask task in _tasks)
{
task.Run();
progressBar1.PerformStep();
}
_tasks.Clear();
UpdateChangesLabel();
}
_tasks.Clear();
UpdateChangesLabel();
}
private void changesLabel_Click(object sender, EventArgs e)
{
TaskPreview.Show(ref _tasks);
TaskPreview.Show(ref _tasks, false);
UpdateChangesLabel();
}

View File

@ -3,8 +3,10 @@ using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
using UpTool2.Tool;
@ -21,13 +23,17 @@ namespace UpTool2
public static bool Online;
[STAThread]
private static void Main()
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
BuildSplash();
Splash.Show();
//new Thread(() => { Splash.ShowDialog(); }).Start();
//Splash.Show();
//This is here because I had issues with this piece of code under wine in the past
if (args.Any(s => s.TrimStart('-', '/').ToLower() == "wine"))
Splash.Show();
else
new Thread(() => { Splash.ShowDialog(); }).Start();
try
{
MutexLock.Lock();
@ -167,8 +173,9 @@ namespace UpTool2
public static void SetSplash(int progress, string status) => Splash.Invoke(new Action(() =>
{
Console.WriteLine($"{progress} - {status}");
Debug.WriteLine($"{progress} - {status}");
_splashProgress = progress;
Console.WriteLine(status);
_splashMessage = status;
Splash.Invoke((Action) Splash.Invalidate);
}));
@ -192,7 +199,10 @@ namespace UpTool2
{
SetSplash(3, "Comparing online version");
if (Assembly.GetExecutingAssembly().GetName().Version >= UpToolLib.UpdateCheck.OnlineVersion)
{
SetSplash(7, "Opening");
return true;
}
byte[] dl;
SetSplash(4, "Downloading latest");
using (DownloadDialog dlg = new DownloadDialog(UpToolLib.UpdateCheck.Installer.AbsoluteUri))
@ -227,7 +237,8 @@ namespace UpTool2
WindowStyle = ProcessWindowStyle.Hidden,
WorkingDirectory = PathTool.GetRelative("Install")
});
SetSplash(7, "Installing");
return false;
}
}
}
}

View File

@ -8,16 +8,25 @@ namespace UpTool2
{
internal static class TaskPreview
{
public static void Show(ref List<IAppTask> tasks)
public static bool Show(ref List<IAppTask> tasks, bool showOk)
{
using Form tmp = new Form {Size = new Size(600, 300)};
bool ok = false;
using Form tmp = new Form {Size = new Size(600, 300), MinimumSize = new Size(300, showOk ? 138 : 133)};
using CheckedListBox list = new CheckedListBox {Dock = DockStyle.Fill};
using Button okButton = new Button {Dock = DockStyle.Bottom, Text = "OK"};
list.Items.AddRange(tasks.ToArray());
for (int i = 0; i < tasks.Count; i++)
list.SetItemChecked(i, true);
tmp.Controls.Add(list);
okButton.Click += (sender, args) =>
{
ok = true;
tmp.Close();
};
if (showOk) tmp.Controls.Add(okButton);
tmp.ShowDialog();
tasks = list.Items.OfType<IAppTask>().Where((s, i) => list.GetItemChecked(i)).ToList();
return !showOk || ok;
}
}
}

View File

@ -20,7 +20,7 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CC-Functions.Misc" Version="1.1.7468.32091" />
<PackageReference Include="CC-Functions.Misc" Version="1.1.7474.36199" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\UpToolLib\UpToolLib.csproj" />

View File

@ -13,7 +13,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-rc0002" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-rc0003" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20253.1" />
</ItemGroup>

View File

@ -48,4 +48,4 @@ namespace UpToolLib.Tool
x.Save(PathTool.InfoXml);
}
}
}
}

View File

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CC-Functions.Misc" Version="1.1.7468.32091" />
<PackageReference Include="CC-Functions.Misc" Version="1.1.7474.36199" />
</ItemGroup>
</Project>