@@ -25,15 +25,6 @@ public class DotNet : BaseNuGet
2525
2626 public DotNet ( )
2727 {
28- Dependencies = [
29- new ManagerDependency (
30- ".NET Tools Outdated" ,
31- Path . Join ( Environment . SystemDirectory , "windowspowershell\\ v1.0\\ powershell.exe" ) ,
32- "-ExecutionPolicy Bypass -NoLogo -NoProfile -Command \" & {dotnet tool install --global dotnet-tools-outdated --add-source https://api.nuget.org/v3/index.json; if ($error.count -ne 0){pause}}\" " ,
33- "dotnet tool install --global dotnet-tools-outdated --add-source https://api.nuget.org/v3/index.json" ,
34- async ( ) => ( await CoreTools . WhichAsync ( "dotnet-tools-outdated.exe" ) ) . Item1 )
35- ] ;
36-
3728 Capabilities = new ManagerCapabilities
3829 {
3930 CanRunAsAdmin = true ,
@@ -66,96 +57,7 @@ public DotNet()
6657 OperationHelper = new DotNetPkgOperationHelper ( this ) ;
6758 }
6859
69- protected override IReadOnlyList < Package > GetAvailableUpdates_UnSafe ( )
70- {
71- var ( found , path ) = CoreTools . Which ( "dotnet-tools-outdated.exe" ) ;
72- if ( ! found )
73- {
74- Process proc = new ( )
75- {
76- StartInfo = new ProcessStartInfo
77- {
78- FileName = Status . ExecutablePath ,
79- Arguments = Properties . ExecutableCallArgs + " install --global dotnet-tools-outdated" ,
80- UseShellExecute = false ,
81- RedirectStandardOutput = true ,
82- RedirectStandardError = true ,
83- CreateNoWindow = true ,
84- }
85- } ;
86-
87- IProcessTaskLogger aux_logger = TaskLogger . CreateNew ( LoggableTaskType . InstallManagerDependency , proc ) ;
88- proc . Start ( ) ;
89-
90- aux_logger . AddToStdOut ( proc . StandardOutput . ReadToEnd ( ) ) ;
91- aux_logger . AddToStdErr ( proc . StandardError . ReadToEnd ( ) ) ;
92- proc . WaitForExit ( ) ;
93- aux_logger . Close ( proc . ExitCode ) ;
94-
95- path = "dotnet-tools-outdated.exe" ;
96- }
97-
98- Process p = new ( )
99- {
100- StartInfo = new ProcessStartInfo
101- {
102- FileName = path ,
103- Arguments = "--format json --utf8" ,
104- RedirectStandardOutput = true ,
105- RedirectStandardError = true ,
106- UseShellExecute = false ,
107- CreateNoWindow = true ,
108- StandardOutputEncoding = System . Text . Encoding . UTF8
109- }
110- } ;
111-
112- p . StartInfo = CoreTools . UpdateEnvironmentVariables ( p . StartInfo ) ;
113- IProcessTaskLogger logger = TaskLogger . CreateNew ( LoggableTaskType . ListUpdates , p ) ;
114- p . Start ( ) ;
115-
116- List < Package > Packages = [ ] ;
117- string output = p . StandardOutput . ReadToEnd ( ) ;
118- logger . AddToStdOut ( output ) ;
119- logger . AddToStdErr ( p . StandardError . ReadToEnd ( ) ) ;
120-
121- while ( output [ 0 ] != '{' ) output = output [ 1 ..] ;
122- JsonArray ? data = ( JsonNode . Parse ( output ) as JsonObject ) ? [ "dotnet-tools-outdated" ] as JsonArray ;
123- if ( data is not null )
124- {
125- foreach ( JsonNode ? node in data )
126- {
127- if ( node is not JsonObject element ) continue ;
128-
129- bool unlisted = element [ "becomeUnlisted" ] ? . GetValue < bool > ( ) ?? false ;
130- string id = element [ "packageName" ] ? . ToString ( ) ?? "" ;
131- string version = element [ "currentVer" ] ? . ToString ( ) ?? "" ;
132- string newVersion = element [ "availableVer" ] ? . ToString ( ) ?? "" ;
133-
134- if ( unlisted )
135- {
136- Logger . Warn ( $ ".NET package { id } is unlisted, not showing it...") ;
137- continue ;
138- } ;
139-
140- Packages . Add ( new (
141- CoreTools . FormatAsName ( id ) , id , version , newVersion , DefaultSource , this ,
142- new ( PackageScope . Global )
143- ) ) ;
144-
145- }
146- }
147- else
148- {
149- logger . AddToStdErr ( "\" JsonArray? data\" was null!" ) ;
150- }
151-
152- p . WaitForExit ( ) ;
153- logger . Close ( p . ExitCode ) ;
154-
155- return Packages ;
156- }
157-
158- protected override IReadOnlyList < Package > GetInstalledPackages_UnSafe ( )
60+ protected override IReadOnlyList < Package > _getInstalledPackages_UnSafe ( )
15961 {
16062 List < Package > Packages = [ ] ;
16163 foreach ( var options in new OverridenInstallationOptions [ ] { new ( PackageScope . Local ) , new ( PackageScope . Global ) } )
0 commit comments