Skip to content

Commit

Permalink
update files to use file scoped namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Blind-Striker committed Feb 1, 2023
1 parent f85c0d1 commit 84bfc41
Show file tree
Hide file tree
Showing 45 changed files with 2,609 additions and 2,747 deletions.
29 changes: 13 additions & 16 deletions src/LocalStack.AwsLocal/AmbientContexts/ConsoleContext.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
using System;
namespace LocalStack.AwsLocal.AmbientContexts;

namespace LocalStack.AwsLocal.AmbientContexts
public abstract class ConsoleContext
{
public abstract class ConsoleContext
{
private static ConsoleContext _current = DefaultConsoleContext.Instance;
private static ConsoleContext _current = DefaultConsoleContext.Instance;

public static ConsoleContext Current
{
get => _current;
public static ConsoleContext Current
{
get => _current;

set => _current = value ?? throw new ArgumentNullException(nameof(value));
}
set => _current = value ?? throw new ArgumentNullException(nameof(value));
}

public abstract void WriteLine(string text);
public abstract void WriteLine(string text);

public static void ResetToDefault()
{
_current = DefaultConsoleContext.Instance;
}
public static void ResetToDefault()
{
_current = DefaultConsoleContext.Instance;
}
}
}
19 changes: 8 additions & 11 deletions src/LocalStack.AwsLocal/AmbientContexts/DefaultConsoleContext.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System;
namespace LocalStack.AwsLocal.AmbientContexts;

namespace LocalStack.AwsLocal.AmbientContexts
public class DefaultConsoleContext : ConsoleContext
{
public class DefaultConsoleContext : ConsoleContext
{
private static readonly Lazy<DefaultConsoleContext> LazyInstance = new Lazy<DefaultConsoleContext>(() => new DefaultConsoleContext());

public override void WriteLine(string text)
{
Console.WriteLine(text);
}
private static readonly Lazy<DefaultConsoleContext> LazyInstance = new(() => new DefaultConsoleContext());

public static DefaultConsoleContext Instance => LazyInstance.Value;
public override void WriteLine(string text)
{
Console.WriteLine(text);
}

public static DefaultConsoleContext Instance => LazyInstance.Value;
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System;
namespace LocalStack.AwsLocal.AmbientContexts;

namespace LocalStack.AwsLocal.AmbientContexts
public class DefaultEnvironmentContext : EnvironmentContext
{
public class DefaultEnvironmentContext : EnvironmentContext
{
private static readonly Lazy<DefaultEnvironmentContext> LazyInstance = new Lazy<DefaultEnvironmentContext>(() => new DefaultEnvironmentContext());

public override void Exit(int value)
{
Environment.Exit(value);
}
private static readonly Lazy<DefaultEnvironmentContext> LazyInstance = new(valueFactory: () => new DefaultEnvironmentContext());

public static DefaultEnvironmentContext Instance => LazyInstance.Value;
public override void Exit(int value)
{
Environment.Exit(value);
}

public static DefaultEnvironmentContext Instance => LazyInstance.Value;
}
29 changes: 13 additions & 16 deletions src/LocalStack.AwsLocal/AmbientContexts/EnvironmentContext.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
using System;
namespace LocalStack.AwsLocal.AmbientContexts;

namespace LocalStack.AwsLocal.AmbientContexts
public abstract class EnvironmentContext
{
public abstract class EnvironmentContext
{
private static EnvironmentContext _current = DefaultEnvironmentContext.Instance;
private static EnvironmentContext _current = DefaultEnvironmentContext.Instance;

public static EnvironmentContext Current
{
get => _current;
public static EnvironmentContext Current
{
get => _current;

set => _current = value ?? throw new ArgumentNullException(nameof(value));
}
set => _current = value ?? throw new ArgumentNullException(nameof(value));
}

public abstract void Exit(int value);
public abstract void Exit(int value);

public static void ResetToDefault()
{
_current = DefaultEnvironmentContext.Instance;
}
public static void ResetToDefault()
{
_current = DefaultEnvironmentContext.Instance;
}
}
}
Loading

0 comments on commit 84bfc41

Please sign in to comment.