57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using VRage.Plugins;
|
||
using SpaceEngineers;
|
||
using System.IO;
|
||
using System.Reflection;
|
||
|
||
namespace UplinkLauncher;
|
||
|
||
internal static class UplinkLauncher
|
||
{
|
||
public static readonly string PluginsLocalDir = "Plugins\\Local";
|
||
public static void Main(string[] args)
|
||
{
|
||
try
|
||
{
|
||
List<string> plugins = new List<string>();
|
||
|
||
if (!Directory.Exists(PluginsLocalDir))
|
||
Directory.CreateDirectory(PluginsLocalDir);
|
||
string[] localPlugins = Directory.GetFiles(
|
||
PluginsLocalDir, "*.dll", SearchOption.AllDirectories);
|
||
|
||
foreach (string plugin in localPlugins)
|
||
{
|
||
plugins.Add(Path.GetFullPath(plugin));
|
||
}
|
||
|
||
MyPlugins.RegisterUserAssemblyFiles(plugins);
|
||
|
||
string appIdFile = "steam_appid.txt";
|
||
if (!File.Exists(appIdFile))
|
||
{
|
||
File.WriteAllText(appIdFile, "244850");
|
||
}
|
||
|
||
//Абсолютно великий код который делает чтобы Аплинк скопировал себе .config от инжей. Я не знаю, что такое .config, но там какие-то зависимости некие и настройки
|
||
string UplinkConfig = Path.GetFileName(Assembly.GetExecutingAssembly().Location) + ".config";
|
||
if (File.Exists("SpaceEngineers.exe.config"))
|
||
{
|
||
File.Copy("SpaceEngineers.exe.config", UplinkConfig, true);
|
||
}
|
||
|
||
StartSpaceEngineers(args);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
|
||
}
|
||
}
|
||
|
||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||
private static void StartSpaceEngineers(string[] args)
|
||
{
|
||
MyProgram.Main(args);
|
||
}
|
||
} |