Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AssemblyDependencyResolver.cs
Go to the documentation of this file.
2using System.IO;
6using System.Text;
7
9
10[UnsupportedOSPlatform("android")]
11[UnsupportedOSPlatform("browser")]
14public sealed class AssemblyDependencyResolver
15{
17
18 private readonly string[] _nativeSearchPaths;
19
20 private readonly string[] _resourceSearchPaths;
21
22 private readonly string[] _assemblyDirectorySearchPaths;
23
25 {
26 if (componentAssemblyPath == null)
27 {
28 throw new ArgumentNullException("componentAssemblyPath");
29 }
30 string assemblyPathsList = null;
31 string nativeSearchPathsList = null;
32 string resourceSearchPathsList = null;
33 int num = 0;
35 try
36 {
37 Interop.HostPolicy.corehost_error_writer_fn corehost_error_writer_fn = delegate(string message)
38 {
39 errorMessage.AppendLine(message);
40 };
43 try
44 {
46 {
50 });
51 }
52 finally
53 {
55 GC.KeepAlive(corehost_error_writer_fn);
56 }
57 }
59 {
61 }
63 {
65 }
66 if (num != 0)
67 {
69 }
72 string[] array2 = array;
73 foreach (string text in array2)
74 {
76 }
80 }
81
83 {
84 if (assemblyName == null)
85 {
86 throw new ArgumentNullException("assemblyName");
87 }
88 string value;
89 if (!string.IsNullOrEmpty(assemblyName.CultureName) && !string.Equals(assemblyName.CultureName, "neutral", StringComparison.OrdinalIgnoreCase))
90 {
92 foreach (string path in resourceSearchPaths)
93 {
94 string text = Path.Combine(path, assemblyName.CultureName, assemblyName.Name + ".dll");
95 if (File.Exists(text))
96 {
97 return text;
98 }
99 }
100 }
101 else if (assemblyName.Name != null && _assemblyPaths.TryGetValue(assemblyName.Name, out value) && File.Exists(value))
102 {
103 return value;
104 }
105 return null;
106 }
107
109 {
110 if (unmanagedDllName == null)
111 {
112 throw new ArgumentNullException("unmanagedDllName");
113 }
117 {
118 string path = item.Prefix + unmanagedDllName + item.Suffix;
119 string[] array2 = array;
120 foreach (string path2 in array2)
121 {
122 string text = Path.Combine(path2, path);
123 if (File.Exists(text))
124 {
125 return text;
126 }
127 }
128 }
129 return null;
130 }
131
132 private static string[] SplitPathsList(string pathsList)
133 {
134 if (pathsList == null)
135 {
136 return Array.Empty<string>();
137 }
138 return pathsList.Split(Path.PathSeparator, StringSplitOptions.RemoveEmptyEntries);
139 }
140}
static int corehost_resolve_component_dependencies(string componentMainAssemblyPath, corehost_resolve_component_dependencies_result_fn result)
static IntPtr corehost_set_error_writer(IntPtr errorWriter)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
bool TryAdd(TKey key, TValue value)
static void KeepAlive(object? obj)
Definition GC.cs:180
Definition GC.cs:8
static bool Exists([NotNullWhen(true)] string? path)
Definition File.cs:97
static ? string GetFileNameWithoutExtension(string? path)
Definition Path.cs:229
static string Combine(string path1, string path2)
Definition Path.cs:304
static readonly char PathSeparator
Definition Path.cs:77
static readonly char DirectorySeparatorChar
Definition Path.cs:71
static bool IsPathFullyQualified(string path)
Definition Path.cs:264
static ? string GetDirectoryName(string? path)
Definition Path.cs:121
static IntPtr GetFunctionPointerForDelegate(Delegate d)
Definition Marshal.cs:1457
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string AssemblyDependencyResolver_FailedToResolveDependencies
Definition SR.cs:2100
static string AssemblyDependencyResolver_FailedToLoadHostpolicy
Definition SR.cs:2098
Definition SR.cs:7
static StringComparer OrdinalIgnoreCase
static IEnumerable< LibraryNameVariation > DetermineLibraryNameVariations(string libName, bool isRelativePath, bool forOSLoader=false)