using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("ProdUnsharedUtils")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+db5cea4206c67eca44afd401cf3f9e1e59b52722")]
[assembly: AssemblyProduct("ProdUnsharedUtils")]
[assembly: AssemblyTitle("ProdUnsharedUtils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public static class Patcher
{
public const string GUID = "_com.ProdUnsharedUtils";
public static ManualLogSource Log;
public static IEnumerable<string> TargetDLLs { get; } = new string[0];
public static void Initialize()
{
Log = Logger.CreateLogSource("_com.ProdUnsharedUtils");
string text = Paths.PatcherPluginPath + "/prodzpod-ProdzpodSpikestripContent";
string text2 = Paths.PluginPath + "/SpikestripModding-Spikestrip2_0";
if (!Directory.Exists(text2))
{
Log.LogWarning((object)"Spikestrip does not exist.");
return;
}
string[] source = Directory.GetFiles(text).Select(Path.GetFileName).ToArray();
string[] array = Directory.GetFiles(text2).Select(Path.GetFileName).ToArray();
if (array.Contains("ProdzpodSpikestripContent.dll"))
{
Log.LogInfo((object)":3");
return;
}
string[] array2 = array;
foreach (string text3 in array2)
{
if (text3.StartsWith("MMHOOK"))
{
Log.LogInfo((object)("Deleting " + text3));
File.Delete(text3);
}
if (!source.Contains(text3 + ".xdelta"))
{
continue;
}
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.CreateNoWindow = false;
processStartInfo.UseShellExecute = false;
processStartInfo.FileName = Path.Combine(text, "xdelta.exe");
processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
processStartInfo.Arguments = "-f -d -s \"" + Path.Combine(text2, text3) + "\" \"" + Path.Combine(text, text3 + ".xdelta") + "\" \"" + Path.Combine(text2, "patched_" + text3) + "\"";
ProcessStartInfo startInfo = processStartInfo;
try
{
Log.LogInfo((object)("Patching " + text3));
using Process process = Process.Start(startInfo);
process.WaitForExit();
File.Delete(Path.Combine(text2, text3));
File.Move(Path.Combine(text2, "patched_" + text3), Path.Combine(text2, text3));
}
catch (Exception ex)
{
Log.LogError((object)ex);
}
}
Log.LogInfo((object)"Adding ProdzpodSpikestripContent.dll");
File.Copy(Path.Combine(text, "ProdzpodSpikestripContent.dll"), Path.Combine(text2, "ProdzpodSpikestripContent.dll"));
}
public static void Patch(AssemblyDefinition _)
{
}
}