Remove #if (compile-time) conditions. This should make testing scenarios slightly more accurate. This does NOT mean that things like self-updating will suddenly work, just that it won't be ignored when compiling for debug

This commit is contained in:
JFronny 2020-09-10 20:16:19 +02:00
parent f38a0e054d
commit ef5947f54c
4 changed files with 10 additions and 25 deletions

View File

@ -10,11 +10,8 @@ using UpTool2.Task;
using UpToolLib;
using UpToolLib.DataStructures;
using UpToolLib.Tool;
#if DEBUG
using System.Threading;
using System.Diagnostics;
#endif
namespace UpTool2
{
@ -227,7 +224,6 @@ namespace UpTool2
private void UpdateSidebarV(object sender, EventArgs e)
{
#if DEBUG
if (searchBox.Text == "!DEBUG:PRINT!")
{
searchBox.Text = "!DEBUG:PRINT";
@ -246,20 +242,17 @@ namespace UpTool2
}
else
{
#endif
App[] apps = AppExtras.FindApps(searchBox.Text);
Enum.TryParse(filterBox.SelectedValue.ToString(), out Status status);
for (int i = 0; i < sidebarPanel.Controls.Count; i++)
{
Panel sidebarIcon = (Panel) sidebarPanel.Controls[i];
App app = (App) sidebarIcon.Tag;
sidebarIcon.Visible = apps.Contains(app) &&
((int) app.Status & (int) (Program.Online ? status : Status.Installed)) != 0;
App[] apps = AppExtras.FindApps(searchBox.Text);
Enum.TryParse(filterBox.SelectedValue.ToString(), out Status status);
for (int i = 0; i < sidebarPanel.Controls.Count; i++)
{
Panel sidebarIcon = (Panel) sidebarPanel.Controls[i];
App app = (App) sidebarIcon.Tag;
sidebarIcon.Visible = apps.Contains(app) &&
((int) app.Status & (int) (Program.Online ? status : Status.Installed)) != 0;
}
ClearSelection();
}
ClearSelection();
#if DEBUG
}
#endif
}
private void MainForm_Load(object sender, EventArgs e)

View File

@ -91,12 +91,10 @@ namespace UpToolCLI
? "All up-to-date"
: $@"Found {updatableCount} Updates:
{string.Join(Environment.NewLine, apps.Select(s => $"- {s.Name} ({s.Version})"))}");
#if !DEBUG
Version vLocal = Assembly.GetExecutingAssembly().GetName().Version;
Version vOnline = UpdateCheck.OnlineVersion;
if (vLocal < vOnline)
Console.WriteLine($"uptool is outdated ({vLocal} vs {vOnline}), update using \"uptool upgrade-self\"");
#endif
}
}
}

View File

@ -38,9 +38,6 @@ namespace UpToolCLI
public static void UpgradeSelf(bool force)
{
#if DEBUG
Console.WriteLine("Not enabled in debug builds");
#else
if (!force && Assembly.GetExecutingAssembly().GetName().Version >= UpdateCheck.OnlineVersion)
Console.WriteLine("Already up-to-date");
else
@ -77,7 +74,6 @@ Online: {UpdateCheck.InstallerHash}");
UseShellExecute = false
});
}
#endif
}
private static void Start(string identifier, string arguments, string file, bool waitForExit)

View File

@ -179,13 +179,11 @@ namespace UpToolCLI
Console.WriteLine($"Updating {app.Value.Name}");
AppExtras.Update(app.Value, false);
}
#if !DEBUG
if (Assembly.GetExecutingAssembly().GetName().Version < UpdateCheck.OnlineVersion)
{
Console.WriteLine("Updating self");
Other.UpgradeSelf(false);
}
#endif
Console.WriteLine("Done!");
}
}