Skip to content

Commit

Permalink
Use latest project dependencies (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
vedantmgoyal9 authored Feb 20, 2024
1 parent e741605 commit fcc5e64
Show file tree
Hide file tree
Showing 23 changed files with 643 additions and 611 deletions.
3 changes: 2 additions & 1 deletion src/WingetCreateCLI/Commands/UpdateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,8 @@ private async Task UpdateSingleInstallerInteractively(Installer installer)

while (true)
{
string url = Prompt.Input<string>(Resources.NewInstallerUrl_Message, null, new[] { FieldValidation.ValidateProperty(newInstaller, nameof(Installer.InstallerUrl)) }).Trim();
string url = Prompt.Input<string>(Resources.NewInstallerUrl_Message, null, null, new[] { FieldValidation.ValidateProperty(newInstaller, nameof(Installer.InstallerUrl)) });

string packageFile = await DownloadPackageFile(url);

if (string.IsNullOrEmpty(packageFile))
Expand Down
18 changes: 10 additions & 8 deletions src/WingetCreateCLI/Logger/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,26 @@ public static class Logger
public static void Initialize()
{
// Add rules to file log configuration
var loggerFileConfig = new LoggingConfiguration();
loggerFileConfig.AddRule(LogLevel.Trace, LogLevel.Fatal, FileTarget);
var loggerFileFactory = new LogFactory().Setup().LoadConfiguration(builder =>
{
builder.Configuration.AddRule(LogLevel.Trace, LogLevel.Fatal, FileTarget, "File");
});

// Apply file log config
var loggerFileFactory = new LogFactory(loggerFileConfig);
// Get logger for file
loggerFile = loggerFileFactory.GetLogger("File");

// Add rules to console log configuration
var loggerConsoleConfig = new LoggingConfiguration();
loggerConsoleConfig.AddRule(LogLevel.Debug, LogLevel.Fatal, ConsoleTarget);
var loggerConsoleFactory = new LogFactory().Setup().LoadConfiguration(builder =>
{
builder.Configuration.AddRule(LogLevel.Debug, LogLevel.Fatal, ConsoleTarget, "Console");
});

// Set color for specific log level
SetColorForConsoleTarget(ConsoleTarget, LogLevel.Info, ConsoleOutputColor.Green);
SetColorForConsoleTarget(ConsoleTarget, LogLevel.Warn, ConsoleOutputColor.Yellow);
SetColorForConsoleTarget(ConsoleTarget, LogLevel.Error, ConsoleOutputColor.Red);

// Apply console log config
var loggerConsoleFactory = new LogFactory(loggerConsoleConfig);
// Get logger for console
loggerConsole = loggerConsoleFactory.GetLogger("Console");
}

Expand Down
138 changes: 84 additions & 54 deletions src/WingetCreateCLI/Models/SettingsModel.cs
Original file line number Diff line number Diff line change
@@ -1,116 +1,146 @@
//----------------------
// <auto-generated>
// Generated using the NJsonSchema v10.4.3.0 (Newtonsoft.Json v11.0.0.0) (http://NJsonSchema.org)
// Generated using the NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org)
// </auto-generated>
//----------------------


namespace Microsoft.WingetCreateCLI.Models.Settings
{
#pragma warning disable // Disable all warnings

/// <summary>Telemetry settings</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class Telemetry
/// <summary>
/// Telemetry settings
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class Telemetry
{
/// <summary>Controls whether telemetry events are written</summary>
/// <summary>
/// Controls whether telemetry events are written
/// </summary>
[Newtonsoft.Json.JsonProperty("disable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool Disable { get; set; } = false;


}

/// <summary>Controls the clean up interval of installer cache and logs</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class CleanUp

/// <summary>
/// Controls the clean up interval of installer cache and logs
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class CleanUp
{
/// <summary>Controls the interval in days for clean up of old files and folders</summary>
/// <summary>
/// Controls the interval in days for clean up of old files and folders
/// </summary>
[Newtonsoft.Json.JsonProperty("intervalInDays", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)]
public int IntervalInDays { get; set; } = 7;

/// <summary>Controls whether clean up is disabled</summary>

/// <summary>
/// Controls whether clean up is disabled
/// </summary>
[Newtonsoft.Json.JsonProperty("disable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool Disable { get; set; } = false;


}

/// <summary>Windows Package Manager Repository settings</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class WindowsPackageManagerRepository

/// <summary>
/// Windows Package Manager Repository settings
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class WindowsPackageManagerRepository
{
/// <summary>Specifies the name of the Windows Package Manager Repository owner</summary>
/// <summary>
/// Specifies the name of the Windows Package Manager Repository owner
/// </summary>
[Newtonsoft.Json.JsonProperty("owner", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Owner { get; set; } = "microsoft";

/// <summary>Specifies the name of the Windows Package Manager Repository</summary>

/// <summary>
/// Specifies the name of the Windows Package Manager Repository
/// </summary>
[Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Name { get; set; } = "winget-pkgs";


}

/// <summary>Output manifest settings</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class Manifest

/// <summary>
/// Output manifest settings
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class Manifest
{
/// <summary>Specifies the format of the manifest file</summary>
/// <summary>
/// Specifies the format of the manifest file
/// </summary>
[Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public ManifestFormat Format { get; set; } = Microsoft.WingetCreateCLI.Models.Settings.ManifestFormat.Yaml;


}

/// <summary>Visual settings</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class Visual

/// <summary>
/// Visual settings
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class Visual
{
/// <summary>Controls whether paths displayed on the console are substituted with environment variables</summary>
/// <summary>
/// Controls whether paths displayed on the console are substituted with environment variables
/// </summary>
[Newtonsoft.Json.JsonProperty("anonymizePaths", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool AnonymizePaths { get; set; } = true;


}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class SettingsManifest

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
public partial class SettingsManifest
{
/// <summary>The settings json schema</summary>
/// <summary>
/// The settings json schema
/// </summary>
[Newtonsoft.Json.JsonProperty("$schema", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Schema { get; set; } = "https://aka.ms/wingetcreate-settings.schema.0.1.json";

[Newtonsoft.Json.JsonProperty("Telemetry", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public Telemetry Telemetry { get; set; } = new Telemetry();

[Newtonsoft.Json.JsonProperty("CleanUp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public CleanUp CleanUp { get; set; } = new CleanUp();

[Newtonsoft.Json.JsonProperty("WindowsPackageManagerRepository", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public WindowsPackageManagerRepository WindowsPackageManagerRepository { get; set; } = new WindowsPackageManagerRepository();

[Newtonsoft.Json.JsonProperty("Manifest", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public Manifest Manifest { get; set; } = new Manifest();

[Newtonsoft.Json.JsonProperty("Visual", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public Visual Visual { get; set; } = new Visual();


}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")]

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")]
public enum ManifestFormat
{

[System.Runtime.Serialization.EnumMember(Value = @"yaml")]
Yaml = 0,



[System.Runtime.Serialization.EnumMember(Value = @"json")]
Json = 1,



}
}
10 changes: 4 additions & 6 deletions src/WingetCreateCLI/PromptHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ public static void PromptListOfClassType<T>(object model, string memberName)
{
var property = model.GetType().GetProperty(memberName);
List<T> objectList = (List<T>)property.GetValue(model);
if (objectList == null)
{
objectList = new List<T>();
}
objectList ??= new List<T>();

string name = objectList.GetType().GetGenericArguments().Single().Name;

Expand Down Expand Up @@ -298,7 +295,7 @@ public static void PromptValue<T>(string message, object model, string memberNam

if (instanceType == typeof(string))
{
string result = Prompt.Input<string>(message, property.GetValue(model), new[] { FieldValidation.ValidateProperty(model, memberName, instance) });
string result = Prompt.Input<string>(message, property.GetValue(model), null, new[] { FieldValidation.ValidateProperty(model, memberName, instance) });

if (!string.IsNullOrEmpty(result))
{
Expand All @@ -307,7 +304,8 @@ public static void PromptValue<T>(string message, object model, string memberNam
}
else if (instanceType == typeof(long))
{
long result = Prompt.Input<long>(message, property.GetValue(model), new[] { FieldValidation.ValidateProperty(model, memberName, instance) });
long result = Prompt.Input<long>(message, property.GetValue(model), null, new[] { FieldValidation.ValidateProperty(model, memberName, instance) });

property.SetValue(model, result);
}
else if (instanceType.IsEnum)
Expand Down
12 changes: 6 additions & 6 deletions src/WingetCreateCLI/WingetCreateCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="DesktopBridge.Helpers" Version="1.2.2" />
<PackageReference Include="NSwag.MSBuild" Version="13.11.1">
<PackageReference Include="NSwag.MSBuild" Version="14.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Sharprompt" Version="2.3.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.261">
<PackageReference Include="Sharprompt" Version="2.4.5" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="5.0.0" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions src/WingetCreateCore/Models/Partials/InstallerPartials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ namespace Microsoft.WingetCreateCore.Models.Installer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Microsoft.WingetCreateCore.Models.CustomValidation;
using Newtonsoft.Json;
using YamlDotNet.Serialization;

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/WingetCreateCore/Models/Partials/LocalePartials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace Microsoft.WingetCreateCore.Models.Locale
{
using Microsoft.WingetCreateCore.Models.DefaultLocale;
using Newtonsoft.Json;
using YamlDotNet.Serialization;

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/WingetCreateCore/Models/Partials/SingletonPartials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace Microsoft.WingetCreateCore.Models.Singleton
{
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Microsoft.WingetCreateCore.Models.CustomValidation;
using YamlDotNet.Serialization;

Expand Down
22 changes: 11 additions & 11 deletions src/WingetCreateCore/WingetCreateCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="jose-jwt" Version="3.1.1" />
<PackageReference Include="jose-jwt" Version="4.1.0" />
<PackageReference Include="Microsoft.CorrelationVector" Version="1.0.42" />
<PackageReference Include="Microsoft.Msix.Utils" Version="2.1.1" />
<!--https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#generatepathproperty-->
<PackageReference Include="Microsoft.WindowsPackageManager.Utils" Version="1.7.2" GeneratePathProperty="true" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.14" />
<PackageReference Include="NLog" Version="4.7.9" />
<PackageReference Include="NSwag.MSBuild" Version="13.11.1">
<PackageReference Include="Microsoft.WindowsPackageManager.Utils" Version="1.7.11" GeneratePathProperty="true" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.15" />
<PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="NSwag.MSBuild" Version="14.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Polly" Version="7.2.2" />
<PackageReference Include="RestSharp" Version="106.11.8-alpha.0.13" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.261">
<PackageReference Include="Polly" Version="8.3.0" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Octokit" Version="0.50.0" />
<PackageReference Include="Octokit" Version="9.1.2" />
<PackageReference Include="Vestris.ResourceLib" Version="2.1.0" />
<PackageReference Include="WiX" Version="3.11.2" />
<PackageReference Include="YamlDotNet" Version="13.2.0" />
<PackageReference Include="WiX" Version="3.14.0" />
<PackageReference Include="YamlDotNet" Version="15.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit fcc5e64

Please sign in to comment.