Skip to content

Commit

Permalink
fix previous code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineatstariongroup committed Dec 5, 2024
1 parent a5a8f17 commit e566941
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
34 changes: 13 additions & 21 deletions EA-ModelKit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public App()
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!);

Directory.SetCurrentDirectory(Path.GetDirectoryName(typeof(App).Assembly.Location)!);

Log.Logger = new LoggerConfiguration()
.MinimumLevel
Expand Down Expand Up @@ -122,9 +123,8 @@ public App()
/// Builds the <see cref="Container" />
/// </summary>
/// <param name="containerBuilder">An optional <see cref="Container" /></param>
public static void BuildContainer(ContainerBuilder containerBuilder = null)
public static void BuildContainer(ContainerBuilder containerBuilder)
{
containerBuilder ??= new ContainerBuilder();
Container = containerBuilder.Build();
}

Expand Down Expand Up @@ -171,24 +171,16 @@ public string EA_GetRibbonCategory(Repository _)
/// <returns>The definition of the menu option</returns>
public object EA_GetMenuItems(Repository repository, string location, string menuName)
{
switch (location)
return location switch
{
case "MainMenu":
switch (menuName)
{
case "":
return MenuHeaderName;
case MenuHeaderName:
return new[]
{
GenericExportEntry
};
}

break;
}

return null;
"MainMenu" => menuName switch
{
"" => MenuHeaderName,
MenuHeaderName => new[] { GenericExportEntry },
_ => null
},
_ => null
};
}

/// <summary>
Expand Down Expand Up @@ -425,7 +417,7 @@ private void ResolveRequiredServices()
/// <returns>The assembly</returns>
private static Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args)
{
var folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var folderPath = Path.GetDirectoryName(typeof(App).Assembly.Location);

if (string.IsNullOrEmpty(folderPath))
{
Expand Down
2 changes: 1 addition & 1 deletion EA-ModelKit/Services/Version/VersionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class VersionService : IVersionService
/// </summary>
public VersionService()
{
this.Version = Assembly.GetExecutingAssembly().GetName().Version;
this.Version = typeof(VersionService).Assembly.GetName().Version;
}

/// <summary>
Expand Down

0 comments on commit e566941

Please sign in to comment.