Dev Improvements (#4)

* Fixed dependency

* Updates to NeoDictionary

* Changes to NeoDictionary

* Started working on a Git implementation to integrate into Game Engines in the future

* Added commit functionality to the git library

* New changes

* Added select for NeoDictionary.cs

* Fixed issue with previous new method

* Added a Benchmarking Tool to be used mostly in game engines

* Added IndexOf to NeoDictionary.cs

* Added new method for BenchmarkUtility.cs

* added an instacedobject class

* Added a new shuffle method for lists

* fixed return type

* Added new Changelog generator

* Added new Game logic library to assist with game projects

* Added Web Project

* Added Nuget package configs

* Add workflow for publishing game library NuGet package

* Add README for OmegaLeo's Helper Library

* Updated Website to reflect all libraries

* Fixed missing library in Changelog

* Added Contributing and Code of Conduct
This commit was merged in pull request #4.
This commit is contained in:
2025-12-09 23:55:56 +00:00
committed by GitHub
parent 11333284e2
commit 6f1ef9c84f
113 changed files with 76553 additions and 6 deletions
@@ -0,0 +1,130 @@
// File: `OmegaLeo.HelperLib.Web/Controllers/HomeController.cs`
using System.Diagnostics;
using System.Reflection;
using GameDevLibrary.Helpers;
using Microsoft.AspNetCore.Mvc;
using NetFlow.DocumentationHelper.Library.Helpers;
using OmegaLeo.HelperLib.Changelog.Tools;
using OmegaLeo.HelperLib.Web.Models;
namespace OmegaLeo.HelperLib.Web.Controllers;
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private static Dictionary<string, LibraryDocumentationViewModel> _libraryCache;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
InitializeLibraries();
}
private void InitializeLibraries()
{
if (_libraryCache != null) return;
var root = GetSolutionRoot();
_libraryCache = new Dictionary<string, LibraryDocumentationViewModel>
{
["core"] = GenerateLibraryDocs(
typeof(BenchmarkUtility).Assembly,
Path.Join(root, "OmegaLeo.HelperLib", "CHANGELOG.md"),
"Core Library",
"Core utilities and helper functions for general C# development",
"OmegaLeo.HelperLib"
),
["changelog"] = GenerateLibraryDocs(
typeof(Changelog.Models.Changelog).Assembly,
Path.Join(root, "OmegaLeo.HelperLib.Changelog", "CHANGELOG.md"),
"Changelog Library",
"Tools for managing and generating changelogs",
"OmegaLeo.HelperLib.Changelog"
),
["game"] = GenerateLibraryDocs(
typeof(OmegaLeo.HelperLib.Game.Models.ConsoleCommand).Assembly,
Path.Join(root, "OmegaLeo.HelperLib.Game", "CHANGELOG.md"),
"Game Development Library",
"Game development utilities for Unity and Godot",
"OmegaLeo.HelperLib.Game"
)
};
}
public IActionResult Index()
{
return View(_libraryCache);
}
public IActionResult Library(string id)
{
if (string.IsNullOrEmpty(id) || !_libraryCache.ContainsKey(id))
return NotFound();
return View(_libraryCache[id]);
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
private LibraryDocumentationViewModel GenerateLibraryDocs(Assembly assembly, string changelogPath, string displayName, string description, string nugetPackageId)
{
var allDocumentation = DocumentationHelperTool.GenerateDocumentation();
var assemblyName = assembly.GetName().Name;
var filteredDocumentation = allDocumentation
.Where(d => d.AssemblyName.Equals(assemblyName, StringComparison.OrdinalIgnoreCase))
.OrderBy(d => d.ClassName)
.ToList();
string changelogMarkdown = "";
if (System.IO.File.Exists(changelogPath))
{
changelogMarkdown = ChangelogTool.GetMarkdown(assembly);
}
string version = assembly.GetCustomAttribute<System.Reflection.AssemblyInformationalVersionAttribute>()?.InformationalVersion
?? assembly.GetName().Version?.ToString()
?? "1.0.0";
if (version.Contains('+'))
{
version = version.Substring(0, version.IndexOf('+'));
}
return new LibraryDocumentationViewModel
{
LibraryName = displayName,
Description = description,
Version = version,
NuGetPackageId = nugetPackageId,
Documentation = filteredDocumentation,
ChangelogMarkdown = changelogMarkdown
};
}
static string GetSolutionRoot()
{
string dir = AppContext.BaseDirectory;
while (!string.IsNullOrEmpty(dir))
{
if (Directory.GetFiles(dir, "*.sln").Length > 0)
return dir;
dir = Directory.GetParent(dir)?.FullName;
}
throw new Exception("Solution root not found.");
}
}