/// <summary> /// Constructs a new sceneobject converter /// </summary> /// <param name="openSimPath">The path to a vanilla opensim bin directory</param> /// <param name="creatorOverride">Override for the embedded creator ID</param> /// <param name="ownerOverride">Override for the embedded owner ID</param> public SceneObjectConverter(string openSimPath, IAssetResolver ar, Guid?creatorOverride = null, Guid?ownerOverride = null) { m_assetResolver = ar; m_creatorOverride = creatorOverride ?? Guid.Empty; m_ownerOverride = ownerOverride ?? Guid.Empty; m_context = AppDomainContext.Create(); m_context.LoadAssembly(LoadMethod.LoadFile, Path.Combine(openSimPath, "OpenSim.Region.Framework.dll")); var assemblies = m_context.Domain.GetAssemblies(); foreach (Assembly asm in assemblies) { if (asm.FullName.Contains("OpenSim.Region.Framework")) { Type t = asm.GetType("OpenSim.Region.Framework.Scenes.Serialization.SceneObjectSerializer"); m_fromXml2Method = t.GetMethod("FromXml2Format", new[] { typeof(string) }); if (m_fromXml2Method == null) { // never throw generic Exception - replace this with some other exception type throw new Exception("FromXml2Format(string): No such method exists."); } } } }
/// <summary> /// Constructs a new sceneobject converter /// </summary> /// <param name="openSimPath">The path to a vanilla opensim bin directory</param> /// <param name="creatorOverride">Override for the embedded creator ID</param> /// <param name="ownerOverride">Override for the embedded owner ID</param> public SceneObjectConverter(string openSimPath, IAssetResolver ar, Guid? creatorOverride = null, Guid? ownerOverride = null) { m_assetResolver = ar; m_creatorOverride = creatorOverride ?? Guid.Empty; m_ownerOverride = ownerOverride ?? Guid.Empty; m_context = AppDomainContext.Create(); m_context.LoadAssembly(LoadMethod.LoadFile, Path.Combine(openSimPath, "OpenSim.Region.Framework.dll")); var assemblies = m_context.Domain.GetAssemblies(); foreach (Assembly asm in assemblies) { if (asm.FullName.Contains("OpenSim.Region.Framework")) { Type t = asm.GetType("OpenSim.Region.Framework.Scenes.Serialization.SceneObjectSerializer"); m_fromXml2Method = t.GetMethod("FromXml2Format", new[] { typeof(string) }); if (m_fromXml2Method == null) { // never throw generic Exception - replace this with some other exception type throw new Exception("FromXml2Format(string): No such method exists."); } } } }
public FilterContext(ObjectCache cache, CompositionContainer container, IAssetResolver assetResolver, FilterState state) { this.Container = container; this.Cache = cache; this.AssetResolver = assetResolver; this.State = state; }
public FilterContext(ObjectCache cache, CompositionContainer container, IAssetResolver assetResolver, FilterState state) { this.Container = container; this.Cache = cache; this.AssetResolver = assetResolver; this.State = state; }
public SceneRuntimeInstancesManager(Scene scene, IAssetResolver assetResolver) { _scene = scene; _assetResolver = assetResolver; // todo Id = scene.path; Context = scene.path; }
public RuntimeInstancesManager(IGameStateManager gameStateManager, IAssetResolver assetResolver) { _gameStateManager = gameStateManager; _assetResolver = assetResolver; _sceneRuntimeInstancesManagers = new Dictionary <int, ISceneRuntimeInstancesManager>(); SceneManager.sceneLoaded += SceneManagerOnSceneLoaded; SceneManager.sceneUnloaded += SceneManagerOnSceneUnloaded; }
public ProcessingContext(IEnumerable<IAssetFilter> filters, IAssetResolver assetResolver, XElement element, HashSet<AssetIdentifier> references, int phase) { this._filters = filters.ToArray(); this.AssetResolver = assetResolver; this.Element = element; this._references = references; this.Phase = phase; }
public ProcessingContext(ObjectCache cache, CompositionContainer container, IEnumerable<IAssetFilter> filters, IAssemblyLoader assemblyLoader, IAssetResolver assetResolver, XElement element, HashSet<AssetIdentifier> references, int phase) { this._filters = filters.ToArray(); this.AssetResolver = assetResolver; this.Element = element; this._references = references; Container = container; this.Phase = phase; this.Cache = cache; this.AssemblyLoader = assemblyLoader; }
internal PackageContainer() { this.routePrefix = "assets"; this.appPath = HttpRuntime.AppDomainAppPath; this.templateConfig = new TemplateConfiguration( tmplNamespace: "JST", tmplFunction: "_.template", tmplExtension: "jst"); this.debugState = new DebugState(); this.versionGenerator = new HashedVersionGenerator(); this.javascriptProcessor = new YuiJavaScriptProcessor(); this.stylesheetProcessor = new DotLessStyleSheetProcessor(this.appPath, this.debugState); this.resolver = new AssetResolver(new FileSystemWrapper()); }
public ProcessingContext(ObjectCache cache, CompositionContainer container, IEnumerable <IAssetFilter> filters, IAssemblyLoader assemblyLoader, IAssetResolver assetResolver, XElement element, HashSet <AssetIdentifier> references, int phase) { this._filters = filters.ToArray(); this.AssetResolver = assetResolver; this.Element = element; this._references = references; Container = container; this.Phase = phase; this.Cache = cache; this.AssemblyLoader = assemblyLoader; }
public FilterContext(ObjectCache cache, IAssetResolver assetResolver, FilterState state) { this.Cache = cache; this.AssetResolver = assetResolver; this.State = state; }
private IEnumerable<AssetIdentifier> DiscoverAssets(IAssetResolver assetResolver, IEnumerable<Assembly> assemblies) { TraceSources.GeneratorSource.TraceEvent(TraceEventType.Start, 0, "Discovering assets"); HashSet<AssetIdentifier> distinctSet = new HashSet<AssetIdentifier>(); IFilterContext filterContext = new FilterContext(assetResolver); // find and filter all types from all assemblies foreach (Assembly asm in assemblies) { foreach (Type t in asm.GetTypes()) { // generate namespace hierarchy if (!string.IsNullOrEmpty(t.Namespace)) { Version nsVersion = t.Module.Assembly.GetName().Version; string[] fragments = t.Namespace.Split('.'); for (int i = fragments.Length; i > 0; i--) { string ns = string.Join(".", fragments, 0, i); AssetIdentifier nsAsset = AssetIdentifier.FromNamespace(ns, nsVersion); if (distinctSet.Add(nsAsset)) yield return nsAsset; } } // Debug.Write("Type: " + t.Name); // check if type survives filtering bool filtered = false; AssetIdentifier typeAsset = AssetIdentifier.FromMemberInfo(t); foreach (IAssetFilter filter in this.AssetFilters) { if (filter.Filter(filterContext, typeAsset)) { filtered = true; TraceSources.GeneratorSource.TraceEvent(TraceEventType.Verbose, 0, "{0} - Filtered by {1}", typeAsset.AssetId, filter); break; } } if (!filtered) { /* type was not filtered */ TraceSources.GeneratorSource.TraceEvent(TraceEventType.Information, 0, "{0}", typeAsset.AssetId); if (distinctSet.Add(typeAsset)) yield return typeAsset; MemberInfo[] members = t.GetMembers(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); // Debug.Indent(); foreach (MemberInfo member in members) { // Debug.Write("Member: " + member.Name); filtered = false; AssetIdentifier memberAsset = AssetIdentifier.FromMemberInfo(member); foreach (IAssetFilter filter in this.AssetFilters) { if (filter.Filter(filterContext, memberAsset)) { filtered = true; TraceSources.GeneratorSource.TraceEvent(TraceEventType.Verbose, 0, "{0} - Filtered by {1}", memberAsset.AssetId, filter); // Debug.WriteLine(" - Filtered by " + filter.ToString()); break; } } if (!filtered) { // Debug.WriteLine(" - Added"); TraceSources.GeneratorSource.TraceEvent(TraceEventType.Information, 0, "{0}", memberAsset.AssetId); if (distinctSet.Add(memberAsset)) yield return memberAsset; } } // Debug.Unindent(); } } yield return AssetIdentifier.FromAssembly(asm); } TraceSources.GeneratorSource.TraceEvent(TraceEventType.Stop, 0, "Discovering assets"); }
public AssetManager(IAssetResolver assetResolver) { AssetResolver = assetResolver ?? throw new ArgumentNullException(nameof(assetResolver)); }
public LinkTagHelper(BunderSettings settings, IAssetResolver assetResolver) : base(settings, assetResolver) { }
public AssetManager(GraphicsDevice graphicsDevice, IAssetResolver assetResolver) { GraphicsDevice = graphicsDevice ?? throw new ArgumentNullException(nameof(graphicsDevice)); AssetResolver = assetResolver ?? throw new ArgumentNullException(nameof(assetResolver)); }
protected StaticAssetTagHelper(BunderSettings settings, IAssetResolver assetResolver) { Settings = settings; AssetResolver = assetResolver; }
private IEnumerable<AssetIdentifier> DiscoverAssets(IAssetResolver assetResolver, IEnumerable<Assembly> assemblies) { TraceSources.GeneratorSource.TraceEvent(TraceEventType.Start, 0, "Discovering assets"); HashSet<AssetIdentifier> distinctSet = new HashSet<AssetIdentifier>(); IFilterContext filterContext = new FilterContext(this._cache, assetResolver, FilterState.Discovery); // find and filter all types from all assemblies foreach (Assembly asm in assemblies) { foreach (Type t in asm.GetTypes()) { // check if type survives filtering AssetIdentifier typeAsset = AssetIdentifier.FromMemberInfo(t); if (this.IsFiltered(filterContext, typeAsset)) continue; /* type was not filtered */ TraceSources.GeneratorSource.TraceEvent(TraceEventType.Information, 0, "{0}", typeAsset.AssetId); // generate namespace hierarchy if (!string.IsNullOrEmpty(t.Namespace)) { Version nsVersion = t.Module.Assembly.GetName().Version; string[] fragments = t.Namespace.Split('.'); for (int i = fragments.Length; i > 0; i--) { string ns = string.Join(".", fragments, 0, i); AssetIdentifier nsAsset = AssetIdentifier.FromNamespace(ns, nsVersion); if (distinctSet.Add(nsAsset)) yield return nsAsset; } } if (distinctSet.Add(typeAsset)) yield return typeAsset; MemberInfo[] members = t.GetMembers(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MemberInfo member in members) { AssetIdentifier memberAsset = AssetIdentifier.FromMemberInfo(member); if (this.IsFiltered(filterContext, memberAsset)) continue; TraceSources.GeneratorSource.TraceEvent(TraceEventType.Information, 0, "{0}", memberAsset.AssetId); if (distinctSet.Add(memberAsset)) yield return memberAsset; } } yield return AssetIdentifier.FromAssembly(asm); } TraceSources.GeneratorSource.TraceEvent(TraceEventType.Stop, 0, "Discovering assets"); }
private void BuildHierarchy(IAssetResolver assetResolver, XElement parentNode, LinkedListNode<AssetIdentifier> hierarchy, AssetIdentifier asset, HashSet<AssetIdentifier> references, HashSet<AssetIdentifier> emittedAssets, int phase) { if (hierarchy == null) return; IAssemblyLoader assemblyLoader = new ReflectionOnlyAssemblyLoader(this._cache, this._assemblyPaths.Select(Path.GetDirectoryName)); AssetIdentifier aid = hierarchy.Value; IProcessingContext pctx = new ProcessingContext(this._cache, this._filters, assemblyLoader, assetResolver, parentNode, references, phase); XElement newElement; // add asset to list of generated assets emittedAssets.Add(aid); // dispatch depending on type switch (aid.Type) { case AssetType.Namespace: newElement = parentNode.XPathSelectElement(string.Format("namespace[@assetId = '{0}']", aid)); if (newElement == null) newElement = this.GenerateNamespaceElement(pctx, aid); break; case AssetType.Type: newElement = parentNode.XPathSelectElement(string.Format("*[@assetId = '{0}']", aid)); if (newElement == null) newElement = this.GenerateTypeElement(pctx, aid); break; case AssetType.Method: newElement = parentNode.XPathSelectElement(string.Format("*[@assetId = '{0}']", aid)); if (newElement == null) newElement = this.GenerateMethodElement(pctx, aid); break; case AssetType.Field: newElement = parentNode.XPathSelectElement(string.Format("field[@assetId = '{0}']", aid)); if (newElement == null) newElement = this.GenerateFieldElement(pctx, aid); break; case AssetType.Event: newElement = parentNode.XPathSelectElement(string.Format("event[@assetId = '{0}']", aid)); if (newElement == null) newElement = this.GenerateEventElement(pctx, aid); break; case AssetType.Property: newElement = parentNode.XPathSelectElement(string.Format("property[@assetId = '{0}']", aid)); if (newElement == null) newElement = this.GeneratePropertyElement(pctx, aid); break; case AssetType.Assembly: newElement = parentNode.XPathSelectElement(string.Format("assembly[@assetId = '{0}']", aid)); if (newElement == null) newElement = this.GenerateAssemblyElement(pctx, aid); break; default: throw new ArgumentOutOfRangeException(); } this.BuildHierarchy(assetResolver, newElement, hierarchy.Next, asset, references, emittedAssets, phase); }
public FilterContext(IAssetResolver assetResolver) { this._assetResolver = assetResolver; }