forked from Katalyst6/CSL.NetworkExtensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMod.cs
More file actions
99 lines (85 loc) · 3.09 KB
/
Mod.cs
File metadata and controls
99 lines (85 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ColossalFramework.IO;
using ColossalFramework.Steamworks;
using ICities;
using NetworkExtensions.Framework;
namespace NetworkExtensions
{
public partial class Mod : IUserMod
{
private const UInt64 WORKSHOP_ID = 478820060;
public const string NEXT_OBJECT_NAME = "Network Extensions";
public const string NEXT_CATEGORY_NAME = "Network Extensions";
public const string ROAD_NETCOLLECTION = "Road";
public const string NEWROADS_NETCOLLECTION = "NewRoad";
public string Name
{
get { return "Network Extensions"; }
}
public string Description
{
get { return "An addition of highways and roads"; }
}
public static string GetPath()
{
var localPath = DataLocation.modsPath + "/NetworkExtensions";
//Debug.Log("NExt: " + localPath);
if (Directory.Exists(localPath))
{
//Debug.Log("NExt: Local path exists, looking for assets here: " + localPath);
return localPath;
}
foreach (var mod in Steam.workshop.GetSubscribedItems())
{
if (mod.AsUInt64 == WORKSHOP_ID)
{
var workshopPath = Steam.workshop.GetSubscribedItemPath(mod);
//Debug.Log("NExt: Workshop path: " + workshopPath);
return workshopPath;
}
}
return ".";
}
private static IEnumerable<INetInfoBuilder> s_netInfoBuilders;
public static IEnumerable<INetInfoBuilder> NetInfoBuilders
{
get
{
if (s_netInfoBuilders == null)
{
var builderType = typeof(INetInfoBuilder);
s_netInfoBuilders = typeof(ModInitializer)
.Assembly
.GetTypes()
.Where(t => !t.IsAbstract && !t.IsInterface)
.Where(builderType.IsAssignableFrom)
.Select(t => (INetInfoBuilder)Activator.CreateInstance(t))
.ToArray();
}
return s_netInfoBuilders;
}
}
private static IEnumerable<INetInfoModifier> s_netInfoModifiers;
public static IEnumerable<INetInfoModifier> NetInfoModifiers
{
get
{
if (s_netInfoModifiers == null)
{
var builderType = typeof(INetInfoBuilder);
s_netInfoModifiers = typeof(ModInitializer)
.Assembly
.GetTypes()
.Where(t => !t.IsAbstract && !t.IsInterface)
.Where(builderType.IsAssignableFrom)
.Select(t => (INetInfoModifier)Activator.CreateInstance(t))
.ToArray();
}
return s_netInfoModifiers;
}
}
}
}