|
@@ -7,14 +7,10 @@ using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
-using System.Net.Mime;
|
|
|
using System.Reflection;
|
|
|
-using System.Text;
|
|
|
-using System.Threading.Tasks;
|
|
|
using Autodesk.Revit;
|
|
|
using Autodesk.Revit.ApplicationServices;
|
|
|
using Autodesk.Revit.DB;
|
|
|
-using Autodesk.RevitAddIns;
|
|
|
|
|
|
namespace ExportStart
|
|
|
{
|
|
@@ -22,7 +18,7 @@ namespace ExportStart
|
|
|
{
|
|
|
// 此路径为动态反射搜索路径 、 此路径可为任意路径(只要路径下有RevitNET 所需依赖项即可,完整依赖项可在 Naviswork 2016 下面找到)
|
|
|
|
|
|
- static readonly string[] Searchs = RevitProductUtility.GetAllInstalledRevitProducts().Where(t => t.Name == "Revit 2017").Select(x => x.InstallLocation).ToArray();
|
|
|
+ private static readonly string[] Searchs = RevitUtils.GetSearchPath().ToArray();//new string[] { RevitUtils.GetRevitDllPath() };
|
|
|
|
|
|
static readonly object lockobj = new object();
|
|
|
|
|
@@ -78,7 +74,7 @@ namespace ExportStart
|
|
|
{
|
|
|
var path = new[] { Environment.GetEnvironmentVariable("PATH") ?? string.Empty };
|
|
|
//加在最前面,
|
|
|
- var newPath = string.Join(System.IO.Path.PathSeparator.ToString(), paths.Concat(path));
|
|
|
+ var newPath = string.Join(Path.PathSeparator.ToString(), paths.Concat(path));
|
|
|
|
|
|
Environment.SetEnvironmentVariable("PATH", newPath);
|
|
|
}
|
|
@@ -86,15 +82,13 @@ namespace ExportStart
|
|
|
private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
|
|
|
{
|
|
|
var assemblyName = new AssemblyName(args.Name);
|
|
|
-
|
|
|
foreach (var item in Searchs)
|
|
|
{
|
|
|
- var file = string.Format("{0}.dll", System.IO.Path.Combine(item, assemblyName.Name));
|
|
|
-
|
|
|
+ var file = string.Format("{0}.dll", Path.Combine(item, assemblyName.Name));
|
|
|
if (File.Exists(file))
|
|
|
{
|
|
|
- NeedAssemblys.Add(assemblyName.Name);
|
|
|
- return Assembly.LoadFile(file);
|
|
|
+ //NeedAssemblys.Add(assemblyName.Name);
|
|
|
+ return Assembly.LoadFrom(file);
|
|
|
}
|
|
|
}
|
|
|
|