<commit_before>﻿using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Reflection;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using NLog;
using NLog.Fluent;
using NLog.Targets;
using Torch.Utils;

namespace Torch.Server
{
    internal static class Program
    {
        /// <remarks>
        /// This method must *NOT* load any types/assemblies from the vanilla game, otherwise automatic updates will fail.
        /// </remarks>
        [STAThread]
        public static void Main(string[] args)
        {
            
            
            Target.Register<FlowDocumentTarget>("FlowDocument");
            //Ensures that all the files are downloaded in the Torch directory.
            var workingDir = new FileInfo(typeof(Program).Assembly.Location).Directory.ToString();
            var binDir = Path.Combine(workingDir, "DedicatedServer64");
            Directory.SetCurrentDirectory(workingDir);

            //HACK for block skins update
            var badDlls = new[]
            {
                "System.Security.Principal.Windows.dll"
            };

            try
            {
                foreach (var file in badDlls)
                {
                    if (File.Exists(file))
                        File.Delete(file);
                }
            }
            catch
            {
                LogManager.GetCurrentClassLogger().Error($"Error updating. Please delete the following files from the Torch root folder manually:\r\n{string.Join("\r\n", badDlls)}");
                return;
            }

            if (!TorchLauncher.IsTorchWrapped())
            {
                TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args, binDir);
                return;
            }

            if (!Environment.UserInteractive)
            {
                using (var service = new TorchService())
                    ServiceBase.Run(service);
                return;
            }

            var initializer = new Initializer(workingDir);
            if (!initializer.Initialize(args))
                return;

            initializer.Run();
        }
    }
}<commit_msg>Automatically delete and replace steam_api.dll to fix weirdness<commit_after>﻿using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Reflection;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using NLog;
using NLog.Fluent;
using NLog.Targets;
using Torch.Utils;

namespace Torch.Server
{
    internal static class Program
    {
        /// <remarks>
        /// This method must *NOT* load any types/assemblies from the vanilla game, otherwise automatic updates will fail.
        /// </remarks>
        [STAThread]
        public static void Main(string[] args)
        {
            
            
            Target.Register<FlowDocumentTarget>("FlowDocument");
            //Ensures that all the files are downloaded in the Torch directory.
            var workingDir = new FileInfo(typeof(Program).Assembly.Location).Directory.ToString();
            var binDir = Path.Combine(workingDir, "DedicatedServer64");
            Directory.SetCurrentDirectory(workingDir);

            //HACK for block skins update
            var badDlls = new[]
            {
                "System.Security.Principal.Windows.dll",
                "steam_api64.dll"
            };

            try
            {
                foreach (var file in badDlls)
                {
                    if (File.Exists(file))
                        File.Delete(file);
                }
            }
            catch
            {
                LogManager.GetCurrentClassLogger().Error($"Error updating. Please delete the following files from the Torch root folder manually:\r\n{string.Join("\r\n", badDlls)}");
                return;
            }

            if (!TorchLauncher.IsTorchWrapped())
            {
                TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args, binDir);
                return;
            }

            if (!Environment.UserInteractive)
            {
                using (var service = new TorchService())
                    ServiceBase.Run(service);
                return;
            }

            var initializer = new Initializer(workingDir);
            if (!initializer.Initialize(args))
                return;

            initializer.Run();
        }
    }
}

{'fraction_non_alphanumeric': 0.09100925517849273, 'fraction_numerical': 0.0013221683561040105, 'mean_word_length': 1.6267361111111112, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4501980', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1116, 'n_words': 280}