Skip to content

Commit

Permalink
Changes and additions
Browse files Browse the repository at this point in the history
+Moved the ReflectionExtensions file to EXILED_Main extensions folder and renamed it to Reflection.
+Added Config extensions.
  • Loading branch information
iopietro committed Apr 27, 2020
1 parent 179df69 commit afe54fb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
5 changes: 2 additions & 3 deletions EXILED_Events/EXILED_Events.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<HintPath>..\References\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Assembly-CSharp_publicized.dll</HintPath>
<HintPath>..\References\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\References\Assembly-CSharp-firstpass.dll</HintPath>
Expand Down Expand Up @@ -245,7 +245,6 @@
<Compile Include="Patches\ShootEvents.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReflectionExtensions.cs" />
<Compile Include="ReloadCommandHandler.cs" />
</ItemGroup>
<ItemGroup>
Expand All @@ -255,7 +254,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Components" />
<Folder Include="Components\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
2 changes: 1 addition & 1 deletion EXILED_Idler/EXILED_Idler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\References\Assembly-CSharp_publicized.dll</HintPath>
<HintPath>..\References\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Mono.WebBrowser, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
<HintPath>..\References\Mono.WebBrowser.dll</HintPath>
Expand Down
6 changes: 4 additions & 2 deletions EXILED_Main/EXILED_Main.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<HintPath>..\References\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\References\Assembly-CSharp_publicized.dll</HintPath>
<HintPath>..\References\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\References\Mirror.dll</HintPath>
Expand Down Expand Up @@ -94,8 +94,10 @@
<Compile Include="ApiObjects\ZoneType.cs" />
<Compile Include="Attributes\SkipAutoHarmonyAttribute.cs" />
<Compile Include="Extensions\Cassie.cs" />
<Compile Include="Extensions\Config.cs" />
<Compile Include="Extensions\Map.cs" />
<Compile Include="Extensions\Player.cs" />
<Compile Include="Extensions\Reflection.cs" />
<Compile Include="Extensions\Scp079.cs" />
<Compile Include="Extensions\Scp914.cs" />
<Compile Include="LevenshteinDistance.cs" />
Expand All @@ -113,4 +115,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
25 changes: 25 additions & 0 deletions EXILED_Main/Extensions/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections.Generic;

namespace EXILED.Extensions
{
public static class Config
{
public static Dictionary<string, string> GetStringDictionary(this YamlConfig config, string key, Dictionary<string, string> defaultValue)
{
var dictionary = config.GetStringDictionary(key);

if (dictionary?.Count == 0) return defaultValue;

return dictionary;
}

public static List<string> GetStringList(this YamlConfig config, string key, List<string> defaultValue)
{
var list = config.GetStringList(key);

if (list?.Count == 0) return defaultValue;

return list;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Reflection;

namespace EXILED
namespace EXILED.Extensions
{
public static class ReflectionExtensions
public static class Reflection
{
public static void InvokeStaticMethod(this Type type, string methodName, object[] param)
{
Expand Down

0 comments on commit afe54fb

Please sign in to comment.