Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d9289d8eb2 | |||
| b39763c104 | |||
| 1a4eb80696 | |||
| 0e4819a5a2 | |||
| 7d3729db01 | |||
| a53e669bc1 | |||
| 73a3c3cbe5 | |||
| 56f4c88f4b | |||
| 5d45842274 | |||
| 192ab04f89 | |||
| d791145f95 | |||
| 65dc996a22 | |||
| 43acc83207 | |||
| a6cd274cc4 | |||
| e3ca453144 | |||
| 3c4d726f40 | |||
| c8c61573d8 | |||
| 17d0a1d57c | |||
| 73a7983b7e | |||
| 4e131d158c | |||
| dc18f79a7e | |||
| 27a3408828 | |||
| d20a80c44c | |||
| ac91759807 | |||
| f0d9c49f6d | |||
| ab700413fb | |||
| 9d27ec0ac9 | |||
| 6681523a85 | |||
| 53650e4bfe |
@@ -0,0 +1,15 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: omegaleo # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: omegaleo # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
|
polar: # Replace with a single Polar username
|
||||||
|
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||||
|
thanks_dev: # Replace with a single thanks.dev username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: "[BUG]"
|
||||||
|
labels: bug
|
||||||
|
assignees: omegaleo
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. iOS]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Smartphone (please complete the following information):**
|
||||||
|
- Device: [e.g. iPhone6]
|
||||||
|
- OS: [e.g. iOS8.1]
|
||||||
|
- Browser [e.g. stock browser, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: omegaleo
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
Regular → Executable
+34
-14
@@ -6,35 +6,55 @@ on:
|
|||||||
description: 'Tag name:'
|
description: 'Tag name:'
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
run-name: "Generating changelog for Release v${{github.event.inputs.tagName}}"
|
run-name: "Generating changelog and Creating Tag for Release v${{github.event.inputs.tagName}}"
|
||||||
jobs:
|
jobs:
|
||||||
generate_changelog:
|
generate_changelog:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.ref }}
|
||||||
token: ${{ secrets.TOKEN }}
|
token: ${{ secrets.TOKEN }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: '8.0.x'
|
dotnet-version: '9.0.x'
|
||||||
- name: Update Project Versions
|
|
||||||
|
- name: Update OmegaLeo.HelperLib Version
|
||||||
run: sed -i "s/\(<Version>\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1${{github.event.inputs.tagName}}/" "./OmegaLeo.HelperLib/OmegaLeo.HelperLib.csproj"
|
run: sed -i "s/\(<Version>\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1${{github.event.inputs.tagName}}/" "./OmegaLeo.HelperLib/OmegaLeo.HelperLib.csproj"
|
||||||
|
|
||||||
- name: Update Project Versions
|
- name: Update OmegaLeo.HelperLib.Changelog Version
|
||||||
run: sed -i "s/\(<Version>\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1${{github.event.inputs.tagName}}/" "./OmegaLeo.HelperLib.Changelog/OmegaLeo.HelperLib.Changelog.csproj"
|
run: sed -i "s/\(<Version>\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1${{github.event.inputs.tagName}}/" "./OmegaLeo.HelperLib.Changelog/OmegaLeo.HelperLib.Changelog.csproj"
|
||||||
|
|
||||||
- name: Build and Run Changelog Generator
|
- name: Update OmegaLeo.HelperLib.Documentation Version
|
||||||
run: dotnet run --project "./OmegaLeo.HelperLib.ChangelogHandler/OmegaLeo.HelperLib.ChangelogHandler.csproj"
|
run: sed -i "s/\(<Version>\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1${{github.event.inputs.tagName}}/" "./OmegaLeo.HelperLib.Documentation/OmegaLeo.HelperLib.Documentation.csproj"
|
||||||
|
|
||||||
|
- name: Update OmegaLeo.HelperLib.Game Version
|
||||||
|
run: sed -i "s/\(<Version>\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1${{github.event.inputs.tagName}}/" "./OmegaLeo.HelperLib.Game/OmegaLeo.HelperLib.Game.csproj"
|
||||||
|
|
||||||
|
- name: Update OmegaLeo.HelperLib.Shared Version
|
||||||
|
run: sed -i "s/\(<Version>\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1${{github.event.inputs.tagName}}/" "./OmegaLeo.HelperLib.Shared/OmegaLeo.HelperLib.Shared.csproj"
|
||||||
|
|
||||||
|
- name: Build Solution
|
||||||
|
run: dotnet build --configuration Release
|
||||||
|
|
||||||
|
- name: Run Changelog Generator
|
||||||
|
run: dotnet run --project "./OmegaLeo.HelperLib.ChangelogHandler/OmegaLeo.HelperLib.ChangelogHandler.csproj" --configuration Release
|
||||||
env:
|
env:
|
||||||
UNITYFLOW_SECRET: ${{ secrets.TOKEN }}
|
TAG_VERSION: ${{ github.event.inputs.tagName }}
|
||||||
- name: Create Tag
|
|
||||||
|
- name: Commit and Push Changes
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "nunodiogo@omegaleo.pt"
|
git config --local user.email "nunodiogo@omegaleo.pt"
|
||||||
git config --local user.name "Nuno Diogo"
|
git config --local user.name "Nuno Diogo"
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Automatically generated changelog for v${{github.event.inputs.tagName}}"
|
git diff --staged --quiet || git commit -m "chore: update changelog and version to v${{github.event.inputs.tagName}}"
|
||||||
|
git push origin ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: Create and Push Tag
|
||||||
|
run: |
|
||||||
git tag -a "${{ github.event.inputs.tagName }}" -m "Release ${{ github.event.inputs.tagName }}"
|
git tag -a "${{ github.event.inputs.tagName }}" -m "Release ${{ github.event.inputs.tagName }}"
|
||||||
git push origin "${{ github.event.inputs.tagName }}"
|
git push origin "${{ github.event.inputs.tagName }}"
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
+48
@@ -89,3 +89,51 @@ jobs:
|
|||||||
asset_path: ./OmegaLeo.HelperLib.Game/bin/Release/OmegaLeo.HelperLib.Game.${{ github.event.release.tag_name }}.nupkg
|
asset_path: ./OmegaLeo.HelperLib.Game/bin/Release/OmegaLeo.HelperLib.Game.${{ github.event.release.tag_name }}.nupkg
|
||||||
asset_name: OmegaLeo.HelperLib.Game.${{ github.event.release.tag_name }}.nupkg
|
asset_name: OmegaLeo.HelperLib.Game.${{ github.event.release.tag_name }}.nupkg
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
publish-doc-lib:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ get-release ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup .Net Core
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: '8.0.x'
|
||||||
|
- name: Update Project Version
|
||||||
|
run: sed -i "s/\(<Version>\([0-9]\+\.\)\{2\}\)\([0-9]\+\)/\1${{ github.event.release.tag_name }}/" "./OmegaLeo.HelperLib.Documentation/OmegaLeo.HelperLib.Documentation.csproj"
|
||||||
|
- name: Create Nuget Package
|
||||||
|
run: dotnet pack "./OmegaLeo.HelperLib.Documentation/OmegaLeo.HelperLib.Documentation.csproj" -c Release /p:Version=${{ github.event.release.tag_name }} /p:PackageReleaseNotes="See https://github.com/omegaleo/OmegaLeo.HelperLib/releases/tag/${{ github.event.release.tag_name }}"
|
||||||
|
- name: Publish Nuget Package
|
||||||
|
run: dotnet nuget push ./OmegaLeo.HelperLib.Documentation/bin/Release/OmegaLeo.HelperLib.Documentation.${{ github.event.release.tag_name }}.nupkg --api-key ${{ secrets.nuget_api_key }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||||
|
- name: Upload assets to release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||||
|
asset_path: ./OmegaLeo.HelperLib.Documentation/bin/Release/OmegaLeo.HelperLib.Documentation.${{ github.event.release.tag_name }}.nupkg
|
||||||
|
asset_name: OmegaLeo.HelperLib.Documentation.${{ github.event.release.tag_name }}.nupkg
|
||||||
|
asset_content_type: application/zip
|
||||||
|
publish-shared-lib:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ get-release ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup .Net Core
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: '8.0.x'
|
||||||
|
- name: Update Project Version
|
||||||
|
run: sed -i "s/\(<Version>\([0-9]\+\.\)\{2\}\)\([0-9]\+\)/\1${{ github.event.release.tag_name }}/" "./OmegaLeo.HelperLib.Shared/OmegaLeo.HelperLib.Shared.csproj"
|
||||||
|
- name: Create Nuget Package
|
||||||
|
run: dotnet pack "./OmegaLeo.HelperLib.Shared/OmegaLeo.HelperLib.Shared.csproj" -c Release /p:Version=${{ github.event.release.tag_name }} /p:PackageReleaseNotes="See https://github.com/omegaleo/OmegaLeo.HelperLib/releases/tag/${{ github.event.release.tag_name }}"
|
||||||
|
- name: Publish Nuget Package
|
||||||
|
run: dotnet nuget push ./OmegaLeo.HelperLib.Shared/bin/Release/OmegaLeo.HelperLib.Shared.${{ github.event.release.tag_name }}.nupkg --api-key ${{ secrets.nuget_api_key }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||||
|
- name: Upload assets to release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||||
|
asset_path: ./OmegaLeo.HelperLib.Shared/bin/Release/OmegaLeo.HelperLib.Shared.${{ github.event.release.tag_name }}.nupkg
|
||||||
|
asset_name: OmegaLeo.HelperLib.Shared.${{ github.event.release.tag_name }}.nupkg
|
||||||
|
asset_content_type: application/zip
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# Simple workflow for deploying static content to GitHub Pages
|
||||||
|
name: Deploy static content to Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Runs on pushes targeting the default branch
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||||
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Single deploy job since we're just deploying
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
# Upload entire repository
|
||||||
|
path: '.'
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
Regular → Executable
+10
-1
@@ -2,4 +2,13 @@ bin/
|
|||||||
obj/
|
obj/
|
||||||
/packages/
|
/packages/
|
||||||
riderModule.iml
|
riderModule.iml
|
||||||
/_ReSharper.Caches/
|
/_ReSharper.Caches/
|
||||||
|
/.vs
|
||||||
|
<<<<<<< Updated upstream
|
||||||
|
/OmegaLeo.HelperLib.Web
|
||||||
|
=======
|
||||||
|
/OmegaLeo.HelperLib.Web/.config
|
||||||
|
/OmegaLeo.HelperLib.Web/Properties/PublishProfiles
|
||||||
|
/OmegaLeo.HelperLib.Web/publish
|
||||||
|
>>>>>>> Stashed changes
|
||||||
|
/OmegaLeo.HelperLib.Web/OmegaLeo.HelperLib.Web.csproj.user
|
||||||
|
|||||||
Generated
Regular → Executable
Generated
Regular → Executable
Regular → Executable
Regular → Executable
@@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using NetFlow.DocumentationHelper.Library.Attributes;
|
|
||||||
|
|
||||||
namespace OmegaLeo.HelperLib.Changelog.Attributes
|
|
||||||
{
|
|
||||||
[Changelog("v1.0.0", "Created ChangelogAttribute to be used to register changes in the code.")]
|
|
||||||
[Documentation(nameof(ChangelogAttribute), "Attribute to annotate classes, methods, or properties with changelog information.")]
|
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true)]
|
|
||||||
public class ChangelogAttribute : Attribute
|
|
||||||
{
|
|
||||||
public string Version { get; }
|
|
||||||
public string Description { get; }
|
|
||||||
|
|
||||||
public ChangelogAttribute(string version, string description)
|
|
||||||
{
|
|
||||||
Version = version;
|
|
||||||
Description = description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Regular → Executable
+10
-4
@@ -1,7 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
## Version 1.2.0
|
||||||
|
|
||||||
## Version v1.0.0
|
**OmegaLeo.HelperLib.Changelog.Helpers**
|
||||||
|
- **ChangelogHelper**:
|
||||||
|
- Created ChangelogHelper to generate markdown from changelog attributes.
|
||||||
|
|
||||||
- **Class: ChangelogTool**: Created the class ChangelogTool to extract changelogs via attributes
|
## Version 1.0.0
|
||||||
- **Class: ChangelogAttribute**: Created ChangelogAttribute to be used to register changes in the code.
|
|
||||||
|
**OmegaLeo.HelperLib.Changelog.Tools**
|
||||||
|
- **ChangelogTool**:
|
||||||
|
- Created the class ChangelogTool to extract changelogs via attributes
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
|
|
||||||
|
namespace OmegaLeo.HelperLib.Changelog.Helpers
|
||||||
|
{
|
||||||
|
[Documentation(nameof(ChangelogHelper),
|
||||||
|
"Helper class to generate changelog markdown from ChangelogAttributes in the provided Assemblies.")]
|
||||||
|
[Changelog("1.2.0", "Created ChangelogHelper to generate markdown from changelog attributes.")]
|
||||||
|
public static class ChangelogHelper
|
||||||
|
{
|
||||||
|
[Documentation(nameof(GetChangelogMarkdown),
|
||||||
|
"Generates a markdown formatted changelog from the changelog attributes in the provided assemblies.")]
|
||||||
|
public static string GetChangelogMarkdown(IEnumerable<Assembly> assemblies)
|
||||||
|
{
|
||||||
|
var changelog = new StringBuilder();
|
||||||
|
var entriesByVersionDate =
|
||||||
|
new Dictionary<(string Version, string Date),
|
||||||
|
Dictionary<string, List<(string ClassName, string Description)>>>();
|
||||||
|
|
||||||
|
foreach (var assembly in assemblies)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var type in assembly.GetTypes())
|
||||||
|
{
|
||||||
|
// Get type-level changelog attributes
|
||||||
|
var typeAttrs = type.GetCustomAttributes<ChangelogAttribute>().ToList();
|
||||||
|
|
||||||
|
// Get member-level changelog attributes (methods, properties, fields, etc.)
|
||||||
|
var memberAttrs = type.GetMembers(BindingFlags.Public | BindingFlags.NonPublic |
|
||||||
|
BindingFlags.Static | BindingFlags.Instance)
|
||||||
|
.SelectMany(m => m.GetCustomAttributes<ChangelogAttribute>()
|
||||||
|
.Select(attr => (Member: m, Attribute: attr)))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (typeAttrs.Any() || memberAttrs.Any())
|
||||||
|
{
|
||||||
|
var namespaceName = type.Namespace ?? "Global";
|
||||||
|
var className = type.Name.Split('`')[0];
|
||||||
|
|
||||||
|
// Process type-level attributes
|
||||||
|
foreach (var attr in typeAttrs)
|
||||||
|
{
|
||||||
|
AddEntry(entriesByVersionDate, namespaceName, className, attr.Version, attr.Date,
|
||||||
|
attr.Description);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process member-level attributes
|
||||||
|
foreach (var (member, attr) in memberAttrs)
|
||||||
|
{
|
||||||
|
var memberName = $"{className}.{member.Name}";
|
||||||
|
AddEntry(entriesByVersionDate, namespaceName, memberName, attr.Version, attr.Date,
|
||||||
|
attr.Description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ReflectionTypeLoadException)
|
||||||
|
{
|
||||||
|
// Skip assemblies that can't be fully loaded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var versionGroup in entriesByVersionDate.OrderByDescending(x => x.Key.Version))
|
||||||
|
{
|
||||||
|
changelog.AppendLine($"## Version {versionGroup.Key.Version}");
|
||||||
|
if (!string.IsNullOrEmpty(versionGroup.Key.Date))
|
||||||
|
{
|
||||||
|
changelog.AppendLine($"### {versionGroup.Key.Date}");
|
||||||
|
}
|
||||||
|
|
||||||
|
changelog.AppendLine();
|
||||||
|
|
||||||
|
foreach (var namespaceGroup in versionGroup.Value.OrderBy(x => x.Key))
|
||||||
|
{
|
||||||
|
changelog.AppendLine($"**{namespaceGroup.Key}**");
|
||||||
|
foreach (var entry in namespaceGroup.Value.OrderBy(x => x.ClassName))
|
||||||
|
{
|
||||||
|
changelog.AppendLine($@"- **{entry.ClassName}**:
|
||||||
|
- {entry.Description}");
|
||||||
|
}
|
||||||
|
|
||||||
|
changelog.AppendLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return changelog.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddEntry(
|
||||||
|
Dictionary<(string Version, string Date), Dictionary<string, List<(string ClassName, string Description)>>>
|
||||||
|
entriesByVersionDate,
|
||||||
|
string namespaceName,
|
||||||
|
string className,
|
||||||
|
string version,
|
||||||
|
string date,
|
||||||
|
string description)
|
||||||
|
{
|
||||||
|
var key = (version, date ?? string.Empty);
|
||||||
|
|
||||||
|
if (!entriesByVersionDate.ContainsKey(key))
|
||||||
|
entriesByVersionDate[key] = new Dictionary<string, List<(string, string)>>();
|
||||||
|
|
||||||
|
if (!entriesByVersionDate[key].ContainsKey(namespaceName))
|
||||||
|
entriesByVersionDate[key][namespaceName] = new List<(string, string)>();
|
||||||
|
|
||||||
|
entriesByVersionDate[key][namespaceName].Add((className, description));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Regular → Executable
Regular → Executable
Regular → Executable
+16
-6
@@ -4,28 +4,38 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<Version>1.2.1</Version>
|
||||||
<Title>Omega Leo's Helper Library - Changelog</Title>
|
<Title>Omega Leo's Helper Library - Changelog</Title>
|
||||||
<Authors>Nuno "Omega Leo" Diogo</Authors>
|
<Authors>Nuno "Omega Leo" Diogo</Authors>
|
||||||
<Description>Package to help with Changelog generation</Description>
|
<Description>Package to help with Changelog generation</Description>
|
||||||
<PackageProjectUrl>https://github.com/omegaleo/HelperLib</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/omegaleo/HelperLib</PackageProjectUrl>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<RepositoryUrl>https://github.com/omegaleo/HelperLib</RepositoryUrl>
|
<RepositoryUrl>https://github.com/omegaleo/HelperLib</RepositoryUrl>
|
||||||
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
|
<PackageLicenseExpression>AGPL-3.0-only</PackageLicenseExpression>
|
||||||
|
<PackageTags>csharp;dotnet;utility;helper;benchmark</PackageTags>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="README.md" Pack="true" PackagePath="\"/>
|
<None Include="README.md" Pack="true" PackagePath="\">
|
||||||
<None Include="CHANGELOG.md" Pack="true" PackagePath="\"/>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
<None Include="LICENSE.md" Pack="true" PackagePath="\"/>
|
</None>
|
||||||
|
<None Include="CHANGELOG.md" Pack="true" PackagePath="\">
|
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="LICENSE.md" Pack="true" PackagePath="\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="NetFlow.DocumentationHelper.Library">
|
<Reference Include="OmegaLeo.HelperLib.Documentation">
|
||||||
<HintPath>..\..\..\..\..\..\home\omegaleo\.nuget\packages\netflow.documentationhelper.library\1.1.2\lib\netstandard2.1\NetFlow.DocumentationHelper.Library.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\home\omegaleo\.nuget\packages\OmegaLeo.HelperLib.Documentation\1.1.2\lib\netstandard2.1\OmegaLeo.HelperLib.Documentation.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NetFlow.DocumentationHelper.Library" Version="1.1.2" />
|
<ProjectReference Include="..\OmegaLeo.HelperLib.Documentation\OmegaLeo.HelperLib.Documentation.csproj" />
|
||||||
|
<ProjectReference Include="..\OmegaLeo.HelperLib.Shared\OmegaLeo.HelperLib.Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Regular → Executable
+1
-1
@@ -3,7 +3,7 @@ Package to help with Changelog generation by providing a new Changelog attribute
|
|||||||
|
|
||||||
Example attribute usage:
|
Example attribute usage:
|
||||||
```cs
|
```cs
|
||||||
[Changelog("v1.0.0", "This is a test")]
|
[Changelog("1.0.0", "This is a test")]
|
||||||
[Changelog("v1.0.1", "This is another test")]
|
[Changelog("v1.0.1", "This is another test")]
|
||||||
public class Test
|
public class Test
|
||||||
{
|
{
|
||||||
|
|||||||
Regular → Executable
+2
-3
@@ -2,12 +2,11 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NetFlow.DocumentationHelper.Library.Attributes;
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
using OmegaLeo.HelperLib.Changelog.Attributes;
|
|
||||||
|
|
||||||
namespace OmegaLeo.HelperLib.Changelog.Tools
|
namespace OmegaLeo.HelperLib.Changelog.Tools
|
||||||
{
|
{
|
||||||
[Changelog("v1.0.0", "Created the class ChangelogTool to extract changelogs via attributes")]
|
[Changelog("1.0.0", "Created the class ChangelogTool to extract changelogs via attributes")]
|
||||||
[Documentation("ChangelogTool", "Provides methods to extract changelog information from assembly attributes.")]
|
[Documentation("ChangelogTool", "Provides methods to extract changelog information from assembly attributes.")]
|
||||||
public class ChangelogTool
|
public class ChangelogTool
|
||||||
{
|
{
|
||||||
|
|||||||
Regular → Executable
+2
-1
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OmegaLeo.HelperLib.Changelog\OmegaLeo.HelperLib.Changelog.csproj" />
|
<ProjectReference Include="..\OmegaLeo.HelperLib.Changelog\OmegaLeo.HelperLib.Changelog.csproj" />
|
||||||
|
<ProjectReference Include="..\OmegaLeo.HelperLib.Game\OmegaLeo.HelperLib.Game.csproj" />
|
||||||
<ProjectReference Include="..\OmegaLeo.HelperLib\OmegaLeo.HelperLib.csproj" />
|
<ProjectReference Include="..\OmegaLeo.HelperLib\OmegaLeo.HelperLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+7
-2
@@ -4,7 +4,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using GameDevLibrary.Helpers;
|
using OmegaLeo.HelperLib.Changelog.Helpers;
|
||||||
|
using OmegaLeo.HelperLib.Helpers;
|
||||||
using OmegaLeo.HelperLib.Changelog.Models;
|
using OmegaLeo.HelperLib.Changelog.Models;
|
||||||
using OmegaLeo.HelperLib.Changelog.Tools;
|
using OmegaLeo.HelperLib.Changelog.Tools;
|
||||||
|
|
||||||
@@ -14,6 +15,9 @@ var changelogs = new Dictionary<string, Assembly>()
|
|||||||
{
|
{
|
||||||
{Path.Join(root, "OmegaLeo.HelperLib.Changelog", "CHANGELOG.md"), typeof(Changelog).Assembly},
|
{Path.Join(root, "OmegaLeo.HelperLib.Changelog", "CHANGELOG.md"), typeof(Changelog).Assembly},
|
||||||
{Path.Join(root, "OmegaLeo.HelperLib", "CHANGELOG.md"), typeof(BenchmarkUtility).Assembly},
|
{Path.Join(root, "OmegaLeo.HelperLib", "CHANGELOG.md"), typeof(BenchmarkUtility).Assembly},
|
||||||
|
{Path.Join(root, "OmegaLeo.HelperLib.Game", "CHANGELOG.md"), typeof(OmegaLeo.HelperLib.Game.Models.ConsoleCommand).Assembly},
|
||||||
|
{Path.Join(root, "OmegaLeo.HelperLib.Documentation", "CHANGELOG.md"), typeof(OmegaLeo.HelperLib.Documentation.Helpers.DocumentationHelperTool).Assembly},
|
||||||
|
{Path.Join(root, "OmegaLeo.HelperLib.Shared", "CHANGELOG.md"), typeof(OmegaLeo.HelperLib.Shared.Attributes.ChangelogAttribute).Assembly},
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var changelog in changelogs)
|
foreach (var changelog in changelogs)
|
||||||
@@ -24,7 +28,8 @@ foreach (var changelog in changelogs)
|
|||||||
|
|
||||||
void GenerateChangelog(string path, Assembly libraryAssembly)
|
void GenerateChangelog(string path, Assembly libraryAssembly)
|
||||||
{
|
{
|
||||||
var changelogMarkdown = ChangelogTool.GetMarkdown(libraryAssembly);
|
var changelogMarkdown = $@"# Changelog
|
||||||
|
{ChangelogHelper.GetChangelogMarkdown(new []{libraryAssembly})}";
|
||||||
|
|
||||||
File.WriteAllText(path,changelogMarkdown);
|
File.WriteAllText(path,changelogMarkdown);
|
||||||
}
|
}
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
+2
-2
@@ -3,8 +3,8 @@
|
|||||||
// /media/omegaleo/Development/Library Dev/HelperLib
|
// /media/omegaleo/Development/Library Dev/HelperLib
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using GameDevLibrary.Extensions;
|
using OmegaLeo.HelperLib.Extensions;
|
||||||
using GameDevLibrary.Helpers;
|
using OmegaLeo.HelperLib.Helpers;
|
||||||
using LibGit2Sharp;
|
using LibGit2Sharp;
|
||||||
using OmegaLeo.HelperLib.Changelog.Tools;
|
using OmegaLeo.HelperLib.Changelog.Tools;
|
||||||
using OmegaLeo.HelperLib.Git;
|
using OmegaLeo.HelperLib.Git;
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
using OmegaLeo.HelperLib.Changelog.Attributes;
|
|
||||||
|
|
||||||
namespace OmegaLeo.HelperLib.ConsoleApp;
|
|
||||||
|
|
||||||
[Changelog("v1.0.0", "Test")]
|
|
||||||
[Changelog("v1.0.1", "Test 1")]
|
|
||||||
public class TestClass
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Changelog
|
||||||
|
## Version 1.2.0
|
||||||
|
### January 26, 2026
|
||||||
|
|
||||||
|
**OmegaLeo.HelperLib.Documentation.Helpers**
|
||||||
|
- **DocumentationHelperTool**:
|
||||||
|
- Migrated DocumentationHelper library from NetFlow.DocumentationHelper.Library to it's own package in OmegaLeo.HelperLib
|
||||||
|
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Xml;
|
||||||
|
using Microsoft.Extensions.DependencyModel;
|
||||||
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
|
using OmegaLeo.HelperLib.Documentation.Models;
|
||||||
|
|
||||||
|
namespace OmegaLeo.HelperLib.Documentation.Helpers
|
||||||
|
{
|
||||||
|
|
||||||
|
[Changelog("1.2.0", "Migrated DocumentationHelper library from NetFlow.DocumentationHelper.Library to it's own package in OmegaLeo.HelperLib", "January 26, 2026")]
|
||||||
|
public static class DocumentationHelperTool
|
||||||
|
{
|
||||||
|
[Documentation("GenerateDocumentation (bool generateForPackageAssembly)",
|
||||||
|
@"Generates a List of objects of type DocumentationStructure that contain the following fields:
|
||||||
|
**AssemblyName**: Name of the main Assembly, used to identify the root namespace
|
||||||
|
**ClassName**: Name of the class, used to identify the upper level object
|
||||||
|
**Title**: Title what we're generating documentation for
|
||||||
|
**Description**: Description of what we're generating documentation for, this can contain usage examples and can use the args array to pass names(e.g.: This method uses this methodology)
|
||||||
|
**Args**: Array of strings that describe the parameters of the method or class
|
||||||
|
**CodeExample**: A code example of how to use the method or class
|
||||||
|
|
||||||
|
*Note: If generateForPackageAssembly is set to true, this will generate documentation for the library as well.*",
|
||||||
|
new []
|
||||||
|
{
|
||||||
|
"generateForPackageAssembly - Generate documentation for the DocumentationHelper library as well?"
|
||||||
|
},
|
||||||
|
@"```csharp
|
||||||
|
DocumentationHelperTool.GenerateDocumentation(true); // Generates documentation for all assemblies including the DocumentationHelper.Library package assembly
|
||||||
|
DocumentationHelperTool.GenerateDocumentation(false); // Generates documentation for all assemblies excluding the DocumentationHelper.Library package assembly
|
||||||
|
```")]
|
||||||
|
public static IEnumerable<DocumentationStructure> GenerateDocumentation(bool generateForPackageAssembly = false)
|
||||||
|
{
|
||||||
|
EnsureReferencedAssembliesLoaded();
|
||||||
|
|
||||||
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
|
.Where(a => !a.IsDynamic)
|
||||||
|
.Select(a =>
|
||||||
|
new DocumentationAssembly()
|
||||||
|
{
|
||||||
|
AssemblyName = a.GetName(false)?.Name ?? nameof(a),
|
||||||
|
Types = GetTypesWithDocumentationAttribute(a)
|
||||||
|
}).Where(x => x.Types.Any()).ToList();
|
||||||
|
|
||||||
|
if (!generateForPackageAssembly)
|
||||||
|
{
|
||||||
|
assemblies =
|
||||||
|
assemblies.Where(x => x.AssemblyName != typeof(DocumentationHelperTool).Assembly.GetName().Name)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var assembly in assemblies)
|
||||||
|
{
|
||||||
|
foreach (var type in assembly.Types)
|
||||||
|
{
|
||||||
|
var doc = GetDocumentation(type, assembly.AssemblyName);
|
||||||
|
yield return doc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void EnsureReferencedAssembliesLoaded()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var loadedNames = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
|
.Where(a => a.GetName(false) != null)
|
||||||
|
.Select(a => a.GetName(false).Name)
|
||||||
|
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var deps = DependencyContext.Default?.RuntimeLibraries;
|
||||||
|
if (deps == null) return;
|
||||||
|
|
||||||
|
foreach (var lib in deps)
|
||||||
|
{
|
||||||
|
if (!loadedNames.Contains(lib.Name))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Assembly.Load(new AssemblyName(lib.Name));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine($"warning OMEGA001: Failed to load assembly '{lib.Name}': {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// best-effort only
|
||||||
|
Console.Error.WriteLine($"warning OMEGA001: EnsureReferencedAssembliesLoaded failed: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static IEnumerable<Type> GetTypesWithDocumentationAttribute(Assembly assembly)
|
||||||
|
{
|
||||||
|
Type[] types;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
types = assembly.GetTypes();
|
||||||
|
}
|
||||||
|
catch (ReflectionTypeLoadException ex)
|
||||||
|
{
|
||||||
|
types = ex.Types.Where(t => t != null).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Type type in types)
|
||||||
|
{
|
||||||
|
if (type == null) continue;
|
||||||
|
|
||||||
|
var classHasDoc = type.GetCustomAttributes(typeof(DocumentationAttribute), true).Any();
|
||||||
|
var fieldsHaveDoc = type.GetFields()
|
||||||
|
.Any(f => f.GetCustomAttributes(typeof(DocumentationAttribute), true).Any());
|
||||||
|
var typesHaveDoc = type.GetProperties()
|
||||||
|
.Any(p => p.GetCustomAttributes(typeof(DocumentationAttribute), true).Any());
|
||||||
|
var methodsHaveDoc = type.GetMethods()
|
||||||
|
.Any(m => m.GetCustomAttributes(typeof(DocumentationAttribute), true).Any());
|
||||||
|
|
||||||
|
if (classHasDoc || fieldsHaveDoc || typesHaveDoc || methodsHaveDoc)
|
||||||
|
{
|
||||||
|
yield return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Documentation(nameof(GetDocumentation), "Generates a DocumentationStructure object for the given Type and Assembly Name",
|
||||||
|
new []
|
||||||
|
{
|
||||||
|
"type - The Type to generate documentation for",
|
||||||
|
"assemblyName - The name of the assembly the Type belongs to"
|
||||||
|
},
|
||||||
|
@"```csharp
|
||||||
|
var doc = GetDocumentation(typeof(MyClass), ""MyAssembly"");
|
||||||
|
```")]
|
||||||
|
static DocumentationStructure GetDocumentation(Type type, string assemblyName)
|
||||||
|
{
|
||||||
|
var classDocs = type.GetCustomAttributes(typeof(DocumentationAttribute), true)
|
||||||
|
.Select(x => (DocumentationAttribute)x);
|
||||||
|
|
||||||
|
var fieldDocs = type.GetFields().SelectMany(f =>
|
||||||
|
f.GetCustomAttributes(typeof(DocumentationAttribute), true).Select(x => (DocumentationAttribute)x));
|
||||||
|
var propertyDocs = type.GetProperties().SelectMany(p =>
|
||||||
|
p.GetCustomAttributes(typeof(DocumentationAttribute), true).Select(x => (DocumentationAttribute)x));
|
||||||
|
var methodDocs = type.GetMethods().SelectMany(m =>
|
||||||
|
m.GetCustomAttributes(typeof(DocumentationAttribute), true).Select(x => (DocumentationAttribute)x));
|
||||||
|
|
||||||
|
var docStructure = new DocumentationStructure(assemblyName, type.Name);
|
||||||
|
|
||||||
|
foreach (var doc in classDocs)
|
||||||
|
{
|
||||||
|
docStructure.AddDescription(new DocumentationDescription(doc.Title, doc.Description, doc.Args, doc.CodeExample));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var doc in fieldDocs)
|
||||||
|
{
|
||||||
|
docStructure.AddDescription(new DocumentationDescription(doc.Title, doc.Description, doc.Args, doc.CodeExample));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var doc in propertyDocs)
|
||||||
|
{
|
||||||
|
docStructure.AddDescription(new DocumentationDescription(doc.Title, doc.Description, doc.Args, doc.CodeExample));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var doc in methodDocs)
|
||||||
|
{
|
||||||
|
docStructure.AddDescription(new DocumentationDescription(doc.Title, doc.Description, doc.Args, doc.CodeExample));
|
||||||
|
}
|
||||||
|
|
||||||
|
return docStructure;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Dictionary<string, string> loadedXmlDocumentation =
|
||||||
|
new Dictionary<string, string>();
|
||||||
|
public static void LoadXmlDocumentation(string xmlDocumentation)
|
||||||
|
{
|
||||||
|
using (XmlReader xmlReader = XmlReader.Create(new StringReader(xmlDocumentation)))
|
||||||
|
{
|
||||||
|
while (xmlReader.Read())
|
||||||
|
{
|
||||||
|
if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "member")
|
||||||
|
{
|
||||||
|
string raw_name = xmlReader["name"];
|
||||||
|
loadedXmlDocumentation[raw_name] = xmlReader.ReadInnerXml();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OmegaLeo.HelperLib.Documentation.Models
|
||||||
|
{
|
||||||
|
public class DocumentationAssembly
|
||||||
|
{
|
||||||
|
public string AssemblyName;
|
||||||
|
public IEnumerable<Type> Types;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
|
|
||||||
|
namespace OmegaLeo.HelperLib.Documentation.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class DocumentationStructure
|
||||||
|
{
|
||||||
|
public string AssemblyName;
|
||||||
|
public string ClassName;
|
||||||
|
public List<DocumentationDescription> Descriptions;
|
||||||
|
|
||||||
|
public DocumentationStructure(string assemblyName, string className)
|
||||||
|
{
|
||||||
|
AssemblyName = assemblyName;
|
||||||
|
ClassName = className;
|
||||||
|
Descriptions = new List<DocumentationDescription>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddDescription(DocumentationDescription description)
|
||||||
|
{
|
||||||
|
Descriptions.Add(description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DocumentationDescription
|
||||||
|
{
|
||||||
|
public string Title;
|
||||||
|
public string Description;
|
||||||
|
public string[] Parameters;
|
||||||
|
public string CodeExample = string.Empty;
|
||||||
|
|
||||||
|
[Documentation(nameof(DocumentationDescription), "Description of the current Documented object", new []
|
||||||
|
{
|
||||||
|
"title - Name of the object",
|
||||||
|
"description - Description of what the object does",
|
||||||
|
"parameters - The parameters for the object (in case of a method with parameters)",
|
||||||
|
"codeExample - Code example of how to use the object"
|
||||||
|
})]
|
||||||
|
public DocumentationDescription(string title, string description, string[] parameters = default, string codeExample = "")
|
||||||
|
{
|
||||||
|
Title = title;
|
||||||
|
Description = description;
|
||||||
|
Parameters = parameters ?? Array.Empty<string>();
|
||||||
|
CodeExample = codeExample;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<RootNamespace>OmegaLeo.HelperLib.Documentation</RootNamespace>
|
||||||
|
<Version>1.2.1</Version>
|
||||||
|
<Title>Omega Leo's Helper Library</Title>
|
||||||
|
<Authors>Nuno "Omega Leo" Diogo</Authors>
|
||||||
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
|
<PackageProjectUrl>https://github.com/omegaleo/HelperLib</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://github.com/omegaleo/HelperLib</RepositoryUrl>
|
||||||
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
|
<PackageLicenseExpression>AGPL-3.0-only</PackageLicenseExpression>
|
||||||
|
<PackageTags>csharp;dotnet;utility;helper;documentation;</PackageTags>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="10.0.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Attributes\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\OmegaLeo.HelperLib.Shared\OmegaLeo.HelperLib.Shared.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||||
|
<None Include="CHANGELOG.md" Pack="true" PackagePath="\" />
|
||||||
|
<None Update="README.md">
|
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="CHANGELOG.md">
|
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Omega Leo's Helper Library - Documentation
|
||||||
|
Package to help with generating and managing documentation for your C# projects.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Attribute-based documentation: Use custom attributes to annotate your classes, methods, and properties with documentation comments.
|
||||||
|
- Documentation extraction tool: A tool to extract and format documentation into various formats (Markdown, HTML, etc.).
|
||||||
|
- Integration with build processes: Easily integrate documentation generation into your CI/CD pipelines.
|
||||||
|
|
||||||
|
## Example attribute usage:
|
||||||
|
```cs
|
||||||
|
[Documentation("GenerateDocumentation (bool generateForPackageAssembly)",
|
||||||
|
@"Generates a List of objects of type DocumentationStructure that contain the following fields:
|
||||||
|
**AssemblyName**: Name of the main Assembly, used to identify the root namespace
|
||||||
|
**ClassName**: Name of the class, used to identify the upper level object
|
||||||
|
**Title**: Title what we're generating documentation for
|
||||||
|
**Description**: Description of what we're generating documentation for, this can contain usage examples and can use the args array to pass names(e.g.: This method uses this methodology)
|
||||||
|
**Args**: Array of strings that describe the parameters of the method or class
|
||||||
|
**CodeExample**: A code example of how to use the method or class
|
||||||
|
|
||||||
|
*Note: If generateForPackageAssembly is set to true, this will generate documentation for the library as well.*",
|
||||||
|
new []
|
||||||
|
{
|
||||||
|
"generateForPackageAssembly - Generate documentation for the DocumentationHelper library as well?"
|
||||||
|
},
|
||||||
|
@"```csharp
|
||||||
|
DocumentationHelperTool.GenerateDocumentation(true); // Generates documentation for all assemblies including the DocumentationHelper.Library package assembly
|
||||||
|
DocumentationHelperTool.GenerateDocumentation(false); // Generates documentation for all assemblies excluding the DocumentationHelper.Library package assembly
|
||||||
|
```")]
|
||||||
|
public static IEnumerable<DocumentationStructure> GenerateDocumentation(bool generateForPackageAssembly = false)
|
||||||
|
```
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Changelog
|
||||||
Regular → Executable
+11
@@ -1,10 +1,21 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
using OmegaLeo.HelperLib.Game.Models;
|
using OmegaLeo.HelperLib.Game.Models;
|
||||||
|
|
||||||
namespace OmegaLeo.HelperLib.Game.Extensions
|
namespace OmegaLeo.HelperLib.Game.Extensions
|
||||||
{
|
{
|
||||||
public static class ListExtensions
|
public static class ListExtensions
|
||||||
{
|
{
|
||||||
|
[Documentation(nameof(Shuffle),
|
||||||
|
"Shuffles the elements of the list in place using the provided RandomNumberGenerator.",
|
||||||
|
null,
|
||||||
|
@"```csharp
|
||||||
|
var list = new List<int> { 1, 2, 3, 4};
|
||||||
|
var rng = new RandomNumberGenerator();
|
||||||
|
// List before: [1, 2, 3, 4]
|
||||||
|
list.Shuffle(rng);
|
||||||
|
// List after: [3, 1, 4, 2] (example output)
|
||||||
|
```")]
|
||||||
public static void Shuffle<T>(this IList<T> list, RandomNumberGenerator rng)
|
public static void Shuffle<T>(this IList<T> list, RandomNumberGenerator rng)
|
||||||
{
|
{
|
||||||
for (int i = list.Count - 1; i > 0; i--)
|
for (int i = list.Count - 1; i > 0; i--)
|
||||||
|
|||||||
Regular → Executable
+8
@@ -1,7 +1,12 @@
|
|||||||
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
using OmegaLeo.HelperLib.Game.Models;
|
using OmegaLeo.HelperLib.Game.Models;
|
||||||
|
|
||||||
namespace OmegaLeo.HelperLib.Game.Handlers
|
namespace OmegaLeo.HelperLib.Game.Handlers
|
||||||
{
|
{
|
||||||
|
[Documentation(nameof(DelayedActionHandler), "Handler for managing delayed actions, allowing cancellation and status checking.", null, @"```csharp
|
||||||
|
var action = new DelayedAction(...);
|
||||||
|
var handler = new DelayedActionHandler(action);
|
||||||
|
```")]
|
||||||
public class DelayedActionHandler
|
public class DelayedActionHandler
|
||||||
{
|
{
|
||||||
private readonly DelayedAction _action;
|
private readonly DelayedAction _action;
|
||||||
@@ -11,6 +16,9 @@ namespace OmegaLeo.HelperLib.Game.Handlers
|
|||||||
_action = action;
|
_action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Documentation(nameof(Cancel), "Cancels the delayed action if it has not yet executed.", null, @"```csharp
|
||||||
|
handler.Cancel();
|
||||||
|
```")]
|
||||||
public void Cancel()
|
public void Cancel()
|
||||||
{
|
{
|
||||||
if (_action != null)
|
if (_action != null)
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+14
-2
@@ -4,11 +4,14 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Title>Omega Leo's Helper Library - Game Logic</Title>
|
<Title>Omega Leo's Helper Library - Game Logic</Title>
|
||||||
<Version>0.0.2</Version>
|
<Version>1.2.1</Version>
|
||||||
<Authors>Nuno "Omega Leo" Diogo</Authors>
|
<Authors>Nuno "Omega Leo" Diogo</Authors>
|
||||||
<PackageProjectUrl>https://github.com/omegaleo/HelperLib</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/omegaleo/HelperLib</PackageProjectUrl>
|
||||||
<PackageLicenseUrl>https://github.com/omegaleo/HelperLib/blob/main/LICENSE</PackageLicenseUrl>
|
|
||||||
<RepositoryUrl>https://github.com/omegaleo/HelperLib</RepositoryUrl>
|
<RepositoryUrl>https://github.com/omegaleo/HelperLib</RepositoryUrl>
|
||||||
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
|
<PackageLicenseExpression>AGPL-3.0-only</PackageLicenseExpression>
|
||||||
|
<PackageTags>csharp;dotnet;utility;helper;benchmark</PackageTags>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -19,4 +22,13 @@
|
|||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="README.md">
|
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="CHANGELOG.md">
|
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
@@ -1 +0,0 @@
|
|||||||
# OmegaLeo's Helper Library - Game Logic
|
|
||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
# OmegaLeo's Helper Library - Game Logic
|
||||||
|
Lightweight utility library for C# projects and game development helpers.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Game development specific helpers and utilities
|
||||||
|
- Helpers for common game development tasks
|
||||||
|
- Easy to integrate into existing projects
|
||||||
|
- Open source under the AGPL v3 License
|
||||||
Regular → Executable
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NetFlow.DocumentationHelper.Library.Attributes;
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
using OmegaLeo.HelperLib.Game.Models;
|
using OmegaLeo.HelperLib.Game.Models;
|
||||||
|
|
||||||
namespace OmegaLeo.HelperLib.Game.Services
|
namespace OmegaLeo.HelperLib.Game.Services
|
||||||
|
|||||||
Regular → Executable
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NetFlow.DocumentationHelper.Library.Attributes;
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
using OmegaLeo.HelperLib.Game.Handlers;
|
using OmegaLeo.HelperLib.Game.Handlers;
|
||||||
using OmegaLeo.HelperLib.Game.Models;
|
using OmegaLeo.HelperLib.Game.Models;
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NetFlow.DocumentationHelper.Library.Attributes;
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using OmegaLeo.HelperLib.Game.Interfaces;
|
using OmegaLeo.HelperLib.Game.Interfaces;
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NetFlow.DocumentationHelper.Library.Attributes;
|
using OmegaLeo.HelperLib.Shared.Attributes;
|
||||||
using OmegaLeo.HelperLib.Game.Models;
|
using OmegaLeo.HelperLib.Game.Models;
|
||||||
|
|
||||||
namespace OmegaLeo.HelperLib.Game.Utilities
|
namespace OmegaLeo.HelperLib.Game.Utilities
|
||||||
|
|||||||
Regular → Executable
+1
-1
@@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using GameDevLibrary.Extensions;
|
using OmegaLeo.HelperLib.Extensions;
|
||||||
using LibGit2Sharp;
|
using LibGit2Sharp;
|
||||||
using OmegaLeo.HelperLib.Git.Models;
|
using OmegaLeo.HelperLib.Git.Models;
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
+1
-2
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RootNamespace>GameDevLibrary.Git</RootNamespace>
|
<RootNamespace>OmegaLeo.HelperLib.Git</RootNamespace>
|
||||||
<Version>0.0.2</Version>
|
<Version>0.0.2</Version>
|
||||||
<Title>Omega Leo's Helper Library - LibGit2Sharp Implementation</Title>
|
<Title>Omega Leo's Helper Library - LibGit2Sharp Implementation</Title>
|
||||||
<Authors>Nuno "Omega Leo" Diogo</Authors>
|
<Authors>Nuno "Omega Leo" Diogo</Authors>
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="LibGit2Sharp" Version="0.30.0"/>
|
<PackageReference Include="LibGit2Sharp" Version="0.30.0"/>
|
||||||
<PackageReference Include="NetFlow.DocumentationHelper.Library" Version="1.1.2"/>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OmegaLeo.HelperLib.Shared.Attributes
|
||||||
|
{
|
||||||
|
[Documentation(nameof(ChangelogAttribute), "Attribute to annotate classes, methods, or properties with changelog information.",
|
||||||
|
new []
|
||||||
|
{
|
||||||
|
"Version - Changelog version",
|
||||||
|
"Description - Description of what was changed",
|
||||||
|
"Date - Date of the changes (Optional)"
|
||||||
|
},
|
||||||
|
@"```cs
|
||||||
|
[Changelog(""1.0.0"", ""Created ChangelogAttribute to be used to register changes in the code."")]
|
||||||
|
public class ChangelogAttribute : Attribute" )]
|
||||||
|
[Changelog("1.0.0", "Created ChangelogAttribute to be used to register changes in the code.")]
|
||||||
|
[Changelog("1.2.1", "Created documentation for ChangelogAttribute.", "January 28, 2026")]
|
||||||
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true)]
|
||||||
|
public class ChangelogAttribute : Attribute
|
||||||
|
{
|
||||||
|
public string Version { get; }
|
||||||
|
public string Description { get; }
|
||||||
|
|
||||||
|
public string Date { get; set; }
|
||||||
|
|
||||||
|
public ChangelogAttribute(string version, string description, string date = "")
|
||||||
|
{
|
||||||
|
Version = version;
|
||||||
|
Description = description;
|
||||||
|
Date = date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OmegaLeo.HelperLib.Shared.Attributes
|
||||||
|
{
|
||||||
|
[System.AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
|
||||||
|
[Changelog("1.2.1", "Created documentation for DocumentationAttribute.", "January 28, 2026")]
|
||||||
|
[Documentation("DocumentationAttribute",
|
||||||
|
"Attribute to annotate classes, methods, or properties with documentation information.",
|
||||||
|
new string[]
|
||||||
|
{
|
||||||
|
"title: The title of the documentation.",
|
||||||
|
"description: A brief description.",
|
||||||
|
"args: An array of argument descriptions.",
|
||||||
|
"codeExample: An optional code example."
|
||||||
|
},
|
||||||
|
@"```csharp
|
||||||
|
[Documentation(
|
||||||
|
""MyMethod"",
|
||||||
|
""This method does something important."",
|
||||||
|
new string[] { ""param1: The first parameter."", ""param2: The second parameter."" },
|
||||||
|
""MyMethod(param1, param2);""
|
||||||
|
)]
|
||||||
|
public void MyMethod(string param1, int param2)
|
||||||
|
{
|
||||||
|
// Method implementation
|
||||||
|
}
|
||||||
|
```
|
||||||
|
"
|
||||||
|
)]
|
||||||
|
public class DocumentationAttribute : Attribute
|
||||||
|
{
|
||||||
|
public string Title;
|
||||||
|
public string Description;
|
||||||
|
public string[] Args;
|
||||||
|
public string CodeExample = string.Empty;
|
||||||
|
|
||||||
|
public DocumentationAttribute(string title, string description, string[] args = null, string codeExample = "")
|
||||||
|
{
|
||||||
|
Title = title;
|
||||||
|
Description = description;
|
||||||
|
Args = args ?? Array.Empty<string>();
|
||||||
|
CodeExample = codeExample;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Changelog
|
||||||
|
## Version 1.2.1
|
||||||
|
### January 28, 2026
|
||||||
|
|
||||||
|
**OmegaLeo.HelperLib.Shared.Attributes**
|
||||||
|
- **ChangelogAttribute**:
|
||||||
|
- Created documentation for ChangelogAttribute.
|
||||||
|
- **DocumentationAttribute**:
|
||||||
|
- Created documentation for DocumentationAttribute.
|
||||||
|
|
||||||
|
## Version 1.0.0
|
||||||
|
|
||||||
|
**OmegaLeo.HelperLib.Shared.Attributes**
|
||||||
|
- **ChangelogAttribute**:
|
||||||
|
- Created ChangelogAttribute to be used to register changes in the code.
|
||||||
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<RootNamespace>OmegaLeo.HelperLib.Shared</RootNamespace>
|
||||||
|
<Version>1.2.1</Version>
|
||||||
|
<Title>Omega Leo's Helper Library - Shared Components</Title>
|
||||||
|
<Authors>Nuno "Omega Leo" Diogo</Authors>
|
||||||
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
|
<PackageProjectUrl>https://github.com/omegaleo/HelperLib</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://github.com/omegaleo/HelperLib</RepositoryUrl>
|
||||||
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
|
<PackageLicenseExpression>AGPL-3.0-only</PackageLicenseExpression>
|
||||||
|
<PackageTags>csharp;dotnet;</PackageTags>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="README.md" Pack="true" PackagePath="\">
|
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="CHANGELOG.md" Pack="true" PackagePath="\">
|
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Omega Leo's Helper Library - Shared Components
|
||||||
|
Lightweight utility library for C# projects.
|
||||||
|
|
||||||
|
This library contains shared components and utilities that are used by other packages in the Omega Leo's Helper Library suite.
|
||||||
Regular → Executable
+275
-39
@@ -1,9 +1,13 @@
|
|||||||
// File: `OmegaLeo.HelperLib.Web/Controllers/HomeController.cs`
|
// File: `OmegaLeo.HelperLib.Web/Controllers/HomeController.cs`
|
||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using GameDevLibrary.Helpers;
|
using System.Runtime.ExceptionServices;
|
||||||
|
using OmegaLeo.HelperLib.Helpers;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NetFlow.DocumentationHelper.Library.Helpers;
|
using OmegaLeo.HelperLib.Changelog.Helpers;
|
||||||
|
using OmegaLeo.HelperLib.Documentation.Helpers;
|
||||||
|
using OmegaLeo.HelperLib.Documentation.Models;
|
||||||
using OmegaLeo.HelperLib.Changelog.Tools;
|
using OmegaLeo.HelperLib.Changelog.Tools;
|
||||||
using OmegaLeo.HelperLib.Web.Models;
|
using OmegaLeo.HelperLib.Web.Models;
|
||||||
|
|
||||||
@@ -25,31 +29,49 @@ public class HomeController : Controller
|
|||||||
if (_libraryCache != null) return;
|
if (_libraryCache != null) return;
|
||||||
|
|
||||||
var root = GetSolutionRoot();
|
var root = GetSolutionRoot();
|
||||||
|
_logger.LogInformation("Initializing libraries from base directory: {Root}", root);
|
||||||
|
|
||||||
_libraryCache = new Dictionary<string, LibraryDocumentationViewModel>
|
_libraryCache = new Dictionary<string, LibraryDocumentationViewModel>
|
||||||
{
|
{
|
||||||
["core"] = GenerateLibraryDocs(
|
["core"] = GenerateLibraryDocs(
|
||||||
typeof(BenchmarkUtility).Assembly,
|
typeof(BenchmarkUtility).Assembly,
|
||||||
Path.Join(root, "OmegaLeo.HelperLib", "CHANGELOG.md"),
|
Path.Combine(root, "changelogs", "OmegaLeo.HelperLib.CHANGELOG.md"),
|
||||||
"Core Library",
|
"Core Library",
|
||||||
"Core utilities and helper functions for general C# development",
|
"Core utilities and helper functions for general C# development",
|
||||||
"OmegaLeo.HelperLib"
|
"OmegaLeo.HelperLib"
|
||||||
),
|
),
|
||||||
["changelog"] = GenerateLibraryDocs(
|
["changelog"] = GenerateLibraryDocs(
|
||||||
typeof(Changelog.Models.Changelog).Assembly,
|
typeof(Changelog.Models.Changelog).Assembly,
|
||||||
Path.Join(root, "OmegaLeo.HelperLib.Changelog", "CHANGELOG.md"),
|
Path.Combine(root, "changelogs", "OmegaLeo.HelperLib.Changelog.CHANGELOG.md"),
|
||||||
"Changelog Library",
|
"Changelog Library",
|
||||||
"Tools for managing and generating changelogs",
|
"Tools for managing and generating changelogs",
|
||||||
"OmegaLeo.HelperLib.Changelog"
|
"OmegaLeo.HelperLib.Changelog"
|
||||||
),
|
),
|
||||||
["game"] = GenerateLibraryDocs(
|
["game"] = GenerateLibraryDocs(
|
||||||
typeof(OmegaLeo.HelperLib.Game.Models.ConsoleCommand).Assembly,
|
typeof(OmegaLeo.HelperLib.Game.Models.ConsoleCommand).Assembly,
|
||||||
Path.Join(root, "OmegaLeo.HelperLib.Game", "CHANGELOG.md"),
|
Path.Combine(root, "changelogs", "OmegaLeo.HelperLib.Game.CHANGELOG.md"),
|
||||||
"Game Development Library",
|
"Game Development Library",
|
||||||
"Game development utilities for Unity and Godot",
|
"Game development utilities for Unity and Godot",
|
||||||
"OmegaLeo.HelperLib.Game"
|
"OmegaLeo.HelperLib.Game"
|
||||||
)
|
),
|
||||||
|
["documentation"] = GenerateLibraryDocs(
|
||||||
|
typeof(OmegaLeo.HelperLib.Documentation.Helpers.DocumentationHelperTool).Assembly,
|
||||||
|
Path.Combine(root, "changelogs", "OmegaLeo.HelperLib.Documentation.CHANGELOG.md"),
|
||||||
|
"Documentation Library",
|
||||||
|
"Tools for generating documentation from code attributes",
|
||||||
|
"OmegaLeo.HelperLib.Documentation",
|
||||||
|
true
|
||||||
|
),
|
||||||
|
["shared"] = GenerateLibraryDocs(
|
||||||
|
typeof(OmegaLeo.HelperLib.Shared.Attributes.ChangelogAttribute).Assembly,
|
||||||
|
Path.Combine(root, "shared", "OmegaLeo.HelperLib.Shared.CHANGELOG.md"),
|
||||||
|
"Shared Library",
|
||||||
|
"Library of shared attributes and utilities used across other OmegaLeo.HelperLib packages",
|
||||||
|
"OmegaLeo.HelperLib.Shared"
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_logger.LogInformation("Initialized {Count} libraries", _libraryCache.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
@@ -62,7 +84,18 @@ public class HomeController : Controller
|
|||||||
if (string.IsNullOrEmpty(id) || !_libraryCache.ContainsKey(id))
|
if (string.IsNullOrEmpty(id) || !_libraryCache.ContainsKey(id))
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
||||||
return View(_libraryCache[id]);
|
var cache = _libraryCache[id];
|
||||||
|
|
||||||
|
if (cache.Documentation.Any())
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"Found cache for {id}: {cache.Documentation.Count} entries");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError($"Cache for {id} is empty!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
@@ -76,55 +109,258 @@ public class HomeController : Controller
|
|||||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||||
}
|
}
|
||||||
|
|
||||||
private LibraryDocumentationViewModel GenerateLibraryDocs(Assembly assembly, string changelogPath, string displayName, string description, string nugetPackageId)
|
private void LogDocumentationHelperInfo()
|
||||||
{
|
{
|
||||||
var allDocumentation = DocumentationHelperTool.GenerateDocumentation();
|
try
|
||||||
var assemblyName = assembly.GetName().Name;
|
{
|
||||||
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
|
var target = assemblies.FirstOrDefault(a =>
|
||||||
|
a.GetName().Name.Equals("OmegaLeo.HelperLib.Documentation", StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
var filteredDocumentation = allDocumentation
|
if (target == null)
|
||||||
.Where(d => d.AssemblyName.Equals(assemblyName, StringComparison.OrdinalIgnoreCase))
|
{
|
||||||
.OrderBy(d => d.ClassName)
|
_logger.LogWarning("OmegaLeo.HelperLib.Documentation not loaded. Loaded assemblies ({Count}):",
|
||||||
.ToList();
|
assemblies.Length);
|
||||||
|
foreach (var a in assemblies.OrderBy(a => a.GetName().Name))
|
||||||
|
{
|
||||||
|
_logger.LogInformation(" {Name} {Version} => {Location}", a.GetName().Name, a.GetName().Version,
|
||||||
|
SafeLocation(a));
|
||||||
|
}
|
||||||
|
|
||||||
string changelogMarkdown = "";
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("Found {Name} {Version} at {Location}", target.GetName().Name,
|
||||||
|
target.GetName().Version, SafeLocation(target));
|
||||||
|
|
||||||
|
Type attrType = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
attrType = target.GetType("OmegaLeo.HelperLib.Documentation.Attributes.DocumentationAttribute",
|
||||||
|
false, true);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "Failed to GetType for DocumentationAttribute in {Assembly}",
|
||||||
|
target.GetName().Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attrType == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Type 'DocumentationAttribute' not found in {Assembly}.", target.GetName().Name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var ctors = attrType.GetConstructors(BindingFlags.Public | BindingFlags.Instance |
|
||||||
|
BindingFlags.NonPublic);
|
||||||
|
if (!ctors.Any())
|
||||||
|
_logger.LogWarning("No constructors found on DocumentationAttribute in {Assembly}.",
|
||||||
|
target.GetName().Name);
|
||||||
|
foreach (var ctor in ctors)
|
||||||
|
{
|
||||||
|
var sig = string.Join(", ", ctor.GetParameters().Select(p => p.ParameterType.Name + " " + p.Name));
|
||||||
|
_logger.LogInformation("DocumentationAttribute ctor: ({Signature})", sig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Failed to log DocumentationHelper assembly info.");
|
||||||
|
}
|
||||||
|
|
||||||
|
static string SafeLocation(Assembly a)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return string.IsNullOrEmpty(a.Location) ? "<in-memory>" : a.Location;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return "<unknown>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InspectDocumentationHelperMethod()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
|
Type helperType = null;
|
||||||
|
foreach (var asm in assemblies)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var t = asm.GetTypes().FirstOrDefault(tt =>
|
||||||
|
tt.Name.Equals("DocumentationHelperTool", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| tt.FullName?.EndsWith(".DocumentationHelperTool") == true);
|
||||||
|
if (t != null)
|
||||||
|
{
|
||||||
|
helperType = t;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ReflectionTypeLoadException rtlex)
|
||||||
|
{
|
||||||
|
_logger.LogDebug(rtlex, "Could not enumerate types in {Assembly}", asm.GetName().Name);
|
||||||
|
foreach (var loaderEx in rtlex.LoaderExceptions ?? Array.Empty<Exception>())
|
||||||
|
_logger.LogDebug(loaderEx, "Loader exception for {Assembly}", asm.GetName().Name);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogDebug(ex, "Failed enumerating types in {Assembly}", asm.GetName().Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (helperType == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("DocumentationHelperTool type not found in loaded assemblies.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("DocumentationHelperTool found: {Type} in {Assembly} ({Location})",
|
||||||
|
helperType.FullName, helperType.Assembly.GetName().Name, SafeLocation(helperType.Assembly));
|
||||||
|
|
||||||
|
var method = helperType.GetMethod("GenerateDocumentation",
|
||||||
|
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
|
||||||
|
if (method == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("GenerateDocumentation method not found on {Type}.", helperType.FullName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var parameters = string.Join(", ",
|
||||||
|
method.GetParameters().Select(p => p.ParameterType.Name + " " + p.Name));
|
||||||
|
_logger.LogInformation("Method: {Name} ({Parameters}) -> {ReturnType}", method.Name, parameters,
|
||||||
|
method.ReturnType.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Failed to inspect DocumentationHelperTool type/method.");
|
||||||
|
}
|
||||||
|
|
||||||
|
static string SafeLocation(Assembly a)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return string.IsNullOrEmpty(a.Location) ? "<in-memory>" : a.Location;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return "<unknown>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private LibraryDocumentationViewModel GenerateLibraryDocs(Assembly assembly, string changelogPath,
|
||||||
|
string displayName, string description, string nugetPackageId, bool generateForDocumentationAssembly = false)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("=== Starting GenerateLibraryDocs for {Assembly} ===", assembly.GetName().Name);
|
||||||
|
_logger.LogInformation("Assembly location: {Location}", assembly.Location ?? "<in-memory>");
|
||||||
|
_logger.LogInformation("Changelog path: {Path}", changelogPath);
|
||||||
|
_logger.LogInformation("Changelog exists: {Exists}", System.IO.File.Exists(changelogPath));
|
||||||
|
|
||||||
|
// Log types in assembly and their attributes
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var types = assembly.GetTypes();
|
||||||
|
_logger.LogInformation("Assembly {Name} contains {Count} types", assembly.GetName().Name, types.Length);
|
||||||
|
|
||||||
|
var typesWithDocAttr = types.Where(t =>
|
||||||
|
t.GetCustomAttributes().Any(a =>
|
||||||
|
a.GetType().Name.Contains("Documentation", StringComparison.OrdinalIgnoreCase)))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
_logger.LogInformation("Found {Count} types with DocumentationAttribute-like attributes",
|
||||||
|
typesWithDocAttr.Count);
|
||||||
|
|
||||||
|
if (typesWithDocAttr.Any())
|
||||||
|
{
|
||||||
|
foreach (var type in typesWithDocAttr.Take(5))
|
||||||
|
{
|
||||||
|
_logger.LogInformation(" Type with doc attr: {TypeName}", type.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Failed to inspect assembly types");
|
||||||
|
}
|
||||||
|
|
||||||
|
LogDocumentationHelperInfo();
|
||||||
|
|
||||||
|
IEnumerable<DocumentationStructure> allDocumentation = Enumerable.Empty<DocumentationStructure>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Pass the specific assembly to only scan that assembly
|
||||||
|
var result = DocumentationHelperTool.GenerateDocumentation(generateForDocumentationAssembly);
|
||||||
|
allDocumentation = result?
|
||||||
|
.Where(d => d.AssemblyName?.Equals(assembly.GetName().Name ,StringComparison.OrdinalIgnoreCase) == true)
|
||||||
|
.ToList() ?? Enumerable.Empty<DocumentationStructure>();
|
||||||
|
|
||||||
|
_logger.LogInformation("GenerateDocumentation returned {Count} items for {Assembly}",
|
||||||
|
allDocumentation.Count(), assembly.GetName().Name);
|
||||||
|
|
||||||
|
if (!allDocumentation.Any())
|
||||||
|
{
|
||||||
|
_logger.LogWarning(
|
||||||
|
"No documentation items generated for {Assembly}. Check if types have [Documentation] attribute applied.",
|
||||||
|
assembly.GetName().Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (MissingMethodException mmex)
|
||||||
|
{
|
||||||
|
_logger.LogError(mmex,
|
||||||
|
"Missing method when calling DocumentationHelperTool.GenerateDocumentation(). Possible assembly mismatch.");
|
||||||
|
InspectDocumentationHelperMethod();
|
||||||
|
ExceptionDispatchInfo.Capture(mmex).Throw();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "DocumentationHelperTool.GenerateDocumentation threw an exception.");
|
||||||
|
InspectDocumentationHelperMethod();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*var changelogMarkdown = string.Empty;
|
||||||
if (System.IO.File.Exists(changelogPath))
|
if (System.IO.File.Exists(changelogPath))
|
||||||
{
|
{
|
||||||
changelogMarkdown = ChangelogTool.GetMarkdown(assembly);
|
try
|
||||||
|
{
|
||||||
|
ChangelogTool.ExtractChangelog(assembly);
|
||||||
|
changelogMarkdown = ChangelogTool.GetMarkdown(assembly);
|
||||||
|
_logger.LogInformation("Parsed changelog for {Assembly}", assembly.GetName().Name);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Failed to parse changelog at {Path}", changelogPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
string version = assembly.GetCustomAttribute<System.Reflection.AssemblyInformationalVersionAttribute>()?.InformationalVersion
|
|
||||||
?? assembly.GetName().Version?.ToString()
|
|
||||||
?? "1.0.0";
|
|
||||||
|
|
||||||
if (version.Contains('+'))
|
|
||||||
{
|
{
|
||||||
version = version.Substring(0, version.IndexOf('+'));
|
_logger.LogWarning("Changelog file not found at {Path}", changelogPath);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return new LibraryDocumentationViewModel
|
var viewModel = new LibraryDocumentationViewModel
|
||||||
{
|
{
|
||||||
LibraryName = displayName,
|
LibraryName = displayName,
|
||||||
Description = description,
|
Description = description,
|
||||||
Version = version,
|
|
||||||
NuGetPackageId = nugetPackageId,
|
NuGetPackageId = nugetPackageId,
|
||||||
Documentation = filteredDocumentation,
|
ChangelogMarkdown = ChangelogHelper.GetChangelogMarkdown(new []{assembly}),
|
||||||
ChangelogMarkdown = changelogMarkdown
|
Documentation = allDocumentation.ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"=== Completed GenerateLibraryDocs for {Assembly}. Total documentation items: {Count} ===",
|
||||||
|
assembly.GetName().Name, viewModel.Documentation.Count);
|
||||||
|
|
||||||
|
return viewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string GetSolutionRoot()
|
static string GetSolutionRoot()
|
||||||
{
|
{
|
||||||
string dir = AppContext.BaseDirectory;
|
return 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.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
// File: `OmegaLeo.HelperLib.Web/Models/LibraryDocumentationViewModel.cs`
|
// File: `OmegaLeo.HelperLib.Web/Models/LibraryDocumentationViewModel.cs`
|
||||||
using NetFlow.DocumentationHelper.Library.Models;
|
using OmegaLeo.HelperLib.Documentation.Models;
|
||||||
|
|
||||||
namespace OmegaLeo.HelperLib.Web.Models
|
namespace OmegaLeo.HelperLib.Web.Models
|
||||||
{
|
{
|
||||||
|
|||||||
Regular → Executable
+4
-1
@@ -15,7 +15,10 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Markdig" Version="0.40.0" />
|
<PackageReference Include="Markdig" Version="0.40.0" />
|
||||||
<PackageReference Include="NetFlow.DocumentationHelper.Library" Version="1.1.2" />
|
<PackageReference Include="MarkdigExtensions.SyntaxHighlighting" Version="1.0.3" />
|
||||||
|
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Regular → Executable
+15
@@ -1,8 +1,23 @@
|
|||||||
|
using Serilog;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
|
// Configure logging
|
||||||
|
// Configure Serilog
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.MinimumLevel.Information()
|
||||||
|
.WriteTo.Console()
|
||||||
|
.WriteTo.File(
|
||||||
|
path: Path.Combine(AppContext.BaseDirectory, "logs", "documentation-.txt"),
|
||||||
|
rollingInterval: RollingInterval.Day,
|
||||||
|
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}")
|
||||||
|
.CreateLogger();
|
||||||
|
|
||||||
|
builder.Host.UseSerilog();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
+16
-1
@@ -1,8 +1,16 @@
|
|||||||
@* File: `OmegaLeo.HelperLib.Web/Views/Home/Library.cshtml` *@
|
@* File: `OmegaLeo.HelperLib.Web/Views/Home/Library.cshtml` *@
|
||||||
|
@using ColorCode.Styling
|
||||||
|
@using OmegaLeo.HelperLib.Extensions
|
||||||
|
@using Markdig
|
||||||
@model OmegaLeo.HelperLib.Web.Models.LibraryDocumentationViewModel
|
@model OmegaLeo.HelperLib.Web.Models.LibraryDocumentationViewModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = Model.LibraryName;
|
ViewData["Title"] = Model.LibraryName;
|
||||||
var groupedByNamespace = Model.Documentation.GroupBy(d => d.AssemblyName).OrderBy(g => g.Key);
|
var groupedByNamespace = Model.Documentation.GroupBy(d => d.AssemblyName).OrderBy(g => g.Key);
|
||||||
|
|
||||||
|
var pipeline = new MarkdownPipelineBuilder()
|
||||||
|
.UseAdvancedExtensions()
|
||||||
|
.UseSyntaxHighlighting(StyleDictionary.DefaultDark)
|
||||||
|
.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="container-fluid mt-4">
|
<div class="container-fluid mt-4">
|
||||||
@@ -75,7 +83,14 @@
|
|||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>@desc.Title</code></td>
|
<td><code>@desc.Title</code></td>
|
||||||
<td>@Html.Raw(desc.Description)</td>
|
<td>@Html.Raw(Markdig.Markdown.ToHtml(desc.Description))<br/>
|
||||||
|
@if (desc.CodeExample.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
<strong>Example:</strong><br/>
|
||||||
|
<div class="example-code mb-2">
|
||||||
|
@Html.Raw(Markdig.Markdown.ToHtml(desc.CodeExample, pipeline))
|
||||||
|
</div>
|
||||||
|
}</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
+14
-6
@@ -33,6 +33,20 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Library" asp-route-id="game">Game Dev</a>
|
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Library" asp-route-id="game">Game Dev</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Library" asp-route-id="documentation">Documentation</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Library" asp-route-id="shared">Shared Components</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://github.com/omegaleo/HelperLib" target="_blank" rel="noopener noreferrer" aria-label="GitHub repository">
|
||||||
|
<i class="bi bi-github" style="font-size:1.25rem;"></i> View on Github
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,12 +56,6 @@
|
|||||||
@RenderBody()
|
@RenderBody()
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="border-top footer text-muted">
|
|
||||||
<div class="container">
|
|
||||||
© @DateTime.Now.Year - OmegaLeo Helper Libraries
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+2
-1
@@ -5,5 +5,6 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"https_port": 443
|
||||||
}
|
}
|
||||||
|
|||||||
Regular → Executable
+18
@@ -19,4 +19,22 @@ html {
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
margin-bottom: 60px;
|
margin-bottom: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
overflow: auto;
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: #495057;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example-code > div {
|
||||||
|
border-radius: 0.5rem !important;
|
||||||
|
background-color: #495057 !important;
|
||||||
}
|
}
|
||||||
Regular → Executable
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Regular → Executable
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Vendored
Regular → Executable
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user