| 91 | } |
| 92 | |
| 93 | bool MAssembly::Load(const String& assemblyPath, const StringView& nativePath) |
| 94 | { |
| 95 | if (IsLoaded()) |
| 96 | return false; |
| 97 | PROFILE_CPU(); |
| 98 | PROFILE_MEM(ScriptingCSharp); |
| 99 | ZoneText(*assemblyPath, assemblyPath.Length()); |
| 100 | Stopwatch stopwatch; |
| 101 | |
| 102 | const String* pathPtr = &assemblyPath; |
| 103 | String path; |
| 104 | if (!FileSystem::FileExists(assemblyPath)) |
| 105 | { |
| 106 | path = assemblyPath; |
| 107 | pathPtr = &path; |
| 108 | if (ResolveMissingFile(path)) |
| 109 | { |
| 110 | Log::FileNotFoundException ex(assemblyPath); |
| 111 | return true; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | OnLoading(); |
| 116 | |
| 117 | if (LoadImage(*pathPtr, nativePath)) |
| 118 | { |
| 119 | OnLoadFailed(); |
| 120 | return true; |
| 121 | } |
| 122 | |
| 123 | OnLoaded(stopwatch); |
| 124 | return false; |
| 125 | } |
| 126 | |
| 127 | void MAssembly::Unload(bool isReloading) |
| 128 | { |