2021-03-31 16:42:58 -05:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Markup.LoadResult
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using Microsoft.Iris.Library ;
using Microsoft.Iris.Session ;
using System ;
namespace Microsoft.Iris.Markup
{
internal abstract class LoadResult : SharedDisposableObject
{
private string _uri ;
protected string _uriUnderlying ;
private uint _islandReferences ;
private string _compilerReferenceName ;
public static LoadResult [] EmptyList = new LoadResult [ 0 ];
2021-04-02 19:10:51 -05:00
public LoadResult ( string uri ) => _uri = uri ;
2021-03-31 16:42:58 -05:00
protected override void OnDispose () => base . OnDispose ();
2021-04-02 19:10:51 -05:00
public string Uri => _uri ;
2021-03-31 16:42:58 -05:00
2021-04-02 19:10:51 -05:00
public string UnderlyingUri => _uriUnderlying ;
2021-03-31 16:42:58 -05:00
2021-04-02 19:10:51 -05:00
public string ErrorContextUri => _uriUnderlying == null ? _uri : _uriUnderlying ;
2021-03-31 16:42:58 -05:00
2021-04-02 19:10:51 -05:00
public uint IslandReferences => _islandReferences ;
2021-03-31 16:42:58 -05:00
public void AddReference ( uint islandId )
{
2021-04-02 19:10:51 -05:00
if ((( int ) _islandReferences & ( int ) islandId ) != 0 )
2021-03-31 16:42:58 -05:00
return ;
2021-04-02 19:10:51 -05:00
if ( _islandReferences == 0 U )
RegisterUsage ( this );
_islandReferences |= islandId ;
foreach ( LoadResult dependency in Dependencies )
2021-03-31 16:42:58 -05:00
{
if ( dependency != this )
dependency . AddReference ( islandId );
}
}
public void RemoveReferenceDeep ( uint islandId )
{
2021-04-02 19:10:51 -05:00
if (( _islandReferences & islandId ) <= 0 U )
2021-03-31 16:42:58 -05:00
return ;
2021-04-02 19:10:51 -05:00
_islandReferences &= ~ islandId ;
foreach ( LoadResult dependency in Dependencies )
2021-03-31 16:42:58 -05:00
{
if ( dependency != this )
dependency . RemoveReferenceDeep ( islandId );
}
2021-04-02 19:10:51 -05:00
if ( _islandReferences != 0 U )
2021-03-31 16:42:58 -05:00
return ;
2021-04-02 19:10:51 -05:00
UnregisterUsage ( this );
foreach ( LoadResult dependency in Dependencies )
2021-03-31 16:42:58 -05:00
{
if ( dependency != this )
2021-03-31 17:15:06 -05:00
dependency . UnregisterUsage ( this );
2021-03-31 16:42:58 -05:00
}
}
2021-04-02 19:10:51 -05:00
public void RemoveAllReferences () => RemoveReferenceDeep ( IslandReferences );
2021-03-31 16:42:58 -05:00
protected void RegisterDependenciesUsage ()
{
2021-04-02 19:10:51 -05:00
foreach ( LoadResult dependency in Dependencies )
2021-03-31 16:42:58 -05:00
{
if ( dependency != this )
{
2021-03-31 17:15:06 -05:00
dependency . RegisterUsage ( this );
2021-04-02 19:10:51 -05:00
dependency . AddReference ( _islandReferences );
2021-03-31 16:42:58 -05:00
}
}
}
2021-04-02 19:10:51 -05:00
public void RegisterProxyUsage () => RegisterUsage ( this );
2021-03-31 16:42:58 -05:00
2021-04-02 19:10:51 -05:00
public void UnregisterProxyUsage () => UnregisterUsage ( this );
2021-03-31 16:42:58 -05:00
public virtual void Load ( LoadPass pass )
{
}
public abstract TypeSchema FindType ( string name );
public abstract LoadResultStatus Status { get ; }
2021-03-31 17:20:20 -05:00
public virtual LoadResult [] Dependencies => EmptyList ;
2021-03-31 16:42:58 -05:00
public virtual TypeSchema [] ExportTable => TypeSchema . EmptyList ;
public virtual bool Cachable => true ;
public void SetCompilerReferenceName ( string name )
{
2021-04-02 19:10:51 -05:00
if ( _compilerReferenceName == null )
2021-03-31 16:42:58 -05:00
{
2021-04-02 19:10:51 -05:00
_compilerReferenceName = name ;
2021-03-31 16:42:58 -05:00
}
else
{
2021-04-02 19:10:51 -05:00
if ( name . Equals ( _compilerReferenceName , StringComparison . OrdinalIgnoreCase ))
2021-03-31 16:42:58 -05:00
return ;
2021-03-31 17:15:06 -05:00
ErrorManager . ReportWarning ( "Multiple names '{0}' and '{1}' used to refer to the same entity. The first name will be used for all references to this item within compiled UIB files" , _compilerReferenceName , name );
2021-03-31 16:42:58 -05:00
}
}
2021-04-02 19:10:51 -05:00
public virtual string GetCompilerReferenceName () => _compilerReferenceName ;
2021-03-31 16:42:58 -05:00
2021-04-02 19:10:51 -05:00
public override string ToString () => _uri ;
2021-03-31 16:42:58 -05:00
}
}