Skip to content

Commit 949b51a

Browse files
committed
Small, non critical, changes to the WinGetSource and SourceModel classes
1 parent 0bc612b commit 949b51a

3 files changed

Lines changed: 34 additions & 39 deletions

File tree

src/WGet.NET/Data/WinGetSource.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// https://github.com/basicx-StrgV/ //
44
//--------------------------------------------------//
55
using System;
6-
using WGetNET.Models;
7-
using WGetNET.Helper;
86
using System.Collections.Generic;
7+
using WGetNET.Helper;
8+
using WGetNET.Models;
99

1010
namespace WGetNET
1111
{
@@ -143,15 +143,23 @@ public bool IsEmpty
143143
/// <param name="identifier">The identifier of the package</param>
144144
/// <param name="explicitSource">Indicates if the source was explicitly added.</param>
145145
/// <param name="trustLevel">Trust level of the source.</param>
146-
internal WinGetSource(string name, string arg, Uri? uri, string type, string identifier, bool explicitSource = false, List<string>? trustLevel = default, string? data = null)
146+
internal WinGetSource(string name, string arg, Uri? uri, string type, string identifier, bool explicitSource = false, List<string>? trustLevel = null, string? data = null)
147147
{
148148
_name = name;
149149
_arg = arg;
150150
_uri = uri;
151151
_type = type;
152152
_identifier = identifier;
153153
_explicit = explicitSource;
154-
_trustLevel = trustLevel;
154+
155+
if (trustLevel != null)
156+
{
157+
_trustLevel = trustLevel;
158+
}
159+
else
160+
{
161+
_trustLevel = new List<string>();
162+
}
155163

156164
if (data != null)
157165
{
@@ -218,7 +226,7 @@ public static WinGetSource Create(string name, string identifier, string arg, st
218226

219227
Uri.TryCreate(arg, UriKind.Absolute, out Uri? uri);
220228

221-
return new WinGetSource(name, arg, uri, type, identifier,data: data);
229+
return new WinGetSource(name, arg, uri, type, identifier, data: data);
222230
}
223231

224232
/// <summary>
@@ -232,7 +240,7 @@ internal static WinGetSource FromSourceModel(SourceModel model)
232240
{
233241
Uri.TryCreate(model.Arg, UriKind.Absolute, out Uri? uri);
234242

235-
return new WinGetSource(model.Name, model.Arg, uri, model.Type, model.Identifier,model.Explicit, model.TrustLevel, model.Data);
243+
return new WinGetSource(model.Name, model.Arg, uri, model.Type, model.Identifier, model.Explicit, model.TrustLevel, model.Data);
236244
}
237245

238246
/// <inheritdoc/>

src/WGet.NET/Models/SourceModel.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,7 @@ public string Identifier
124124
/// <summary>
125125
/// Gets or sets whether the source was explicitly added.
126126
/// </summary>
127-
public bool Explicit
128-
{
129-
get
130-
{
131-
return _explicit;
132-
}
133-
set
134-
{
135-
_explicit = value;
136-
}
137-
}
127+
public bool Explicit { get; set; }
138128

139129
/// <summary>
140130
/// Gets or sets the trust level of the source.
@@ -163,7 +153,6 @@ public List<string> TrustLevel
163153
private string _type = string.Empty;
164154
private string _data = string.Empty;
165155
private string _identifier = string.Empty;
166-
private bool _explicit;
167156
private List<string> _trustLevel = new List<string>();
168157

169158
/// <summary>

src/WGet.NET/XmlDocumentation/WGet.NET.xml

Lines changed: 19 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)