2015-04-08 14:50:03 +02:00
|
|
|
|
using Microsoft.VisualStudio.Project;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace ANX.Framework.VisualStudio.Nodes
|
|
|
|
|
{
|
|
|
|
|
public class AnxAssemblyReferenceNode : AssemblyReferenceNode
|
|
|
|
|
{
|
|
|
|
|
public AnxAssemblyReferenceNode(ContentProjectNode node, string name, string assemblyPath)
|
|
|
|
|
: base(node, name, assemblyPath)
|
|
|
|
|
{
|
2015-09-03 23:43:55 +02:00
|
|
|
|
this.OriginalAssemblyPath = assemblyPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string OriginalAssemblyPath
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
private set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public new ContentProjectNode ProjectMgr
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (ContentProjectNode)base.ProjectMgr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string ResolveAssemblyPath(string assemblyPath)
|
|
|
|
|
{
|
|
|
|
|
if (!File.Exists(assemblyPath))
|
|
|
|
|
{
|
|
|
|
|
using (var buildDomain = this.ProjectMgr.BuildAppDomain.Aquire())
|
|
|
|
|
{
|
|
|
|
|
assemblyPath = buildDomain.MakeAbsoluteFromSearchPaths(assemblyPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return assemblyPath;
|
2015-04-08 14:50:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override NodeProperties CreatePropertiesObject()
|
|
|
|
|
{
|
|
|
|
|
return new AnxAssemblyReferenceProperties(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string RuntimeVersion
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (this.IsValid)
|
|
|
|
|
{
|
2015-09-03 23:43:55 +02:00
|
|
|
|
using (var domain = ProjectMgr.BuildAppDomain.Aquire())
|
2015-04-08 14:50:03 +02:00
|
|
|
|
{
|
|
|
|
|
return domain.Proxy.GetAssemblyRuntimeVersion(this.Url);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void RefreshReference(bool fileChanged = false)
|
|
|
|
|
{
|
2015-09-03 23:43:55 +02:00
|
|
|
|
if (ProjectMgr.BuildAppDomain.IsDisposed)
|
2015-04-08 14:50:03 +02:00
|
|
|
|
return;
|
|
|
|
|
|
2015-09-03 23:43:55 +02:00
|
|
|
|
Uri url;
|
|
|
|
|
if (Uri.TryCreate(this.Url, UriKind.Absolute, out url))
|
2015-04-08 14:50:03 +02:00
|
|
|
|
{
|
2015-09-03 23:43:55 +02:00
|
|
|
|
using (var buildDomain = ProjectMgr.BuildAppDomain.Aquire())
|
2015-04-08 14:50:03 +02:00
|
|
|
|
{
|
2015-09-03 23:43:55 +02:00
|
|
|
|
if (!File.Exists(this.Url))
|
|
|
|
|
{
|
|
|
|
|
buildDomain.RemoveShadowCopyDirectory(url);
|
|
|
|
|
}
|
2015-04-08 14:50:03 +02:00
|
|
|
|
|
2015-09-03 23:43:55 +02:00
|
|
|
|
base.RefreshReference(fileChanged);
|
2015-04-08 14:50:03 +02:00
|
|
|
|
|
2015-09-03 23:43:55 +02:00
|
|
|
|
if (File.Exists(this.Url))
|
|
|
|
|
{
|
|
|
|
|
buildDomain.AddShadowCopyDirectory(new Uri(Path.GetDirectoryName(this.Url)));
|
|
|
|
|
}
|
2015-04-08 14:50:03 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var container = (ContentProjectReferenceContainer)this.ProjectMgr.GetReferenceContainer();
|
|
|
|
|
if (fileChanged)
|
|
|
|
|
container.RefreshAssemblies();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|