Projektdateien hinzufügen.
This commit is contained in:
20
ValehimModSync/AssemblyInfo1.cs
Normal file
20
ValehimModSync/AssemblyInfo1.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// In Projekten im SDK-Stil wie dem vorliegenden, bei dem verschiedene Assemblyattribute
|
||||
// üblicherweise in dieser Datei definiert wurden, werden diese Attribute jetzt während
|
||||
// der Builderstellung automatisch hinzugefügt und mit Werten aufgefüllt, die in den
|
||||
// Projekteigenschaften definiert sind. Informationen dazu, welche Attribute einbezogen
|
||||
// werden und wie dieser Prozess angepasst werden kann, finden Sie unter https://aka.ms/assembly-info-properties.
|
||||
|
||||
|
||||
// Wenn "ComVisible" auf FALSE festgelegt wird, sind die Typen in dieser Assembly
|
||||
// für COM-Komponenten nicht sichtbar. Wenn Sie von COM aus auf einen Typ in dieser
|
||||
// Assembly zugreifen müssen, legen Sie das ComVisible-Attribut für den betreffenden
|
||||
// Typ auf TRUE fest.
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM
|
||||
// bereitgestellt wird.
|
||||
|
||||
[assembly: Guid("376b28cd-26b6-454b-a231-4dcaac6fa23c")]
|
||||
97
ValehimModSync/EmbeddedAssembly.cs
Normal file
97
ValehimModSync/EmbeddedAssembly.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
public class EmbeddedAssembly
|
||||
{
|
||||
// Version 1.3
|
||||
|
||||
static Dictionary<string, Assembly> dic = null;
|
||||
|
||||
public static void Load(string embeddedResource, string fileName)
|
||||
{
|
||||
if (dic == null)
|
||||
dic = new Dictionary<string, Assembly>();
|
||||
|
||||
byte[] ba = null;
|
||||
Assembly asm = null;
|
||||
Assembly curAsm = Assembly.GetExecutingAssembly();
|
||||
|
||||
using (Stream stm = curAsm.GetManifestResourceStream(embeddedResource))
|
||||
{
|
||||
// Either the file is not existed or it is not mark as embedded resource
|
||||
if (stm == null)
|
||||
throw new Exception(embeddedResource + " is not found in Embedded Resources.");
|
||||
|
||||
// Get byte[] from the file from embedded resource
|
||||
ba = new byte[(int)stm.Length];
|
||||
stm.Read(ba, 0, (int)stm.Length);
|
||||
try
|
||||
{
|
||||
asm = Assembly.Load(ba);
|
||||
|
||||
// Add the assembly/dll into dictionary
|
||||
dic.Add(asm.FullName, asm);
|
||||
return;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Purposely do nothing
|
||||
// Unmanaged dll or assembly cannot be loaded directly from byte[]
|
||||
// Let the process fall through for next part
|
||||
}
|
||||
}
|
||||
|
||||
bool fileOk = false;
|
||||
string tempFile = "";
|
||||
|
||||
using (SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider())
|
||||
{
|
||||
string fileHash = BitConverter.ToString(sha1.ComputeHash(ba)).Replace("-", string.Empty); ;
|
||||
|
||||
tempFile = Path.GetTempPath() + fileName;
|
||||
|
||||
if (File.Exists(tempFile))
|
||||
{
|
||||
byte[] bb = File.ReadAllBytes(tempFile);
|
||||
string fileHash2 = BitConverter.ToString(sha1.ComputeHash(bb)).Replace("-", string.Empty);
|
||||
|
||||
if (fileHash == fileHash2)
|
||||
{
|
||||
fileOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fileOk = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fileOk = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileOk)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(tempFile, ba);
|
||||
}
|
||||
|
||||
asm = Assembly.LoadFile(tempFile);
|
||||
|
||||
dic.Add(asm.FullName, asm);
|
||||
}
|
||||
|
||||
public static Assembly Get(string assemblyFullName)
|
||||
{
|
||||
if (dic == null || dic.Count == 0)
|
||||
return null;
|
||||
|
||||
if (dic.ContainsKey(assemblyFullName))
|
||||
return dic[assemblyFullName];
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
BIN
ValehimModSync/Lib/0Harmony.dll
Normal file
BIN
ValehimModSync/Lib/0Harmony.dll
Normal file
Binary file not shown.
BIN
ValehimModSync/Lib/BepInEx.dll
Normal file
BIN
ValehimModSync/Lib/BepInEx.dll
Normal file
Binary file not shown.
BIN
ValehimModSync/Lib/Ionic.Zip.Unity.dll
Normal file
BIN
ValehimModSync/Lib/Ionic.Zip.Unity.dll
Normal file
Binary file not shown.
BIN
ValehimModSync/Lib/Newtonsoft.Json.dll
Normal file
BIN
ValehimModSync/Lib/Newtonsoft.Json.dll
Normal file
Binary file not shown.
BIN
ValehimModSync/Lib/System.Data.dll
Normal file
BIN
ValehimModSync/Lib/System.Data.dll
Normal file
Binary file not shown.
BIN
ValehimModSync/Lib/System.Runtime.Serialization.dll
Normal file
BIN
ValehimModSync/Lib/System.Runtime.Serialization.dll
Normal file
Binary file not shown.
BIN
ValehimModSync/Lib/UnityEngine.CoreModule.dll
Normal file
BIN
ValehimModSync/Lib/UnityEngine.CoreModule.dll
Normal file
Binary file not shown.
BIN
ValehimModSync/Lib/UnityEngine.dll
Normal file
BIN
ValehimModSync/Lib/UnityEngine.dll
Normal file
Binary file not shown.
BIN
ValehimModSync/Lib/assembly_valheim.dll
Normal file
BIN
ValehimModSync/Lib/assembly_valheim.dll
Normal file
Binary file not shown.
1028
ValehimModSync/ValheimModSync.cs
Normal file
1028
ValehimModSync/ValheimModSync.cs
Normal file
File diff suppressed because it is too large
Load Diff
56
ValehimModSync/ValheimModSync.csproj
Normal file
56
ValehimModSync/ValheimModSync.csproj
Normal file
@@ -0,0 +1,56 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>ValheimModSync</AssemblyName>
|
||||
<Description>Plugin for the Valheim Mod Sync Client. More information under https://tbs-server.de</Description>
|
||||
<Version>1.0.0.5</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>Valheim Mod Sync Plugin</PackageId>
|
||||
<Authors>Tobias Röhrich</Authors>
|
||||
<Company>tbs-server.de</Company>
|
||||
<Product>Valheim Mod Sync Plugin</Product>
|
||||
<Copyright>tbS-server.de</Copyright>
|
||||
<PackageProjectUrl>https://tbs-server.de</PackageProjectUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Lib\Ionic.Zip.Unity.dll" />
|
||||
<None Remove="Lib\Newtonsoft.Json.dll" />
|
||||
<None Remove="Lib\System.Data.dll" />
|
||||
<None Remove="Lib\System.Runtime.Serialization.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Lib\Ionic.Zip.Unity.dll" />
|
||||
<EmbeddedResource Include="Lib\Newtonsoft.Json.dll" />
|
||||
<EmbeddedResource Include="Lib\System.Data.dll" />
|
||||
<EmbeddedResource Include="Lib\System.Runtime.Serialization.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>Lib\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="assembly_valheim">
|
||||
<HintPath>Lib\assembly_valheim.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>Lib\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ionic.Zip.Unity">
|
||||
<HintPath>Lib\Ionic.Zip.Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>Lib\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>Lib\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>Lib\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user