public void RecategorizeAssetLists() { FileFilterGroup fileFiltersToUse = FileFilters; if (BuildReportTool.Options.ShouldUseConfiguredFileFilters()) { fileFiltersToUse = BuildReportTool.FiltersUsed.GetProperFileFilterGroupToUse(); //Debug.Log("going to use configured file filters instead... loaded: " + (fileFiltersToUse != null)); } if (UsedAssets != null) { UsedAssets.AssignPerCategoryList(BuildReportTool.ReportGenerator.SegregateAssetSizesPerCategory(UsedAssets.All, fileFiltersToUse)); UsedAssets.RefreshFilterLabels(fileFiltersToUse); UsedAssets.ResortDefault(BuildReportTool.Options.NumberOfTopLargestUsedAssetsToShow); } if (UnusedAssets != null) { UnusedAssets.AssignPerCategoryList(BuildReportTool.ReportGenerator.SegregateAssetSizesPerCategory(UnusedAssets.All, fileFiltersToUse)); UnusedAssets.RefreshFilterLabels(fileFiltersToUse); UnusedAssets.ResortDefault(BuildReportTool.Options.NumberOfTopLargestUnusedAssetsToShow); } }
public void Init(BuildReportTool.SizePart[] all, BuildReportTool.SizePart[][] perCategory, int numberOfTop, FileFilterGroup fileFilters, SortType newSortType, SortOrder newSortOrder) { _lastSortType = newSortType; _lastSortOrder = newSortOrder; Init(all, perCategory, numberOfTop, fileFilters); }
public void RefreshFilterLabels(FileFilterGroup fileFiltersToUse) { _labels = new string[1 + PerCategory.Length]; _labels[0] = "All (" + All.Length + ")"; for (int n = 0, len = fileFiltersToUse.Count; n < len; ++n) { _labels[n + 1] = fileFiltersToUse[n].Label + " (" + PerCategory[n].Length + ")"; } _labels[_labels.Length - 1] = "Unknown (" + PerCategory[PerCategory.Length - 1].Length + ")"; }
public void SetViewOffsetForDisplayedList(FileFilterGroup fileFilters, int newVal) { if (fileFilters.SelectedFilterIdx == -1) { _viewOffsets[0] = newVal; } else if (PerCategory != null && PerCategory.Length >= fileFilters.SelectedFilterIdx + 1) { _viewOffsets[fileFilters.SelectedFilterIdx + 1] = newVal; } }
public void SetViewOffsetForDisplayedList(FileFilterGroup fileFilters, int newVal) { if (fileFilters.SelectedFilterIdx == -1) { _viewOffsets[0] = newVal; } else if (PerCategory != null && PerCategory.Length >= fileFilters.SelectedFilterIdx+1) { _viewOffsets[fileFilters.SelectedFilterIdx+1] = newVal; } }
public void RefreshFilterLabels(FileFilterGroup fileFiltersToUse) { _labels = new string[1 + PerCategory.Length]; _labels[0] = string.Format("All ({0})", All.Length.ToString()); for (int n = 0, len = fileFiltersToUse.Count; n < len; ++n) { _labels[n + 1] = string.Format("{0} ({1})", fileFiltersToUse[n].Label, PerCategory[n].Length.ToString()); } _labels[_labels.Length - 1] = string.Format("Unknown ({0})", PerCategory[PerCategory.Length - 1].Length.ToString()); }
public void AddDisplayedRangeToSumSelection(FileFilterGroup fileFilters, int offset, int range) { BuildReportTool.SizePart[] listForSelection = GetListToDisplay(fileFilters); for (int n = offset; n < offset + range; ++n) { if (!InSumSelection(listForSelection[n])) { AddToSumSelection(listForSelection[n]); } } }
public int GetViewOffsetForDisplayedList(FileFilterGroup fileFilters) { if (fileFilters.SelectedFilterIdx == -1) { return _viewOffsets[0]; } else if (PerCategory != null && PerCategory.Length >= fileFilters.SelectedFilterIdx+1) { return _viewOffsets[fileFilters.SelectedFilterIdx+1]; } return 0; }
public void AddAllDisplayedToSumSelection(FileFilterGroup fileFilters) { BuildReportTool.SizePart[] listForSelection = GetListToDisplay(fileFilters); for (int n = 0; n < listForSelection.Length; ++n) { if (!InSumSelection(listForSelection[n])) { AddToSumSelection(listForSelection[n]); } } }
public int GetViewOffsetForDisplayedList(FileFilterGroup fileFilters) { if (fileFilters.SelectedFilterIdx == -1) { return(_viewOffsets[0]); } else if (PerCategory != null && PerCategory.Length >= fileFilters.SelectedFilterIdx + 1) { return(_viewOffsets[fileFilters.SelectedFilterIdx + 1]); } return(0); }
static void SaveFileFilterGroupToFile(string saveFilePath, FileFilterGroup filterGroup) { System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(typeof(FileFilterGroup)); saveFilePath = saveFilePath.Replace("\\", "/"); System.IO.TextWriter writer = new System.IO.StreamWriter(saveFilePath); x.Serialize(writer, filterGroup); writer.Close(); Debug.Log("Build Report Tool: Saved File Filter Group at \"" + saveFilePath + "\""); }
public BuildReportTool.SizePart[] GetListToDisplay(FileFilterGroup fileFilters) { BuildReportTool.SizePart[] ret = null; if (fileFilters.SelectedFilterIdx == -1) { ret = All; } else if (PerCategory != null && PerCategory.Length >= fileFilters.SelectedFilterIdx + 1) { ret = PerCategory[fileFilters.SelectedFilterIdx]; } return(ret); }
static FileFilterGroup AttemptLoadFileFiltersFromFile(string filePath) { FileFilterGroup ret = null; XmlSerializer x = new XmlSerializer(typeof(FileFilterGroup)); using (FileStream fs = new FileStream(filePath, FileMode.Open)) { XmlReader reader = new XmlTextReader(fs); ret = (FileFilterGroup)x.Deserialize(reader); fs.Close(); } return(ret); }
public static FileFilterGroup GetProperFileFilterGroupToUse(string userFileFilterSavePath) { string fileFilterGroupPath = GetProperFileFilterGroupToUseFilePath(userFileFilterSavePath); //Debug.Log("fileFilterGroupPath: " + fileFilterGroupPath); FileFilterGroup ret = AttemptLoadFileFiltersFromFile(fileFilterGroupPath); if (ret != null) { return(ret); } Debug.LogError("Build Report Tool: Could not find proper File Filter Group to use."); return(null); }
public int GetViewOffsetForDisplayedList(FileFilterGroup fileFilters) { if (_viewOffsets == null || _viewOffsets.Length == 0) { return 0; } if (fileFilters.SelectedFilterIdx == -1) { return _viewOffsets[0]; // _viewOffsets[0] is the "All" list } else if (PerCategory != null && PerCategory.Length >= fileFilters.SelectedFilterIdx + 1) { return _viewOffsets[fileFilters.SelectedFilterIdx + 1]; } return 0; }
public void RecategorizeAssetLists() { FileFilterGroup fileFiltersToUse = FileFilters; if (BuildReportTool.Options.ShouldUseConfiguredFileFilters()) { fileFiltersToUse = BuildReportTool.FiltersUsed.GetProperFileFilterGroupToUse(); } if (UsedAssets != null) { UsedAssets.AssignPerCategoryList(BuildReportTool.ReportManager.SegregateAssetSizesPerCategory(UsedAssets.All, fileFiltersToUse)); } if (UnusedAssets != null) { UnusedAssets.AssignPerCategoryList(BuildReportTool.ReportManager.SegregateAssetSizesPerCategory(UnusedAssets.All, fileFiltersToUse)); } }
// Commands: Initialization // ================================================================================== public void Init(BuildReportTool.SizePart[] all, BuildReportTool.SizePart[][] perCategory, int numberOfTop, FileFilterGroup fileFilters) { All = all; PostSetListAll(numberOfTop); _perCategory = perCategory; _viewOffsets = new int[1 + PerCategory.Length]; // +1 since we need to include the "All" list if (_lastSortType == SortType.None) { // sort by raw size, descending, by default Sort(SortType.RawSize, SortOrder.Descending, fileFilters); } else { Sort(_lastSortType, _lastSortOrder, fileFilters); } RefreshFilterLabels(fileFilters); }
public void Init(BuildReportTool.SizePart[] all, BuildReportTool.SizePart[][] perCategory, FileFilterGroup fileFilters) { _all = all; _perCategory = perCategory; _viewOffsets = new int[1 + PerCategory.Length]; RefreshFilterLabels(fileFilters); }
public BuildReportTool.SizePart[] GetListToDisplay(FileFilterGroup fileFilters) { BuildReportTool.SizePart[] ret = null; if (fileFilters.SelectedFilterIdx == -1) { ret = All; } else if (PerCategory != null && PerCategory.Length >= fileFilters.SelectedFilterIdx+1) { ret = PerCategory[fileFilters.SelectedFilterIdx]; } return ret; }
// Commands: Initialization // ================================================================================== public void Init(BuildReportTool.SizePart[] all, BuildReportTool.SizePart[][] perCategory, FileFilterGroup fileFilters) { All = all; _perCategory = perCategory; _viewOffsets = new int[1 + PerCategory.Length]; if (_currentSortType == SortType.None) { ToggleSort(SortType.RawSize); } else { SetSort(_currentSortType, _currentSortOrder); } RefreshFilterLabels(fileFilters); }
public void Init(BuildReportTool.SizePart[] all, BuildReportTool.SizePart[][] perCategory, FileFilterGroup fileFilters, SortType newSortType, SortOrder newSortOrder) { _currentSortType = newSortType; _currentSortOrder = newSortOrder; Init(all, perCategory, fileFilters); }
public static void MoveUnusedAssetsBatchToNext(BuildInfo buildInfo, FileFilterGroup filtersToUse) { buildInfo.MoveUnusedAssetsBatchNumToNext(); RefreshUnusedAssetsBatch(buildInfo, filtersToUse); }
public void AddDisplayedRangeToSumSelection(FileFilterGroup fileFilters, int offset, int range) { BuildReportTool.SizePart[] listForSelection = GetListToDisplay(fileFilters); for (int n = offset; n < offset+range; ++n) { if (!InSumSelection(listForSelection[n])) { AddToSumSelection(listForSelection[n]); } } }
void RefreshConfiguredFileFilters() { // reload used FileFilterGroup but save current used filter idx // to be re-set afterwards int tempIdx = 0; if (_configuredFileFilterGroup != null) { tempIdx = _configuredFileFilterGroup.GetSelectedFilterIdx(); } _configuredFileFilterGroup = BuildReportTool.FiltersUsed.GetProperFileFilterGroupToUse(); _configuredFileFilterGroup.ForceSetSelectedFilterIdx(tempIdx); }
public void Init(BuildReportTool.SizePart[] all, BuildReportTool.SizePart[][] perCategory, FileFilterGroup fileFilters) { _all = all; _perCategory = perCategory; _labels = new string[1 + PerCategory.Length]; _viewOffsets = new int[1 + PerCategory.Length]; _labels[0] = "All (" + All.Length + ")"; for (int n = 0, len = fileFilters.Count; n < len; ++n) { _labels[n + 1] = fileFilters[n].Label + " (" + PerCategory[n].Length + ")"; } _labels[_labels.Length - 1] = "Unknown (" + PerCategory[PerCategory.Length - 1].Length + ")"; }
static void RefreshUnusedAssetsBatch(BuildInfo buildInfo, FileFilterGroup filtersToUse) { if (buildInfo.UnusedAssetsIncludedInCreation) { BRT_BuildReportWindow.GetValueMessage = "Getting list of unused assets..."; List<BuildReportTool.SizePart> allUsed = buildInfo.UsedAssets.GetAllAsList(); BuildReportTool.SizePart[] allUnused; BuildReportTool.SizePart[][] perCategoryUnused; BuildPlatform buildPlatform = GetBuildPlatformFromString(buildInfo.BuildType, buildInfo.BuildTargetUsed); allUnused = GetAllUnusedAssets(buildInfo.ScenesIncludedInProject, buildInfo.ScriptDLLs, buildInfo.ProjectAssetsPath, buildInfo.IncludedSvnInUnused, buildInfo.IncludedGitInUnused, buildPlatform, buildInfo.UnusedPrefabsIncludedInCreation, buildInfo.UnusedAssetsBatchNum, buildInfo.UnusedAssetsEntriesPerBatch, allUsed); if (allUnused != null && allUnused.Length > 0) { perCategoryUnused = SegregateAssetSizesPerCategory(allUnused, filtersToUse); AssetList.SortType previousUnusedSortType = buildInfo.UnusedAssets.CurrentSortType; AssetList.SortOrder previousUnusedSortOrder = buildInfo.UnusedAssets.CurrentSortOrder; buildInfo.UnusedAssets = new AssetList(); buildInfo.UnusedAssets.Init(allUnused, perCategoryUnused, filtersToUse, previousUnusedSortType, previousUnusedSortOrder); buildInfo.UnusedAssets.PopulateImportedSizes(); if (allUsed.Count != buildInfo.UsedAssets.AllCount) { // it means GetAllUnusedAssets() found new used assets // re-assign all used and re-sort BuildReportTool.SizePart[] newAllUsedArray = allUsed.ToArray(); BuildReportTool.SizePart[][] newPerCategoryUsed = SegregateAssetSizesPerCategory(newAllUsedArray, filtersToUse); AssetList.SortType previousUsedSortType = buildInfo.UsedAssets.CurrentSortType; AssetList.SortOrder previousUsedSortOrder = buildInfo.UsedAssets.CurrentSortOrder; buildInfo.UsedAssets = new AssetList(); buildInfo.UsedAssets.Init(newAllUsedArray, newPerCategoryUsed, filtersToUse, previousUsedSortType, previousUsedSortOrder); buildInfo.UsedAssets.PopulateImportedSizes(); } } else { // no assets found. this only happens when we tried to move to next batch but it turns out to be the last // so we move back buildInfo.MoveUnusedAssetsBatchNumToPrev(); } BRT_BuildReportWindow.GetValueMessage = ""; buildInfo.FlagOkToRefresh(); } }
static void SaveFileFilterGroupToFile(string saveFilePath, FileFilterGroup filterGroup) { XmlSerializer x = new XmlSerializer( typeof(FileFilterGroup) ); saveFilePath = saveFilePath.Replace("\\", "/"); TextWriter writer = new StreamWriter(saveFilePath); x.Serialize(writer, filterGroup); writer.Close(); Debug.Log("Build Report Tool: Saved File Filter Group at \"" + saveFilePath + "\""); }
public void RefreshFilterLabels(FileFilterGroup fileFiltersToUse) { _labels = new string[1 + PerCategory.Length]; _labels[0] = "All (" + All.Length + ")"; for (int n = 0, len = fileFiltersToUse.Count; n < len; ++n) { _labels[n+1] = fileFiltersToUse[n].Label + " (" + PerCategory[n].Length + ")"; } _labels[_labels.Length-1] = "Unknown (" + PerCategory[PerCategory.Length-1].Length + ")"; }
static void RefreshUnusedAssetsBatch(BuildInfo buildInfo, FileFilterGroup filtersToUse) { if (buildInfo.UnusedAssetsIncludedInCreation) { BRT_BuildReportWindow.GetValueMessage = "Getting list of unused assets..."; List<BuildReportTool.SizePart> allUsed = buildInfo.UsedAssets.GetAllAsList(); BuildReportTool.SizePart[] allUnused; BuildReportTool.SizePart[][] perCategoryUnused; BuildPlatform buildPlatform = GetBuildPlatformFromString(buildInfo.BuildType, buildInfo.BuildTargetUsed); allUnused = GetAllUnusedAssets(buildInfo.ScenesIncludedInProject, buildInfo.ScriptDLLs, buildInfo.ProjectAssetsPath, buildInfo.IncludedSvnInUnused, buildInfo.IncludedGitInUnused, buildPlatform, buildInfo.UnusedPrefabsIncludedInCreation, buildInfo.UnusedAssetsBatchNum, buildInfo.UnusedAssetsEntriesPerBatch, allUsed); if (allUnused != null && allUnused.Length > 0) { perCategoryUnused = SegregateAssetSizesPerCategory(allUnused, filtersToUse); buildInfo.UnusedAssets = new AssetList(); buildInfo.UnusedAssets.Init(allUnused, perCategoryUnused, filtersToUse); if (allUsed.Count != buildInfo.UsedAssets.AllCount) { // it means GetAllUnusedAssets() found new used assets // re-assign all used and re-sort BuildReportTool.SizePart[] newAllUsedArray = allUsed.ToArray(); BuildReportTool.SizePart[][] newPerCategoryUsed = SegregateAssetSizesPerCategory(newAllUsedArray, filtersToUse); buildInfo.UsedAssets = new AssetList(); buildInfo.UsedAssets.Init(newAllUsedArray, newPerCategoryUsed, filtersToUse); } } else { buildInfo.MoveUnusedAssetsBatchNumToPrev(); } BRT_BuildReportWindow.GetValueMessage = ""; buildInfo.FlagOkToRefresh(); } }
public static void MoveUnusedAssetsBatchToPrev(BuildInfo buildInfo, FileFilterGroup filtersToUse) { if (buildInfo.UnusedAssetsBatchNum == 0) { return; } buildInfo.MoveUnusedAssetsBatchNumToPrev(); RefreshUnusedAssetsBatch(buildInfo, filtersToUse); }
public static BuildReportTool.SizePart[][] SegregateAssetSizesPerCategory(BuildReportTool.SizePart[] assetSizesAll, FileFilterGroup filters) { if (assetSizesAll == null || assetSizesAll.Length == 0) return null; // we do filters.Count+1 for Unrecognized category List< List<BuildReportTool.SizePart> > ret = new List< List<BuildReportTool.SizePart> >(filters.Count+1); for (int n = 0, len = filters.Count+1; n < len; ++n) { ret.Add(new List<BuildReportTool.SizePart>()); } bool foundAtLeastOneMatch = false; for (int idxAll = 0, lenAll = assetSizesAll.Length; idxAll < lenAll; ++idxAll) { BRT_BuildReportWindow.GetValueMessage = "Segregating assets " + (idxAll+1) + " of " + assetSizesAll.Length + "..."; foundAtLeastOneMatch = false; for (int n = 0, len = filters.Count; n < len; ++n) { if (filters[n].IsFileInFilter(assetSizesAll[idxAll].Name)) { foundAtLeastOneMatch = true; ret[n].Add(assetSizesAll[idxAll]); } } if (!foundAtLeastOneMatch) { ret[ret.Count-1].Add(assetSizesAll[idxAll]); } } BRT_BuildReportWindow.GetValueMessage = ""; BuildReportTool.SizePart[][] retArr = new BuildReportTool.SizePart[filters.Count+1][]; for (int n = 0, len = filters.Count+1; n < len; ++n) { retArr[n] = ret[n].ToArray(); } return retArr; }