Ookii.FormatC 2.3

After I recently released an updated version of Ookii.CommandLine, I figured Ookii.FormatC could also use some love.

This version comes with an optional new dark mode stylesheet, nullable reference types enabled for the library, the ability to write directly to a TextWriter, C# 10.0 keyword support, and a few minor other features and fixes.

Thanks to the ability to write to a TextWriter, you can now do stuff like this:

var formatter = new CodeFormatter()
    FormattingInfo = new CSharpFormattingInfo()

formatter.FormatCode(SampleCode, Console.Out);

Okay, writing HTML to the console is maybe not the most useful example, but you get the idea.

You can try it out with .Net Fiddle, or look at a sample that also shows the new dark mode in action. The online syntax highlighter has also been updated, and now supports PSParser based PowerShell formatting again.

And yeah, the NuGet package is version 2.3.1, rather than 2.3.0. That's because somehow the package for 2.3.0 ended up with an outdated binary in it. Not sure how that's possible, but it happened.

Categories: Software, Programming
Posted on: 2022-09-14 05:40 UTC. Show comments (0)

Ookii.CommandLine 2.4

I've released an update to Ookii.CommandLine, my library for parsing command line arguments for .Net.

This new version comes with nullable reference type support (for .Net 6+), a new helper to make parsing easier, more customizability, an easier way to make -Help style arguments, and some bug fixes.

See the full list of changes here.

With the new helper method, you can now just do the following to parse the arguments and write errors and usage to the console if parsing failed:

var parsed = CommandLineParser.Parse<MyArguments>(args);

And if you want to customize parsing behavior, you can still do so with this method:

var options = new ParseOptions()
    NameValueSeparator = '='

var parsed = CommandLineParser.Parse<MyArguments>(args, options);

Of course, existing code to parse arguments that manually creates an instance of CommandLineParser will continue to work.

Check it out on NuGet or GitHub, or try it out online!

Also, the Visual Studio code snippets (which previously required manual installation) are now available on the Visual Studio marketplace.

Categories: Software, Programming
Posted on: 2022-09-06 03:05 UTC. Show comments (0)

Some small site updates

I know I don't exactly do much with this site anymore, but I did recently make some small changes.

Primarily, I've reorganized some of the outdated content (like the stuff related to Channel 9) so it's less prominent. I've also updated the information for Ookii.Dialogs to link to the forked project on GitHub. My own version isn't kept up to date, so most people looking for Ookii.Dialogs should probably be using that version instead (the people who are doing this are awesome, by the way, for keeping this project alive).

Oh, and the site now supports https, thanks to Azure's free SSL/TLS certificates.

Categories: Site news
Posted on: 2022-08-25 19:56 UTC. Show comments (0)

A new home for now has a new home! It's the same site as always, except now it's hosted on Microsoft Azure. This shouldn't make any difference for you, and it probably won't mean this blog will get any more active, but all the existing content is still there.

Categories: Site news
Posted on: 2017-06-30 00:17 UTC. Show comments (0)

Comments are now closed

Due to the very large volume of spam comments this site receives despite efforts on my part to block them (recaptcha is apparently completely useless), I'm unfortunately forced to disable comments on all posts on this site.

If you wish to contact me about anything pertaining to this site, please use Twitter instead.

I apologize for the inconvenience.

Categories: Site news
Posted on: 2014-09-27 20:35 UTC. Show comments (0)

Latest posts




RSS Subscribe