Posts for category 'Software'

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)

.Net Configuration Section Documentation Generator

Today I'm releasing another small tool that I created for personal use that I believe others might find of use. The tool is the .Net Configuration Section Documentation Generator (more proof that I should not be put in charge of naming things), which does what it says on the tin: it generates documentation for configuration sections defined using .Net's ConfigurationSection class.

Basically, it can generate an XSD schema from a ConfigurationSection, to which you can then add annotations to document the elements and attributes of the section, and then generate an HTML documentation file from that schema. The tool can be used with Microsoft .Net and Mono.

As an example, check out the schema for the documentation generator's own configuration section as generated by the documentation generator, and with added annotations. And finally, the documentation file generated from the annotated schema. This is only a very trivial configuration section, but it gives you an idea of what the output of the documentation generator looks like.

More information and downloads here.

Categories: Software, Programming
Posted on: 2013-06-08 10:42 UTC. Show comments (1)

Ookii.CommandLine 2.2

Yes, I realise this blog is all but dead. However, I will soon finally complete my Ph.D. at the University of Tokyo (so, yay me!), and as a result I can now finally release a few things that had been put on hold while I was writing my Ph.D. thesis. In addition, I will probably release a few projects related to my research that may hopefully be of interest to some people.

First up is a small update to Ookii.CommandLine. This update adds command line argument aliases, some updates for usage help generation, and code snippets to help with creating argument classes.

In addition, I used NuGet to create a symbols package and published it on SymbolSource, which you should apparently be able to use as a symbol server in Visual Studio without manually downloading the symbols.

Get the release from CodePlex or using NuGet.

Categories: Software, Programming
Posted on: 2013-02-06 12:11 UTC. Show comments (0)

FormatC 2.0 (syntax highlighting) now available

With the release of .Net 4.0 I have updated the FormatC syntax highlighter (used for all code samples on ookii.org) to support new keywords introduced in Visual Basic 10.0 and C# 4.0.

That's not the only update, however. FormatC 2.0 also has the ability to escape contextual keywords (previously, it would treat them as keywords regardless of the context), type name highlighting support for Visual Basic and improved XML literal support in Visual Basic.

PowerShell support is also improved; FormatC will try to use the parser included with PowerShell 2.0 to parse the code. Unfortunately, this web server does not have PowerShell 2.0 installed, so the online version of the highlighter will still use regular expressions to highlight PowerShell code.

If you have any feedback about FormatC, please leave it as a comment on this blog post.

Sample C# code highlighted using FormatC:

public static int SumAuthorPrices(IEnumerable<Book> books, string author)
{
    if( books == null )
        throw new ArgumentNullException("books");

    return (from b in books
            where b.Author == author
            select b.Price).Sum();
}

Sample Visual Basic code highlighted using FormatC:

Public Shared Function ConvertToXml(ByVal books As IEnumerable(Of Book)) As XDocument
    If books Is Nothing Then
        Throw New ArgumentNullException("books")
    End If

    Return <?xml version="1.0"?>
           <Books>
               <%= From b In Books
                   Select <Book Author=<%= b.Author %> Price=<%= b.Price %>>
                              <%= b.Title %>
                          </Book> %>
           </Books>
End Function

Sample XML code highlighted using FormatC:

<?xml version="1.0"?>
<Books>
  <Book Author="Peter F. Hamilton" Price="18.99">
    The Evolutionary Void
  </Book>
</Books>

Sample T-SQL code highlighted using FormatC:

SELECT title, author, publisherName FROM Books b
  INNER JOIN Publisher p
  ON b.publisherId = p.id
WHERE b.price >= 10

Sample PowerShell code highlighted using FormatC (this used the parser-based method, not regular expressions):

foreach ($file in Get-ChildItem)
{
    if ($file.Length -gt 100kb) 
    {
        Write-Host -ForegroundColor Green $file
        Write-Host $file.Length
        Write-Host $file.LastAccessTime
    }
}

Categories: Software, Programming
Posted on: 2010-08-07 05:23 UTC. Show comments (1)

Windows 7 ISO Verifier

Windows 7 is about to hit RTM, and many of you might want to verify that the ISO image you downloaded hasn't been tampered with or was damaged as the result of some error in the download process. Of course you can use existing checksum tools and compare the result to published values, but it can be a bit of a hassle.

At the request of Long Zheng I created a small application that makes this process easier. Simply drag and drop your ISO file onto the application (or start the application and browse to the ISO file) and it will verify the EXE and tell you which build you have from a list of known builds. It downloads this list from the web automatically, so you don't need to re-download the application after Windows 7 RTM is released.

The Windows 7 ISO Verifier can be downloaded from Long's website.

Categories: Software, General computing
Posted on: 2009-07-06 08:50 UTC. Show comments (4)

Latest posts

Categories

Archive

Syndication

RSS Subscribe

;