BuildReportTool.ReportManager.ParseDLLs C# (CSharp) Метод

ParseDLLs() статический приватный Метод

static private ParseDLLs ( string editorLogPath, bool wasWebBuild, string buildFilePath, string projectAssetsPath, string editorAppContentsPath, ApiCompatibilityLevel monoLevel, StrippingLevel codeStrippingLevel, BuildReportTool &includedDLLs, BuildReportTool &scriptDLLs ) : void
editorLogPath string
wasWebBuild bool
buildFilePath string
projectAssetsPath string
editorAppContentsPath string
monoLevel ApiCompatibilityLevel
codeStrippingLevel StrippingLevel
includedDLLs BuildReportTool
scriptDLLs BuildReportTool
Результат void
	static void ParseDLLs(string editorLogPath, bool wasWebBuild, string buildFilePath, string projectAssetsPath, string editorAppContentsPath, ApiCompatibilityLevel monoLevel, StrippingLevel codeStrippingLevel, out BuildReportTool.SizePart[] includedDLLs, out BuildReportTool.SizePart[] scriptDLLs)
	{
		List<BuildReportTool.SizePart> includedDLLsList = new List<BuildReportTool.SizePart>();
		List<BuildReportTool.SizePart> scriptDLLsList = new List<BuildReportTool.SizePart>();

		string buildManagedDLLsFolder = BuildReportTool.Util.GetBuildManagedFolder(buildFilePath);
		string buildScriptDLLsFolder = buildManagedDLLsFolder;
		string buildManagedDLLsFolderHigherPriority = "";

		bool wasAndroidApkBuild = buildFilePath.EndsWith(".apk");

		if (wasWebBuild)
		{
			string tryPath;
			bool success = BuildReportTool.Util.AttemptGetWebTempStagingArea(projectAssetsPath, out tryPath);
			if (success)
			{
				buildManagedDLLsFolder = tryPath;
				buildScriptDLLsFolder = tryPath;
			}
		}
		else if (wasAndroidApkBuild)
		{
			string tryPath;
			bool success = BuildReportTool.Util.AttemptGetAndroidTempStagingArea(projectAssetsPath, out tryPath);
			if (success)
			{
				buildManagedDLLsFolder = tryPath;
				buildScriptDLLsFolder = tryPath;
			}
		}

		string unityFolderManagedDLLs;
		bool unityfoldersSuccess = BuildReportTool.Util.AttemptGetUnityFolderMonoDLLs(wasWebBuild, wasAndroidApkBuild, editorAppContentsPath, monoLevel, codeStrippingLevel, out unityFolderManagedDLLs, out buildManagedDLLsFolderHigherPriority);


		//Debug.Log("buildManagedDLLsFolder: " + buildManagedDLLsFolder);
		//Debug.Log("Application.dataPath: " + Application.dataPath);

		if (unityfoldersSuccess && (string.IsNullOrEmpty(buildManagedDLLsFolder) || !Directory.Exists(buildManagedDLLsFolder)))
		{
#if BRT_SHOW_MINOR_WARNINGS
			Debug.LogWarning("Could not find build folder. Using Unity install folder instead for getting mono DLL file sizes.");
#endif
			buildManagedDLLsFolder = unityFolderManagedDLLs;
		}

#if BRT_SHOW_MINOR_WARNINGS
		if (!Directory.Exists(buildManagedDLLsFolder))
		{
			Debug.LogWarning("Could not find folder for getting DLL file sizes. Got: \"" + buildManagedDLLsFolder + "\"");
		}
#endif


		const string PREFIX_REMOVE = "Dependency assembly - ";

		BuildReportTool.SizePart inPart;


		const string MONO_DLL_KEY = "Mono dependencies included in the build";


		foreach (string line in DldUtil.BigFileReader.ReadFile(editorLogPath, MONO_DLL_KEY))
		{
			// blank line signifies end of dll list
			if (string.IsNullOrEmpty(line) || line == "\n" || line == "\r\n")
			{
				break;
			}
			if (line.IndexOf(MONO_DLL_KEY) != -1)
			{
				continue;
			}

			string filename = line;

			filename = BuildReportTool.Util.RemovePrefix(PREFIX_REMOVE, filename);


			string filepath;
			if (BuildReportTool.Util.IsAScriptDLL(filename))
			{
				filepath = buildScriptDLLsFolder + filename;
				//Debug.LogWarning("Script \"" + filepath + "\".");
			}
			else
			{
				filepath = buildManagedDLLsFolder + filename;

				if (!File.Exists(filepath) && unityfoldersSuccess && (buildManagedDLLsFolder != unityFolderManagedDLLs))
				{
#if BRT_SHOW_MINOR_WARNINGS
					Debug.LogWarning("Failed to find file \"" + filepath + "\". Attempting to get from Unity folders.");
#endif
					filepath = unityFolderManagedDLLs + filename;

					if (!string.IsNullOrEmpty(buildManagedDLLsFolderHigherPriority) && File.Exists(buildManagedDLLsFolderHigherPriority + filename))
					{
						filepath = buildManagedDLLsFolderHigherPriority + filename;
					}
				}
			}

			if ((buildManagedDLLsFolder == unityFolderManagedDLLs) && !string.IsNullOrEmpty(buildManagedDLLsFolderHigherPriority) && File.Exists(buildManagedDLLsFolderHigherPriority + filename))
			{
				filepath = buildManagedDLLsFolderHigherPriority + filename;
			}

			//Debug.Log(filename + " " + filepath);

			inPart = BuildReportTool.Util.CreateSizePartFromFile(filename, filepath);

			//gotTotalSizeBytes += inPart.SizeBytes;

			bool shouldGoInScriptDLLList = BuildReportTool.Util.IsAScriptDLL(filename);

			if (!File.Exists(unityFolderManagedDLLs + filename))
			{
				shouldGoInScriptDLLList = true;
			}

			if (shouldGoInScriptDLLList)
			{
				//gotScriptTotalSizeBytes += inPart.SizeBytes;
				scriptDLLsList.Add(inPart);
			}
			else
			{
				includedDLLsList.Add(inPart);
			}
		}

		// somehow, the editor logfile
		// doesn't include UnityEngine.dll
		// even though it gets included in the final build (for desktop builds)
		//
		// for web builds though, it makes sense not to put UnityEngine.dll in the build. and it isn't.
		// Instead, it's likely residing in the browser plugin to save bandwidth.
		//
		// begs the question though, why not have the whole Mono Web Subset DLLs be
		// installed alongside the Unity web browser plugin?
		// no need to bundle Mono DLLs in the web build itself.
		// would have shaved 1 whole MB when a game uses System.Xml.dll for example
		//
		//if (!wasWebBuild)
		{
			string filename = "UnityEngine.dll";
			string filepath = buildManagedDLLsFolder + filename;

			if (File.Exists(filepath))
			{
				inPart = BuildReportTool.Util.CreateSizePartFromFile(filename, filepath);
				//gotTotalSizeBytes += inPart.SizeBytes;
				includedDLLsList.Add(inPart);
			}
		}


		//Debug.Log("total size: " + EditorUtility.FormatBytes(gotTotalSizeBytes) + " (" + gotTotalSizeBytes + " bytes)");
		//Debug.Log("total assembly size: " + EditorUtility.FormatBytes(gotScriptTotalSizeBytes) + " (" + gotScriptTotalSizeBytes + " bytes)");
		//Debug.Log("total size without assembly: " + EditorUtility.FormatBytes(gotTotalSizeBytes - gotScriptTotalSizeBytes) + " (" + (gotTotalSizeBytes-gotScriptTotalSizeBytes) + " bytes)");


		includedDLLs = includedDLLsList.ToArray();
		scriptDLLs = scriptDLLsList.ToArray();
	}