Beispiel #1
0
 /// <summary>
 /// Tries to set the current target application to the specified one.
 /// </summary>
 /// <param name="sname"></param>
 /// <param name="app"></param>
 /// <returns></returns>
 public static bool TrySetCurrentApp(this PSCmdlet cmdlet, string sname, out TargetApp app)
 {
     if (!cmdlet.TryGetKnownApp(sname, out app))
     {
         return(false);
     }
     cmdlet.GetPppmState().CurrentTargetApp?.DefaultRepository?.UnregisterDefaultRepository();
     cmdlet.GetPppmState().CurrentTargetApp = app;
     app.DefaultRepository.RegisterDefaultRepository();
     return(true);
 }