33// https://github.com/basicx-StrgV/ //
44//--------------------------------------------------//
55using System ;
6- using WGetNET . Models ;
6+ using System . Collections . Generic ;
77using WGetNET . Helper ;
8+ using WGetNET . Models ;
89
910namespace WGetNET
1011{
@@ -82,6 +83,29 @@ public string Identifier
8283 }
8384 }
8485
86+ /// <summary>
87+ /// Gets whether the source was explicitly added.
88+ /// </summary>
89+ public bool Explicit
90+ {
91+ get
92+ {
93+ return _explicit ;
94+ }
95+ }
96+
97+ /// <summary>
98+ /// Gets the trust level of the source.
99+ /// </summary>
100+ public List < string > TrustLevel
101+ {
102+ get
103+ {
104+ return _trustLevel ;
105+ }
106+ }
107+
108+
85109 /// <inheritdoc/>
86110 public bool IsEmpty
87111 {
@@ -105,6 +129,8 @@ public bool IsEmpty
105129 private readonly string _type ;
106130 private readonly string _data ;
107131 private readonly string _identifier ;
132+ private readonly bool _explicit ;
133+ private readonly List < string > _trustLevel ;
108134
109135 /// <summary>
110136 /// Initializes a new instance of the <see cref="WGetNET.WinGetSource"/> class.
@@ -115,13 +141,25 @@ public bool IsEmpty
115141 /// <param name="type">Type identifier of the source.</param>
116142 /// <param name="data">Data of the source source. This field is only used by some sources.</param>
117143 /// <param name="identifier">The identifier of the package</param>
118- internal WinGetSource ( string name , string arg , Uri ? uri , string type , string identifier , string ? data = null )
144+ /// <param name="explicitSource">Indicates if the source was explicitly added.</param>
145+ /// <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 = null , string ? data = null )
119147 {
120148 _name = name ;
121149 _arg = arg ;
122150 _uri = uri ;
123151 _type = type ;
124152 _identifier = identifier ;
153+ _explicit = explicitSource ;
154+
155+ if ( trustLevel != null )
156+ {
157+ _trustLevel = trustLevel ;
158+ }
159+ else
160+ {
161+ _trustLevel = new List < string > ( ) ;
162+ }
125163
126164 if ( data != null )
127165 {
@@ -188,7 +226,7 @@ public static WinGetSource Create(string name, string identifier, string arg, st
188226
189227 Uri . TryCreate ( arg , UriKind . Absolute , out Uri ? uri ) ;
190228
191- return new WinGetSource ( name , arg , uri , type , identifier , data ) ;
229+ return new WinGetSource ( name , arg , uri , type , identifier , data : data ) ;
192230 }
193231
194232 /// <summary>
@@ -202,7 +240,7 @@ internal static WinGetSource FromSourceModel(SourceModel model)
202240 {
203241 Uri . TryCreate ( model . Arg , UriKind . Absolute , out Uri ? uri ) ;
204242
205- return new WinGetSource ( model . Name , model . Arg , uri , model . Type , model . Identifier , model . Data ) ;
243+ return new WinGetSource ( model . Name , model . Arg , uri , model . Type , model . Identifier , model . Explicit , model . TrustLevel , model . Data ) ;
206244 }
207245
208246 /// <inheritdoc/>
@@ -214,6 +252,8 @@ public object Clone()
214252 _uri ,
215253 _type ,
216254 _identifier ,
255+ _explicit ,
256+ _trustLevel ,
217257 _data
218258 ) ;
219259 }
0 commit comments