internal void InitDependencyDirectories() { // set up all dependency directories DependencyDirectories = new List <string>(); int countToAdd = Application.dataPath.Split(Path.DirectorySeparatorChar).Length; string toAdd = string.Empty; string [] splitPath = ExpandedDirectoryName.Split(Path.DirectorySeparatorChar); // we make sure the for loop will never add in the last part of the array the object this.jpg for (int j = 0; j < splitPath.Length - 1; ++j) { // add back the slashes, we skip adding the slash on the first pass if (j != 0) { toAdd += Path.DirectorySeparatorChar; } toAdd += splitPath[j]; if (j >= countToAdd) { DependencyDirectories.Add(toAdd.RemoveProjectPath()); } } }
internal void InitAssetManifest() { // set up some offsets to find manifest int assetToBundleOffset = AssetBundleSettings.Instance.AssetsToBundleDirectory.Length + StringExtensions.LengthOfProjectPath + 1; int assetBundleOffset = AssetBundleSettings.Instance.AssetBundleDirectory.Length + 1; string manifestDir = AssetBundleSettings.Instance.AssetBundleDirectory + "/" + ExpandedDirectoryName.Substring(assetToBundleOffset).ToLower() + ".manifest"; // if the manifest exists parse it! if (System.IO.File.Exists(manifestDir)) { AssetViewerManifest = new AssetViewerManifest(manifestDir, AssetBundleSettings.Instance.AssetsToBundleDirectory, StringExtensions.LengthOfProjectPath, assetBundleOffset); } }
/// <summary> /// Initializes a new instance of the <see cref="AssetViewerDirectory"/> class. /// </summary> /// <param name="directory">Directory to set as base</param> /// <param name="baseIndentCount">Base indent count.</param> public AssetViewerDirectory(string directoryPath) { IsSearched = false; IsSelected = false; IsExpanded = false; ContainsSubDirectories = false; ShowAssetBundleDependencies = false; if (!string.IsNullOrEmpty(directoryPath)) { Directory = new DirectoryInfo(directoryPath); if (!Directory.Exists) { throw new DirectoryNotFoundException(); } } else { throw new DirectoryNotFoundException(); } ParentDirectory = Directory.Parent; // set all path names, remove all ~ ExpandedDirectoryName = Directory.FullName.Replace("~", string.Empty); ExpandedParentName = Directory.Parent.FullName.Replace("~", string.Empty); // for project path turn all / to -> ProjectPathDisplayName = ExpandedDirectoryName.RemoveProjectPath().Replace(Path.DirectorySeparatorChar, _smallRightArrowUnicode); // calculate out indent levels int indentRemoveLength = AssetBundleSettings.Instance.AssetsToBundleDirectory.Length + StringExtensions.LengthOfProjectPath; string indentString = Directory.FullName.Remove(0, indentRemoveLength + 1); IndentLevel = indentString.Split(Path.DirectorySeparatorChar).Length - 1; }