@@ -21,8 +21,8 @@ public ApkgRepository(string sp, string v) {
21
21
Index = Enumerable . Empty < RepoPackage > ( ) . ToList ( ) ;
22
22
23
23
if ( ! Directory . Exists ( ReposFolder ) ) {
24
- ApkgOutput . MessageWarn1 ( "could not find repo cache, package list cannot be loaded" ) ;
25
- ApkgOutput . MessageWarn1 ( "please run 'apkg reload'" ) ;
24
+ LConsole . MessageWarn1 ( "could not find repo cache, package list cannot be loaded" ) ;
25
+ LConsole . MessageWarn1 ( "please run 'apkg reload'" ) ;
26
26
return ;
27
27
}
28
28
@@ -78,7 +78,7 @@ public IList<string> AvailablePlugins() {
78
78
public void Reload ( ConfigRepo [ ] repos ) {
79
79
IList < RepoPackage > newIndex = Enumerable . Empty < RepoPackage > ( ) . ToList ( ) ;
80
80
foreach ( ConfigRepo repo in repos ) {
81
- ApkgOutput . MessageSuc0 ( "loading " + repo . name ) ;
81
+ LConsole . MessageSuc0 ( "loading " + repo . name ) ;
82
82
string tempFile = Path . Join ( DownloadPath , repo . name + ".json" ) ;
83
83
if ( ! ApkgUtils . DownloadFile ( repo . url , tempFile ) ) {
84
84
throw new Exception ( "error downloading " + repo . name ) ;
@@ -106,48 +106,48 @@ private string ExtractLcp(string path) {
106
106
}
107
107
Directory . CreateDirectory ( extractPath ) ;
108
108
// extract package archive
109
- ApkgOutput . MessageSuc0 ( "extracting package" ) ;
109
+ LConsole . MessageSuc0 ( "extracting package" ) ;
110
110
ZipFile . ExtractToDirectory ( path , extractPath ) ;
111
111
return extractPath ;
112
112
} // }}}
113
113
114
114
// InstallFiles() {{{
115
115
private void InstallFiles ( string [ ] files , string packageDir ) {
116
116
foreach ( string file in files ) {
117
- ApkgOutput . MessageSuc1 ( "copying " + file ) ;
117
+ LConsole . MessageSuc1 ( "copying " + file ) ;
118
118
Directory . CreateDirectory ( Directory . GetParent ( Path . Join ( SavePath , file ) ) . FullName ) ;
119
119
// copy file
120
120
File . Copy ( Path . Join ( packageDir , file ) , Path . Join ( SavePath , file ) , true ) ;
121
121
if (
122
122
( file . StartsWith ( "share/scripts" ) || file . StartsWith ( "share/go-plugin" ) )
123
123
&& ApkgUtils . GetRunningOS ( ) == "lnx64"
124
124
) {
125
- ApkgOutput . MessageSuc1 ( $ "marking { file } as executable") ;
125
+ LConsole . MessageSuc1 ( $ "marking { file } as executable") ;
126
126
if ( ! ApkgUtils . RunProcess ( "chmod" , "+x " + Path . Join ( SavePath , file ) , SavePath ) ) {
127
- ApkgOutput . MessageWarn1 ( $ "cannot mark { file } as executable") ;
127
+ LConsole . MessageWarn1 ( $ "cannot mark { file } as executable") ;
128
128
}
129
129
}
130
130
}
131
131
} // }}}
132
132
133
133
// InstallLcpkg() {{{
134
134
public void InstallLcpkg ( string archiveFile ) {
135
- ApkgOutput . MessageSuc0 ( "installing package" ) ;
136
- ApkgOutput . MessageSuc1 ( "preparing to extract package" ) ;
135
+ LConsole . MessageSuc0 ( "installing package" ) ;
136
+ LConsole . MessageSuc1 ( "preparing to extract package" ) ;
137
137
138
138
string tempFolder = "" ;
139
139
try {
140
140
tempFolder = ExtractLcp ( archiveFile ) ;
141
141
} catch ( Exception e ) {
142
- ApkgOutput . MessageErr0 ( $ "cannot extract lcp archive: { e . Message } ") ;
142
+ LConsole . MessageErr0 ( $ "cannot extract lcp archive: { e . Message } ") ;
143
143
return ;
144
144
}
145
145
146
- ApkgOutput . MessageSuc0 ( "checking package compatibility" ) ;
146
+ LConsole . MessageSuc0 ( "checking package compatibility" ) ;
147
147
PkgArchiveManifest manifest = FileUtils . ReadManifest ( tempFolder ) ;
148
148
149
149
if ( ! Array . Exists ( manifest . compatibleVersions , e => e == LeoConsoleVersion ) ) {
150
- ApkgOutput . MessageErr1 ( "your LeoConsole version is incompatible with this plugin" ) ;
150
+ LConsole . MessageErr1 ( "your LeoConsole version is incompatible with this plugin" ) ;
151
151
return ;
152
152
}
153
153
@@ -157,7 +157,7 @@ public void InstallLcpkg(string archiveFile) {
157
157
try {
158
158
url = GetUrlFor ( pack ) ;
159
159
} catch ( Exception e ) {
160
- ApkgOutput . MessageErr1 ( "cannot find a dependency" ) ;
160
+ LConsole . MessageErr1 ( "cannot find a dependency" ) ;
161
161
return ;
162
162
}
163
163
string dlPath = Path . Join ( DownloadPath , $ "{ pack } .lcp") ;
@@ -171,46 +171,46 @@ public void InstallLcpkg(string archiveFile) {
171
171
string conflictsWith = ApkgIntegrity . CheckPkgConflicts ( manifest . files , SavePath ) ;
172
172
if ( conflictsWith != "" ) {
173
173
if ( conflictsWith != manifest . packageName ) {
174
- ApkgOutput . MessageErr0 ( $ "{ manifest . packageName } conflicts with { conflictsWith } , aborting install") ;
174
+ LConsole . MessageErr0 ( $ "{ manifest . packageName } conflicts with { conflictsWith } , aborting install") ;
175
175
return ;
176
176
}
177
177
// conflicting with itself ask about reinstalling {{{
178
178
string installedVersion = File . ReadAllText ( Path . Join ( ConfigDir , "installed" , manifest . packageName , "version" ) ) . Trim ( ) ;
179
179
if ( installedVersion == manifest . packageVersion ) {
180
180
if ( ! LConsole . YesNoDialog ( "reinstall same package version?" , true ) ) {
181
- ApkgOutput . MessageErr1 ( "installation aborted" ) ;
181
+ LConsole . MessageErr1 ( "installation aborted" ) ;
182
182
return ;
183
183
}
184
184
}
185
185
if ( ApkgUtils . VersionGreater ( installedVersion , manifest . packageVersion ) ) {
186
186
if ( ! LConsole . YesNoDialog ( $ "downgrade package ({ installedVersion } ->{ manifest . packageVersion } )?", false ) ) {
187
- ApkgOutput . MessageErr1 ( "installation aborted" ) ;
187
+ LConsole . MessageErr1 ( "installation aborted" ) ;
188
188
return ;
189
189
}
190
190
} // }}}
191
191
RemovePackage ( manifest . packageName ) ;
192
192
} // }}}
193
193
194
- ApkgOutput . MessageSuc0 ( $ "installing files for { manifest . project . maintainer } /{ manifest . packageName } ") ;
194
+ LConsole . MessageSuc0 ( $ "installing files for { manifest . project . maintainer } /{ manifest . packageName } ") ;
195
195
InstallFiles ( manifest . files , tempFolder ) ;
196
196
197
197
ApkgIntegrity . Register (
198
198
manifest . packageName , manifest . packageVersion , manifest . files , SavePath
199
199
) ;
200
- ApkgOutput . MessageSuc0 ( "successfully installed " + manifest . packageName ) ;
200
+ LConsole . MessageSuc0 ( "successfully installed " + manifest . packageName ) ;
201
201
} // }}}
202
202
203
203
// RemovePackage() {{{
204
204
public void RemovePackage ( string p ) {
205
- ApkgOutput . MessageSuc0 ( "removing " + p ) ;
205
+ LConsole . MessageSuc0 ( "removing " + p ) ;
206
206
if ( ! Directory . Exists ( Path . Join ( ConfigDir , "installed" , p ) ) ) {
207
- ApkgOutput . MessageErr0 ( $ "{ p } is not installed") ;
207
+ LConsole . MessageErr0 ( $ "{ p } is not installed") ;
208
208
return ;
209
209
}
210
210
try {
211
211
FileUtils . DeleteFiles ( File . ReadLines ( Path . Join ( ConfigDir , "installed" , p , "files" ) ) . ToArray ( ) , SavePath ) ;
212
212
} catch ( Exception e ) {
213
- ApkgOutput . MessageErr0 ( "removing package failed: " + e . Message ) ;
213
+ LConsole . MessageErr0 ( "removing package failed: " + e . Message ) ;
214
214
return ;
215
215
}
216
216
ApkgIntegrity . Unregister ( p , SavePath ) ;
0 commit comments