💾 Archived View for mfgames.com › blog › 2024 › 06 › 01 › nitride-icalendar captured on 2024-08-31 at 11:53:38. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-06-16)

-=-=-=-=-=-=-

Create iCalendar Files with Nitride (MfGames .NET Libraries)

Up a Level

One of the more useful features in previous versions of Dylan's[1] static site generators was the ability to create an iCalendar file of the posts, both past and future. It wasn't only just to see little entries pop up for the dopamine rush, but also to give them a head's up when a new chapter for Fedran[2] needs to be written or its been a few months since a blog post has been written.

1: //d.moonfire.us

2: //fedran.com

We use iCalendar because it's a solid standard format that can easily be added into Nextcloud, put on a phone, or otherwise used anywhere to keep it in mind.

(Technicaly, it could also be used to create task lists for sites that are missing links or other things but out of scope for this iteration).

We put this into the `MfGames.Nitride.Temporal` even though it adds an extra dependency (Ical.Net[3]) because it is a relatively small feature and it hit that ratio of package management verses three additional classes. Like the rest of the temporal packages, this built to use Noda.Time[4] for coordinating times.

3: https://github.com/rianjs/ical.net

4: https://nodatime.org/

The documentation[5] has some notes on how to include and use it inside a Nitride project.

5: //mfgames.com/mfgames-cil/docs/nitride/temporal/

New Entity Constructor

We also added new constructor to `MfGames.Gallium.Entity` that allows multiple components to be set as part of the constructor.

// These are all the same.
var entity1 = new Entity();
entity1 = entity1.Add("bob");
entity1 = entity1.Add(13);

var entity2 = new Entity().Add("bob").Add(13);

var entity3 = new Entity().SetAll("bob", 13);

// These are the new features.
var entity4 = new Entity("bob", 13);

var entity5 = new Entity(13, "bob");

It seemed like a no-brainer, mainly because it is a pattern we use a lot in the code, but Dylan finds that the formatting is less than “pretty” when it comes to multi-line chaining operations.

var notPretty = new Entity(
    "bob",
    13,
    instant,
    path)
    .AddTextContent(content);

var pretty = new Entity()
    .SetAll(
        "bob",
        13,
        instant,
        path)
    .AddTextContent(content);

Either work though, so it will end up reducing some of the clutter for common use cases.

Metadata

Categories:

MfGames .NET Libraries

Footer

Below are various useful links within this site and to related sites (not all have been converted over to Gemini).

Categories

D. Moonfire

Fedran

The Moonfires

HTML