<commit_before>﻿using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace Squirrel
{
    public static class AssemblyExtensions
    {
        public static Process Restart(this Assembly assembly, string[] arguments = null)
        {
            return ProcessStart(assembly, assembly.Location, arguments);
        }

        public static Process ProcessStart(this Assembly assembly, string exeName, string[] arguments = null)
        {
            return Process.Start(getProcessStartInfo(assembly, exeName, arguments));
        }

        public static Process ProcessStart(this Assembly assembly, ProcessStartInfo psi)
        {
            psi.FileName = getUpdateExe(assembly);
            if (!string.IsNullOrEmpty(psi.Arguments))
            {
                psi.Arguments = string.Format("--process-start-args=\"{0}\"", string.Join(" ", psi.Arguments));
            }
            return Process.Start(psi);
        }

        public static ProcessStartInfo ProcessStartGetInfo(this Assembly assembly, string exeName, string[] arguments = null)
        {
            return getProcessStartInfo(assembly, exeName, arguments);
        }

        static ProcessStartInfo getProcessStartInfo(Assembly assembly, string exeName, string[] arguments)
        {
            var psi = new List<string>
            {
                string.Format("--process-start=\"{0}\"", exeName)
            };
            if (arguments != null && arguments.Length > 0)
            {
                psi.Add(string.Format("--process-start-args=\"{0}\"", string.Join(" ", arguments)));
            }
            return new ProcessStartInfo(getUpdateExe(assembly), string.Join(" ", psi));
        }<commit_msg>bugfix: rewrite filename to update.exe and pass along any additional arguments<commit_after>﻿using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace Squirrel
{
    public static class AssemblyExtensions
    {
        public static Process Restart(this Assembly assembly, string[] arguments = null)
        {
            return ProcessStart(assembly, assembly.Location, arguments);
        }

        public static Process ProcessStart(this Assembly assembly, string exeName, string[] arguments = null)
        {
            return Process.Start(getProcessStartInfo(assembly, exeName, arguments));
        }

        public static Process ProcessStart(this Assembly assembly, ProcessStartInfo psi)
        {
            var arguments = new List<string>
            {
                string.Format("--process-start=\"{0}\"", psi.FileName)
            };
            psi.FileName = getUpdateExe(assembly);
            if (!string.IsNullOrEmpty(psi.Arguments))
            {
                arguments.Add(string.Format("--process-start-args=\"{0}\"", string.Join(" ", psi.Arguments)));
            }
            psi.Arguments = string.Join(" ", arguments);
            return Process.Start(psi);
        }

        public static ProcessStartInfo ProcessStartGetInfo(this Assembly assembly, string exeName, string[] arguments = null)
        {
            return getProcessStartInfo(assembly, exeName, arguments);
        }

        static ProcessStartInfo getProcessStartInfo(Assembly assembly, string exeName, string[] arguments)
        {
            var psi = new List<string>
            {
                string.Format("--process-start=\"{0}\"", exeName)
            };
            if (arguments != null && arguments.Length > 0)
            {
                psi.Add(string.Format("--process-start-args=\"{0}\"", string.Join(" ", arguments)));
            }
            return new ProcessStartInfo(getUpdateExe(assembly), string.Join(" ", psi));
        }
{'fraction_non_alphanumeric': 0.10984042553191489, 'fraction_numerical': 0.0023936170212765957, 'mean_word_length': 2.2506482281763183, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '3292021', 'n_tokens_mistral': 938, 'n_tokens_neox': 915, 'n_words': 222}