Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FileBasedResourceGroveler.cs
Go to the documentation of this file.
3using System.IO;
4
5namespace System.Resources;
6
8{
10
15
17 {
18 ResourceSet result = null;
21 if (text == null)
22 {
23 if (tryParents && culture.HasInvariantCultureName)
24 {
25 string value = ((_mediator.LocationInfo == null) ? "<null>" : _mediator.LocationInfo.FullName);
26 throw new MissingManifestResourceException($"{SR.MissingManifestResource_NoNeutralDisk}{"\r\n"}baseName: {_mediator.BaseNameField} locationInfo: {value} fileName: {_mediator.GetResourceFileName(culture)}");
27 }
28 }
29 else
30 {
31 result = CreateResourceSet(text);
32 }
33 return result;
34 }
35
37 {
38 if (_mediator.ModuleDir != null)
39 {
40 string text = Path.Combine(_mediator.ModuleDir, fileName);
41 if (File.Exists(text))
42 {
43 return text;
44 }
45 }
46 if (File.Exists(fileName))
47 {
48 return fileName;
49 }
50 return null;
51 }
52
54 {
55 if (_mediator.UserResourceSet == null)
56 {
57 return new RuntimeResourceSet(file);
58 }
59 object[] args = new object[1] { file };
60 try
61 {
62 return (ResourceSet)Activator.CreateInstance(_mediator.UserResourceSet, args);
63 }
65 {
67 }
68 }
69}
static ? object CreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type, BindingFlags bindingAttr, Binder? binder, object?[]? args, CultureInfo? culture)
Definition Activator.cs:17
static bool Exists([NotNullWhen(true)] string? path)
Definition File.cs:97
static string Combine(string path1, string path2)
Definition Path.cs:304
readonly ResourceManager.ResourceManagerMediator _mediator
string FindResourceFile(CultureInfo culture, string fileName)
FileBasedResourceGroveler(ResourceManager.ResourceManagerMediator mediator)
ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary< string, ResourceSet > localResourceSets, bool tryParents, bool createIfNotExists)
virtual string GetResourceFileName(CultureInfo culture)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string InvalidOperation_ResMgrBadResSet_Type
Definition SR.cs:1506
Definition SR.cs:7