@@ -68,7 +68,7 @@ public FileSwapper(AppEntry appEntry, PreferencesXML preferencesXML)
6868 }
6969
7070
71- public void InitiateFileSwaps ( PowerLineStatus forPowerLineStatus , PreferencesXML preferencesXML )
71+ public async Task InitiateFileSwaps ( PowerLineStatus forPowerLineStatus , PreferencesXML preferencesXML )
7272 {
7373 Logger . inst . Log ( $ "Initiating FileSwap for AppEntry with target path { AppEntry . AppPath } ") ;
7474
@@ -99,8 +99,7 @@ public void InitiateFileSwaps(PowerLineStatus forPowerLineStatus, PreferencesXML
9999
100100 try
101101 {
102- Task swap = InitiateSingleFileSwap ( current , i ) ;
103- swap . Wait ( ) ; //DEBUG
102+ await InitiateSingleFileSwap ( current , i ) ;
104103 }
105104 catch ( AggregateException )
106105 {
@@ -199,13 +198,13 @@ private async Task InitiateSingleFileSwap(FileSwapPathTask fileSwapPathTask, int
199198 //no need to cancel the save if the substitution fails
200199 FileCopyConsiderAccessRules ( swapPath , pluggedInStoredFilePath , true , false ) ; //save current config to PluggedIn store
201200 string s1 = $ "Saved SwapPath { swapPath } for app { AppEntry . AppPath } as PluggedIn";
202- _ = Logger . inst . Log ( s1 ) ;
201+ Logger . inst . Log ( s1 ) ;
203202
204203 errorFlag = 1 ;
205204
206205 FileCopyConsiderAccessRules ( onBatteryStoredFilePath , swapPath , true , true ) ; //then substitute with OnBattery config
207206 string s2 = $ "Substituted OnBattery config into SwapPath { swapPath } for app { AppEntry . AppPath } ";
208- _ = Logger . inst . Log ( s2 ) ;
207+ Logger . inst . Log ( s2 ) ;
209208
210209 }
211210 catch ( IOException )
@@ -243,23 +242,23 @@ private async Task InitiateSingleFileSwap(FileSwapPathTask fileSwapPathTask, int
243242 //no need to cancel the save if the substitution fails
244243 FileCopyConsiderAccessRules ( swapPath , onBatteryStoredFilePath , true , false ) ; //save current config to OnBattery store
245244 string s1 = $ "Saved SwapPath { swapPath } for app { AppEntry . AppPath } as OnBattery";
246- _ = Logger . inst . Log ( s1 ) ;
245+ Logger . inst . Log ( s1 ) ;
247246
248247 errorFlag = 1 ;
249248
250249 FileCopyConsiderAccessRules ( pluggedInStoredFilePath , swapPath , true , true ) ; //then substitute with PluggedIn config
251250 string s2 = $ "Substituted PluggedIn config into SwapPath { swapPath } for app { AppEntry . AppPath } ";
252- _ = Logger . inst . Log ( s2 ) ;
251+ Logger . inst . Log ( s2 ) ;
253252 }
254253 catch ( IOException )
255254 {
256255 if ( errorFlag == 0 )
257256 {
258- _ = Logger . inst . Log ( $ "Could not copy to destination { onBatteryStoredFilePath } , retrying in some time.") ;
257+ Logger . inst . Log ( $ "Could not copy to destination { onBatteryStoredFilePath } , retrying in some time.") ;
259258 }
260259 else if ( errorFlag == 1 )
261260 {
262- _ = Logger . inst . Log ( $ "Could not copy to destination { swapPath } , retrying in some time.") ;
261+ Logger . inst . Log ( $ "Could not copy to destination { swapPath } , retrying in some time.") ;
263262 }
264263 await Task . Delay ( 5000 ) ;
265264 goto TryAgain ;
@@ -270,15 +269,15 @@ private async Task InitiateSingleFileSwap(FileSwapPathTask fileSwapPathTask, int
270269
271270 preferencesXML . ModifyAppEntryAndSave ( AppEntry . AppPath , modified ) ;
272271 string s3 = $ "Saved SwapPath state for SwapPath { swapPath } for app { AppEntry . AppPath } ";
273- _ = Logger . inst . Log ( s3 ) ;
272+ Logger . inst . Log ( s3 ) ;
274273 }
275274 }
276275 else
277276 {
278277 Debug . WriteLine ( $ "Unknown power state: " + forPowerLineStatus . ToString ( ) ) ;
279278 }
280279
281- _ = Logger . inst . Log ( $ "FileSwaps Task finished for { AppEntry . AppPath } ") ;
280+ Logger . inst . Log ( $ "FileSwaps Task finished for { AppEntry . AppPath } ") ;
282281
283282 OngoingFileSwapTasks . Remove ( fileSwapPathTask ) ;
284283
0 commit comments