BuildReportTool.ReportManager.GetValues C# (CSharp) 메소드

GetValues() 공개 정적인 메소드

public static GetValues ( BuildInfo buildInfo, string scenesIncludedInProject, string buildFilePath, string projectAssetsPath, string editorAppContentsPath ) : void
buildInfo BuildInfo
scenesIncludedInProject string
buildFilePath string
projectAssetsPath string
editorAppContentsPath string
리턴 void
	public static void GetValues(BuildInfo buildInfo, string[] scenesIncludedInProject, string buildFilePath, string projectAssetsPath, string editorAppContentsPath)
	{
		BRT_BuildReportWindow.GetValueMessage = "Getting values...";


		string gotBuildType = GetBuildTypeFromEditorLog(_lastEditorLogPath);

		if (string.IsNullOrEmpty(gotBuildType))
		{
			Debug.LogWarning(NO_BUILD_INFO_WARNING);
			return;
		}




		// determining build platform based on editor log
		// much more reliable especially when using an override log

		BuildPlatform buildPlatform = GetBuildPlatformFromString(gotBuildType, buildInfo.BuildTargetUsed);

		buildInfo.BuildType = gotBuildType;
		buildInfo.ProjectName = BuildReportTool.Util.GetProjectName(projectAssetsPath);



		// DLLs

		BRT_BuildReportWindow.GetValueMessage = "Getting list of DLLs...";

		bool wasWebBuild = buildInfo.BuildType == "WebPlayer";

		//Debug.Log("going to call parseDLLs");
		ParseDLLs(_lastEditorLogPath, wasWebBuild, buildFilePath, projectAssetsPath, editorAppContentsPath, buildInfo.MonoLevel, buildInfo.CodeStrippingLevel, out buildInfo.MonoDLLs, out buildInfo.ScriptDLLs);

		Array.Sort(buildInfo.MonoDLLs, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) {
			if (b1.SizeBytes > b2.SizeBytes) return -1;
			if (b1.SizeBytes < b2.SizeBytes) return 1;
			return 0;
		});
		Array.Sort(buildInfo.ScriptDLLs, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) {
			if (b1.SizeBytes > b2.SizeBytes) return -1;
			if (b1.SizeBytes < b2.SizeBytes) return 1;
			return 0;
		});



		//Debug.Log("ParseDLLs done");




		// build sizes per category

		BRT_BuildReportWindow.GetValueMessage = "Getting build sizes...";

		//Debug.Log("ParseSizePartsFromString sta");

		buildInfo.BuildSizes = ParseSizePartsFromString(_lastEditorLogPath);


		Array.Sort(buildInfo.BuildSizes, delegate(BuildReportTool.SizePart b1, BuildReportTool.SizePart b2) {
			if (b1.Percentage > b2.Percentage) return -1;
			else if (b1.Percentage < b2.Percentage) return 1;
			// if percentages are equal, check actual file size (approximate values)
			else if (b1.DerivedSize > b2.DerivedSize) return -1;
			else if (b1.DerivedSize < b2.DerivedSize) return 1;
			return 0;
		});







		// getting project size (uncompressed)

		buildInfo.UsedTotalSize = "";
		for (int i=0; i<buildInfo.BuildSizes.Length; i++)
		{
			if (buildInfo.BuildSizes[i].IsTotal)
			{
				buildInfo.UsedTotalSize = buildInfo.BuildSizes[i].Size;
				break;
			}
		}
		/*
		foreach (BuildReportTool.SizePart b in buildInfo.BuildSizes)
		{
			if (b.IsTotal)
			{
				buildInfo.UsedTotalSize = b.Size;
				break;
			}
		}*/


		// getting streaming assets size (uncompressed)

		buildInfo.StreamingAssetsSize = BuildReportTool.Util.GetFolderSizeReadable(projectAssetsPath + "/StreamingAssets");



		// getting compressed total build size
		//Debug.Log("getting compressed total build size...");
		//Debug.Log("trying to get size for: " + buildPlatform);
		//Debug.Log("trying to get size of: " + buildFilePath);

		buildInfo.TotalBuildSize = "";

		if (buildPlatform == BuildPlatform.Flash)
		{
			// in Flash builds, `buildFilePath` is the .swf file

			buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath);
		}
		else if (buildPlatform == BuildPlatform.Android)
		{
			//Debug.Log("trying to get size of: " + buildFilePath);

			// in Unity 4, Android can generate an Eclipse project if set so in the build settings
			// or an .apk with an accompanying .obb file, which we should take into account

			// check if an .obb file was generated and get its file size


			if (!buildInfo.AndroidCreateProject && !buildInfo.AndroidUseAPKExpansionFiles)
			{
				// .apk without an .obb

				buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath);
			}
			else if (!buildInfo.AndroidCreateProject && buildInfo.AndroidUseAPKExpansionFiles)
			{
				// .apk with .obb

				// get the .apk file but remove the file type
				string obbPath = BuildReportTool.Util.ReplaceFileType(buildFilePath, ".main.obb");

				double obbSize = BuildReportTool.Util.GetPathSizeInBytes(obbPath);
				double apkSize = BuildReportTool.Util.GetPathSizeInBytes(buildFilePath);

				buildInfo.TotalBuildSize = BuildReportTool.Util.GetBytesReadable(apkSize + obbSize);
				buildInfo.AndroidApkFileBuildSize = BuildReportTool.Util.GetBytesReadable(apkSize);
				buildInfo.AndroidObbFileBuildSize = BuildReportTool.Util.GetBytesReadable(obbSize);
			}
			else if (buildInfo.AndroidCreateProject)
			{
				// total build size is size of the eclipse project folder
				buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath);

				// if there is .obb, find it
				if (buildInfo.AndroidUseAPKExpansionFiles)
				{
					// the .obb is inside this folder
					buildInfo.AndroidObbFileBuildSize = BuildReportTool.Util.GetObbSizeInEclipseProjectReadable(buildFilePath);
				}
			}
			else
			{
				// ???
				buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath);
			}
		}
		else if (buildPlatform == BuildPlatform.Web)
		{
			// in web builds, `buildFilePath` is the folder
			buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath);

			// find a .unity3d file inside the build folder and get its file size

			// compressed file size found in log is actually the .unity3d file size
			buildInfo.WebFileBuildSize = GetCompressedSizeReadingFromLog();
		}
		else if (
			buildPlatform == BuildPlatform.Windows32 ||
			buildPlatform == BuildPlatform.Windows64 ||
			buildPlatform == BuildPlatform.Linux32 ||
			buildPlatform == BuildPlatform.Linux64)
		{
			// in windows builds, `buildFilePath` is the executable file
			// we additionaly need to get the size of the Data folder

			// in 32 bit builds, `buildFilePath` is the executable file (.x86 file). we still need the Data folder
			// in 64 bit builds, `buildFilePath` is the executable file (.x86_64 file). we still need the Data folder

			buildInfo.TotalBuildSize = BuildReportTool.Util.GetBytesReadable( GetBuildExeFileDataFolderSize(buildFilePath) );
		}
		else if (buildPlatform == BuildPlatform.LinuxUniversal)
		{
			// in universal builds, `buildFilePath` is the 32-bit executable. we still need the 64-bit executable and the Data folder



			// gets the size of 32-bit executable and Data folder
			double exe32WithDataFolderSizeBytes = GetBuildExeFileDataFolderSize(buildFilePath);



			// get the .x86 file file but change the file type to ".x86_64"
			string exe64Path = BuildReportTool.Util.ReplaceFileType(buildFilePath, ".x86_64");

			// gets the size of 64-bit executable
			double exe64SizeBytes = BuildReportTool.Util.GetPathSizeInBytes(exe64Path);



			buildInfo.TotalBuildSize = BuildReportTool.Util.GetBytesReadable(exe32WithDataFolderSizeBytes + exe64SizeBytes);
		}
		else if (
			buildPlatform == BuildPlatform.MacOSX32 ||
			buildPlatform == BuildPlatform.MacOSX64 ||
			buildPlatform == BuildPlatform.MacOSXUniversal)
		{
			// in Mac builds, `buildFilePath` is the .app file (which is really just a folder)
			buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath);
		}
		else if (buildPlatform == BuildPlatform.iOS)
		{
			// in iOS builds, `buildFilePath` is the Xcode project folder
			buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath);
		}
		else
		{
			// in console builds, `buildFilePath` is ???
			// last resort for unknown build platforms
			buildInfo.TotalBuildSize = BuildReportTool.Util.GetPathSizeReadable(buildFilePath);
		}



		// for debug
		//GetCompressedSizeReadingFromLog();

		// ensure this is not used anymore on new reports
		// (it's still there for old build report XML files)
		//buildInfo.CompressedBuildSize = "";



		buildInfo.UnusedTotalSize = "";


		if (buildInfo.UsedAssetsIncludedInCreation)
		{
			BRT_BuildReportWindow.GetValueMessage = "Getting list of used assets...";

			// asset list

			buildInfo.FileFilters = BuildReportTool.FiltersUsed.GetProperFileFilterGroupToUse(_lastSavePath);


			List<BuildReportTool.SizePart> allUsed;
			BuildReportTool.SizePart[][] perCategoryUsed;

			allUsed = ParseAssetSizesFromEditorLog(_lastEditorLogPath, buildInfo.PrefabsUsedInScenes);

			//Debug.Log("buildInfo.UsedAssets.All: " + buildInfo.UsedAssets.All.Length);

			if (buildInfo.UnusedAssetsIncludedInCreation)
			{
				BRT_BuildReportWindow.GetValueMessage = "Getting list of unused assets...";

				BuildReportTool.SizePart[] allUnused;
				BuildReportTool.SizePart[][] perCategoryUnused;


				allUnused = GetAllUnusedAssets(scenesIncludedInProject, buildInfo.ScriptDLLs, projectAssetsPath, buildInfo.IncludedSvnInUnused, buildInfo.IncludedGitInUnused, buildPlatform, buildInfo.UnusedPrefabsIncludedInCreation, 0, buildInfo.UnusedAssetsEntriesPerBatch, allUsed);

				perCategoryUnused = SegregateAssetSizesPerCategory(allUnused, buildInfo.FileFilters);

				buildInfo.UnusedAssets = new AssetList();
				buildInfo.UnusedAssets.Init(allUnused, perCategoryUnused, buildInfo.FileFilters);

				buildInfo.UnusedTotalSize = BuildReportTool.Util.GetBytesReadable( buildInfo.UnusedAssets.GetTotalSizeInBytes() );
			}

			BuildReportTool.SizePart[] allUsedArray = allUsed.ToArray();

			perCategoryUsed = SegregateAssetSizesPerCategory(allUsedArray, buildInfo.FileFilters);
			buildInfo.UsedAssets = new AssetList();
			buildInfo.UsedAssets.Init(allUsedArray, perCategoryUsed, buildInfo.FileFilters);
		}


		//foreach (string d in EditorUserBuildSettings.activeScriptCompilationDefines)
		//{
		//	Debug.Log("define: " + d);
		//}

		BRT_BuildReportWindow.GetValueMessage = "";

		buildInfo.FlagOkToRefresh();
	}