Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit ed2b284

Browse files
committed
Update Mod Dependecies
1 parent 251d6af commit ed2b284

4 files changed

Lines changed: 14 additions & 47 deletions

File tree

ModLoader/Loader.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ private void Start()
7474
catch (Exception e)
7575
{
7676
Debug.LogException(e);
77-
this._modList.Remove(mod.ModId);
7877
}
7978
}
8079
this.postloading();
@@ -170,20 +169,21 @@ private Dictionary<string, SFSMod> getModList()
170169
/// </summary>
171170
/// <param name="dependencies"> list of dependecies that you need to load first</param>
172171
/// <returns> true if all dependecies have been loaded </returns>
173-
private bool loadDependencies(SFSModDependencie[] dependencies)
172+
private bool loadDependencies(Dictionary<string, string[]> dependencies)
174173
{
174+
175175
// for each mod dependencie
176-
foreach(SFSModDependencie dependencie in dependencies)
176+
foreach (var item in dependencies)
177177
{
178178
// exist mod in the list?
179-
if (this._modList.ContainsKey(dependencie.ModId))
179+
if (this._modList.ContainsKey(item.Key))
180180
{
181181
// get mod dependecie
182-
SFSMod dependencieMod = this._modList[dependencie.ModId];
182+
SFSMod dependencieMod = this._modList[item.Key];
183183

184184
// verify if the dependencie version is the same that mod need
185185
bool versionFlag = false;
186-
foreach(string version in dependencie.Versions)
186+
foreach(string version in item.Value)
187187
{
188188
if(verifyVersion(dependencieMod.Version, version))
189189
{
@@ -201,7 +201,7 @@ private bool loadDependencies(SFSModDependencie[] dependencies)
201201
}
202202
}
203203
// dependencie not exist or is diferent version
204-
throw new Exception("Is necesary install " + dependencie.ModId +" "+ string.Join(", ", dependencie.Versions));
204+
throw new Exception("Is necesary install " + item.Key +" "+ string.Join(", ", item.Value));
205205
}
206206
return true;
207207
}

ModLoader/ModLoader.csproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
<WarningLevel>4</WarningLevel>
3535
</PropertyGroup>
3636
<ItemGroup>
37-
<Reference Include="0Harmony, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
38-
<HintPath>..\packages\Lib.Harmony.2.2.0\lib\net45\0Harmony.dll</HintPath>
39-
<Private>True</Private>
40-
</Reference>
4137
<Reference Include="Assembly-CSharp">
4238
<HintPath>..\Dependencies\Assembly-CSharp.dll</HintPath>
4339
<Private>True</Private>
@@ -91,7 +87,6 @@
9187
<Compile Include="Patcher.cs" />
9288
<Compile Include="Properties\AssemblyInfo.cs" />
9389
<Compile Include="SFSMod.cs" />
94-
<Compile Include="SFSModDependencie.cs" />
9590
</ItemGroup>
9691
<ItemGroup>
9792
<None Include="packages.config" />
@@ -104,11 +99,12 @@
10499
</PropertyGroup>
105100
<Error Condition="!Exists('..\packages\ILMerge.3.0.41\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILMerge.3.0.41\build\ILMerge.props'))" />
106101
</Target>
107-
108102
<ItemGroup>
109103
<PackageReference Include="ILMerge" Version="3.0.29" />
104+
<PackageReference Include="Lib.Harmony">
105+
<Version>2.2.0</Version>
106+
</PackageReference>
110107
</ItemGroup>
111-
112108
<Target Name="ILMerge">
113109
<!-- the ILMergePath property points to the location of ILMerge.exe console application -->
114110
<Exec Command="$(ILMergeConsolePath) /out:bin/Release/ModLoaderMac.dll bin/Release/0Harmony.dll bin/Release/ModLoader.dll" />

ModLoader/SFSMod.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using UnityEngine;
45

@@ -16,7 +17,7 @@ public abstract class SFSMod
1617
private string _modLoderVersion;
1718
private string _version;
1819
private string _description;
19-
private SFSModDependencie[] _dependencies;
20+
private Dictionary<string, string[]> _dependencies;
2021
private AssetBundle _assets;
2122
private string _assetsFilename;
2223

@@ -68,7 +69,7 @@ public string Description
6869
/// <summary>
6970
/// get the list of mods need it to work.
7071
/// </summary>
71-
public SFSModDependencie[] Dependencies
72+
public Dictionary<string, string[] > Dependencies
7273
{
7374
get { return this._dependencies; }
7475
}
@@ -82,7 +83,7 @@ public AssetBundle Assets
8283
}
8384

8485

85-
protected SFSMod(string id,string name, string author, string modLoderVersion, string version, string description = "", string assetsFilename = null , SFSModDependencie[] dependencies = null )
86+
protected SFSMod(string id,string name, string author, string modLoderVersion, string version, string description = "", string assetsFilename = null , Dictionary<string, string[]> dependencies = null )
8687
{
8788
_modId = id;
8889
_name = name;

ModLoader/SFSModDependencie.cs

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)