Skip to content

Commit

Permalink
Simplify and remove trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
gjkaal committed Jan 22, 2024
1 parent c71b5e8 commit 791c43f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Wam.Core/Configuration/AzureServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class AzureServices
{
public const string SectionName = "AzureServices";
public string? WebPubSubEndpoint { get; set; }
public string? WebPubSubHub{ get; set; }
public string? WebPubSubHub{ get; set; }
public string? UsersStorageAccountName { get; set; }
public string? GamesStorageAccountName { get; set; }
}
12 changes: 3 additions & 9 deletions src/Wam.Core/Enums/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,23 @@ namespace Wam.Core.Enums;

public abstract class GameState
{

public static readonly GameState Init = new GameStateInit();
public static readonly GameState Current = new GameStateCurrent();
public static readonly GameState Started = new GameStateStarted();
public static readonly GameState Finished = new GameStateFinished();
public static readonly GameState Cancelled = new GameStateCancelled();
public static readonly GameState[] All = { Init, Current, Started, Finished, Cancelled };
public static readonly GameState[] All = [Init, Current, Started, Finished, Cancelled];

public static GameState FromCode(string code)
{
var state = Array.Find(All, s => s.Code == code);
if (state == null)
{
throw new InvalidOperationException($"Invalid game state code {code}");
}
return state;
return Array.Find(All, s => s.Code == code)
?? throw new InvalidOperationException($"Invalid game state code {code}");
}

public abstract string Code { get; }
public virtual string TranslationKey => $"Game.States.{Code}";

public virtual bool CanChangeTo(GameState state) => false;

}

public class GameStateInit : GameState
Expand Down
1 change: 0 additions & 1 deletion src/Wam.Core/Events/RealtimeEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ public string ToJson()
ContractResolver = contractResolver,
Formatting = Formatting.None
});

}
}
2 changes: 0 additions & 2 deletions src/Wam.Core/ExtensionMethods/IntegerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

public static class IntegerExtensions
{

public static bool IsHttpSuccessCode(this int code)
=> code >= 200 && code <= 299;

}
2 changes: 1 addition & 1 deletion src/Wam.Core/Identity/CloudIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public static class CloudIdentity
public static TokenCredential GetCloudIdentity => new ChainedTokenCredential(
new ManagedIdentityCredential(),
new VisualStudioCredential(),
new AzureCliCredential());
new AzureCliCredential());
}

0 comments on commit 791c43f

Please sign in to comment.