Fix bug where Basic was used before being set

- Set Basic before FixXml (was accesed before being set)
- Move Basic to Program.cs
This commit is contained in:
JFronny 2020-08-31 20:40:58 +02:00
parent 0eccafa9ea
commit 14b2643cbf
2 changed files with 4 additions and 5 deletions

View File

@ -1,7 +1,5 @@
using System;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Linq;
using UpToolLib;
using UpToolLib.Tool;
@ -10,17 +8,18 @@ namespace UpToolCLI
public static class Program
{
public static readonly UtLibFunctions Functions = new UtLibFunctions();
public static bool Basic;
public static int Main(string[] args)
{
MutexLock.Lock();
try
{
Basic = args.Length > 0 && args[0].ToLower() == "--basic";
ExternalFunctionalityManager.Init(Functions);
XmlTool.FixXml();
RootCommand rootCommand = new RootCommand();
rootCommand.AddGlobalOption(new Option<bool>("--basic"));
UtLibFunctions.Basic = args.Length > 0 && args[0] == "--basic";
rootCommand.AddGlobalOption(new Option<bool>("--basic", "Use only basic console functionality. Must be the first parameter in the call"));
PackageManagement.RegisterCommands(rootCommand);
CacheManagement.RegisterCommands(rootCommand);

View File

@ -5,12 +5,12 @@ using System.Threading;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using UpToolLib.DataStructures;
using static UpToolCLI.Program;
namespace UpToolCLI
{
public class UtLibFunctions : IExternalFunctionality
{
public static bool Basic;
public Tuple<bool, byte[]> Download(Uri link)
{
using WebClient client = new WebClient();