public Specification(AssetFile file) { _fullname = new Lazy <string>(() => Parent.FullName + "/" + _libraryName); File = file; string fileContentFolder = file.ContentFolder(); if (fileContentFolder == null || fileContentFolder == "specs") { _contentFolder = null; } else { var list = fileContentFolder.Split('/').ToList(); list.Remove("specs"); _contentFolder = list.Join("/"); } _libraryName = file.LibraryName(); var libraryParts = _libraryName.Split('.').ToList(); var index = libraryParts.IndexOf("spec"); if (index > -1) { _subject = libraryParts.Take(index).Join("."); } else { _subject = libraryParts.Where(x => !_ignoredExtensions.Contains("." + x)).Join("."); } }
public static string DetermineLibraryName(AssetFile file) { var libraryNameParts = file.LibraryName().Split('.').ToList(); while (libraryNameParts.Any() && _ignoredExtensions.Contains("." + libraryNameParts.Last())) { libraryNameParts.RemoveAt(libraryNameParts.Count - 1); } return(libraryNameParts.Join(".")); }