<commit_before>﻿using System;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;

namespace dynamixelServo.Quadruped.WebInterface
{
    public class Program
    {
        public static void Main(string[] args)
        {
            SaveCorrectDxlLibrary();
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration((context, builder) =>
                {
                    builder
                        .SetBasePath(Directory.GetCurrentDirectory())
                        .AddJsonFile("QuadrupedConfig.json");
                })
                .UseStartup<Startup>()
                .Build();

        private const string DxlLib = "dxl_lib.ds";

        private static void SaveCorrectDxlLibrary()
        {
            // This is an extremly ugly way to load the correct library for dynamixel
            // TODO: figure out a better way
            Console.ForegroundColor = ConsoleColor.Yellow;
            var architecture = RuntimeInformation.OSArchitecture;
            Console.WriteLine($"Current architecture {architecture}");
            if (architecture == Architecture.Arm || architecture == Architecture.Arm64)
            {
                const string newFileName = "libdxl_sbc_c.so";
                Console.WriteLine($"Saving library as {newFileName}");
                File.Copy(newFileName, DxlLib, true);
            }
            else if (architecture == Architecture.X64)
            {
                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))<commit_msg>Use url config in builder because it's easier to use than config<commit_after>﻿using System;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;

namespace dynamixelServo.Quadruped.WebInterface
{
    public class Program
    {
        public static void Main(string[] args)
        {
            SaveCorrectDxlLibrary();
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration((context, builder) =>
                {
                    builder
                        .SetBasePath(Directory.GetCurrentDirectory())
                        .AddJsonFile("QuadrupedConfig.json");
                })
                .UseStartup<Startup>()
                .UseUrls("http://0.0.0.0:50093/")
                .Build();

        private const string DxlLib = "dxl_lib.ds";

        private static void SaveCorrectDxlLibrary()
        {
            // This is an extremly ugly way to load the correct library for dynamixel
            // TODO: figure out a better way
            Console.ForegroundColor = ConsoleColor.Yellow;
            var architecture = RuntimeInformation.OSArchitecture;
            Console.WriteLine($"Current architecture {architecture}");
            if (architecture == Architecture.Arm || architecture == Architecture.Arm64)
            {
                const string newFileName = "libdxl_sbc_c.so";
                Console.WriteLine($"Saving library as {newFileName}");
                File.Copy(newFileName, DxlLib, true);
            }
            else if (architecture == Architecture.X64)
            {
                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{'fraction_non_alphanumeric': 0.08770469053566472, 'fraction_numerical': 0.004718290313627533, 'mean_word_length': 1.9735973597359735, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '5037053', 'n_tokens_mistral': 907, 'n_tokens_neox': 857, 'n_words': 201}