protected override void ProcessRecord() { try { ScopesSingleton.GetInstance().Scopes.Add(Scope); var scopesJson = JsonConvert.SerializeObject(ScopesSingleton.GetInstance().Scopes); File.WriteAllText(@"c:\temp\Scopes.json", scopesJson); Console.WriteLine($"Scope {Scope.Name} saved"); } catch (Exception e) { Console.WriteLine($"{e}\r\n Message: {e.Message}\r\n Inner ex: {e.InnerException}\r\n Stacktrace: {e.StackTrace}"); throw; } }
public static ScopesSingleton GetInstance() { return(_instance ?? (_instance = new ScopesSingleton())); }