Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ProcessStartupHooks()

static void System.StartupHookProvider.ProcessStartupHooks ( )
inlinestaticprivate

Definition at line 30 of file StartupHookProvider.cs.

31 {
32 if (!IsSupported)
33 {
34 return;
35 }
37 {
39 }
40 if (!(AppContext.GetData("STARTUP_HOOKS") is string text))
41 {
42 return;
43 }
44 Span<char> span = stackalloc char[4]
45 {
48 ' ',
49 ','
50 };
51 ReadOnlySpan<char> readOnlySpan = span;
52 string[] array = text.Split(Path.PathSeparator);
53 StartupHookNameOrPath[] array2 = new StartupHookNameOrPath[array.Length];
54 for (int i = 0; i < array.Length; i++)
55 {
56 string text2 = array[i];
57 if (string.IsNullOrEmpty(text2))
58 {
59 continue;
60 }
61 if (Path.IsPathFullyQualified(text2))
62 {
63 array2[i].Path = text2;
64 continue;
65 }
66 for (int j = 0; j < readOnlySpan.Length; j++)
67 {
68 if (text2.Contains(readOnlySpan[j]))
69 {
70 throw new ArgumentException(SR.Format(SR.Argument_InvalidStartupHookSimpleAssemblyName, text2));
71 }
72 }
73 if (text2.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
74 {
75 throw new ArgumentException(SR.Format(SR.Argument_InvalidStartupHookSimpleAssemblyName, text2));
76 }
77 try
78 {
79 array2[i].AssemblyName = new AssemblyName(text2);
80 }
81 catch (Exception innerException)
82 {
83 throw new ArgumentException(SR.Format(SR.Argument_InvalidStartupHookSimpleAssemblyName, text2), innerException);
84 }
85 }
86 StartupHookNameOrPath[] array3 = array2;
87 foreach (StartupHookNameOrPath startupHook in array3)
88 {
89 CallStartupHook(startupHook);
90 }
91 }
static readonly char PathSeparator
Definition Path.cs:77
static readonly char AltDirectorySeparatorChar
Definition Path.cs:73
static readonly char DirectorySeparatorChar
Definition Path.cs:71
static bool IsPathFullyQualified(string path)
Definition Path.cs:264
static void CallStartupHook(StartupHookNameOrPath startupHook)

References System.IO.Path.AltDirectorySeparatorChar, System.SR.Argument_InvalidStartupHookSimpleAssemblyName, System.array, System.StartupHookProvider.StartupHookNameOrPath.AssemblyName, System.StartupHookProvider.CallStartupHook(), System.IO.Path.DirectorySeparatorChar, System.SR.Format(), System.AppContext.GetData(), System.Diagnostics.Tracing.RuntimeEventSource.Initialize(), System.IO.Path.IsPathFullyQualified(), System.Diagnostics.Tracing.EventSource.IsSupported, System.StartupHookProvider.IsSupported, System.ReadOnlySpan< T >.Length, System.StartupHookProvider.StartupHookNameOrPath.Path, System.IO.Path.PathSeparator, and System.text.