<commit_before>using System;
using System.Xml;

namespace Imageflow.Bindings
{
    public class VersionInfo
    {
        private VersionInfo() { }
        internal static VersionInfo FromDynamic(dynamic versionInfo)
        {
            var info = new VersionInfo();
            string dateTime = versionInfo.build_date.Value;
            string longVersionString = versionInfo.long_version_string.Value;
            string lastGitCommit = versionInfo.last_git_commit.Value;
            bool dirtyWorkingTree = versionInfo.dirty_working_tree.Value;
            

            info.BuildDate = XmlConvert.ToDateTime(dateTime, XmlDateTimeSerializationMode.Utc);
            info.LongVersionString = longVersionString;
            info.LastGitCommit = lastGitCommit;
            info.DirtyWorkingTree = dirtyWorkingTree;<commit_msg>Make GetVersionInfo() work with newer versions of Newtonsoft.Json<commit_after>using System;
using System.Xml;

namespace Imageflow.Bindings
{
    public class VersionInfo
    {
        private VersionInfo() { }
        internal static VersionInfo FromDynamic(dynamic versionInfo)
        {
            var info = new VersionInfo();
            string longVersionString = versionInfo.long_version_string.Value;
            string lastGitCommit = versionInfo.last_git_commit.Value;
            bool dirtyWorkingTree = versionInfo.dirty_working_tree.Value;

            // Sometimes Newtonsoft gives us a DateTime, other times a string.
            object dateTime = versionInfo.build_date.Value;
            if (dateTime is string)
            {
                info.BuildDate = XmlConvert.ToDateTime(dateTime as string, XmlDateTimeSerializationMode.Utc);
            }
            else if (dateTime is DateTime)
            {
                info.BuildDate = new DateTimeOffset((dateTime as DateTime?).Value);
            }
            info.LongVersionString = longVersionString;
            info.LastGitCommit = lastGitCommit;
            info.DirtyWorkingTree = dirtyWorkingTree;
{'fraction_non_alphanumeric': 0.06464445549477872, 'fraction_numerical': 0.0, 'mean_word_length': 2.4275979557069847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5434544', 'n_tokens_mistral': 502, 'n_tokens_neox': 487, 'n_words': 114}