using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DefaultConfigs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DefaultConfigs")]
[assembly: AssemblyTitle("DefaultConfigs")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace DefaultConfigs
{
[BepInPlugin(".....root.configs.default", "Default Configs", "0.0.1")]
public class DefaultConfigs : BaseUnityPlugin
{
private const string ModId = ".....root.configs.default";
private const string ModName = "Default Configs";
public const string Version = "0.0.1";
public ConfigEntry<bool> force;
private void Awake()
{
force = ((BaseUnityPlugin)this).Config.Bind<bool>(".....root.configs.default", "force", false, "force update/reset of configs");
string path = Regex.Replace(Regex.Replace(typeof(DefaultConfigs).Assembly.Location, "\\\\(?:.(?!\\\\))+$", "", RegexOptions.None), "\\\\(?:.(?!\\\\))+$", "", RegexOptions.None);
string targetDir = Regex.Replace(Regex.Replace(Regex.Replace(typeof(DefaultConfigs).Assembly.Location, "\\\\(?:.(?!\\\\))+$", "", RegexOptions.None), "\\\\(?:.(?!\\\\))+$", "", RegexOptions.None), "\\\\(?:.(?!\\\\))+$", "", RegexOptions.None) + "\\config";
string[] directories = Directory.GetDirectories(path, ".", SearchOption.AllDirectories);
string[] array = directories;
foreach (string sourceDir in array)
{
Copy(sourceDir, targetDir);
}
}
private void Copy(string sourceDir, string targetDir)
{
Directory.CreateDirectory(targetDir);
string[] files = Directory.GetFiles(sourceDir);
foreach (string text in files)
{
if (!text.EndsWith(".cfg"))
{
continue;
}
try
{
File.Copy(text, Path.Combine(targetDir, Path.GetFileName(text)));
}
catch
{
if (force.Value)
{
try
{
File.Delete(Path.Combine(targetDir, Path.GetFileName(text)));
File.Copy(text, Path.Combine(targetDir, Path.GetFileName(text)));
}
catch
{
}
}
}
}
string[] directories = Directory.GetDirectories(sourceDir);
foreach (string text2 in directories)
{
Copy(text2, Path.Combine(targetDir, Path.GetFileName(text2)));
}
}
}
}