private Stream GetEmbeddedResourceStreamFor(EmbeddedAssetDescriptor resourceDescriptor, string rootUrl) { var stream = resourceDescriptor.Assembly.GetManifestResourceStream(resourceDescriptor.Name); if (stream == null) throw new AssetNotFound(String.Format("Embedded resource not found - {0}", resourceDescriptor.Name)); if (resourceDescriptor.IsTemplate) { var templateParams = _templateParams .Union(new[] { new KeyValuePair<string, string>("%(RootUrl)", rootUrl) }) .ToDictionary(entry => entry.Key, entry => entry.Value); return stream.FindAndReplace(templateParams); } return stream; }
public void CustomAsset(string path, Assembly resourceAssembly, string resourceName) { _pathToAssetMap[path] = new EmbeddedAssetDescriptor(resourceAssembly, resourceName, path == "index"); }
private void MapPathsForSwaggerUiAssets() { var thisAssembly = GetType().Assembly; foreach (var resourceName in thisAssembly.GetManifestResourceNames()) { if (resourceName.Contains("Abp.SwaggerUi.CustomAssets")) continue; // original assets only var path = resourceName .Replace("\\", "/") .Replace(".", "-"); // extensionless to avoid RUMMFAR _pathToAssetMap[path] = new EmbeddedAssetDescriptor(thisAssembly, resourceName, path == "index"); } }