@@ -11,30 +11,15 @@ namespace GeneralUpdate.Core
1111{
1212 public sealed class GeneralUpdateOSS
1313 {
14- private static Func < string , bool > ? _beforeFunc ;
15- private static Action < string > ? _afterFunc ;
16-
1714 private GeneralUpdateOSS ( ) { }
1815
1916 #region Public Methods
2017
21- /// <summary>
22- /// Starting an OSS update for windows,Linux,mac platform.
23- /// </summary>
24- /// <param name="beforeFunc">Inject a custom pre-processing method, which will be executed before updating. whose parameters use the Extend.</param>
25- /// <param name="afterFunc">Injects a post-processing method whose parameters use the Extend2</param>
26- public static async Task Start ( Func < string , bool > beforeFunc , Action < string > afterFunc )
27- {
28- _beforeFunc = beforeFunc ;
29- _afterFunc = afterFunc ;
30- await BaseStart ( ) ;
31- }
32-
3318 /// <summary>
3419 /// Starting an OSS update for windows,Linux,mac platform.
3520 /// </summary>
3621 /// <returns></returns>
37- public static async Task Start ( ) => await BaseStart ( ) ;
22+ public static async Task Start ( ) => await BaseStart ( ) ;
3823
3924 #endregion Public Methods
4025
@@ -52,17 +37,9 @@ private static async Task BaseStart()
5237 return ;
5338
5439 var parameter = JsonSerializer . Deserialize < GlobalConfigInfoOSS > ( json , GlobalConfigInfoOSSJsonContext . Default . GlobalConfigInfoOSS ) ;
55- var result = _beforeFunc ? . Invoke ( parameter ? . Extend ) ;
56- if ( _beforeFunc is not null )
57- {
58- if ( result == false )
59- return ;
60- }
61-
6240 var strategy = new OSSStrategy ( ) ;
6341 strategy . Create ( parameter ) ;
6442 await strategy . ExecuteAsync ( ) ;
65- _afterFunc ? . Invoke ( parameter ? . Extend2 ) ;
6643 }
6744 catch ( Exception exception )
6845 {
0 commit comments