static void Run(string[] args) { var needAdmin = Convert.ToInt32(args[1]) == 1; switch (args[3]) { case "vaultapp": var appFolder = args[5]; var files = args.SkipWhile((c, i) => i < 7).ToArray(); try { var errList = VaultAppUtils.ExtractApps(appFolder, files, Logger.Log); Logger.Log.Error("加载App失败:" + String.Join("\r\n", errList)); Trace.WriteLine("加载App成功:"); } catch (Exception ex) { Trace.WriteLine("加载App失败:" + ex.Message); } break; case "revitplugin": var baseFolder = args[5]; var dict = AddinPathUtils.GetAddinDict(baseFolder); foreach (var d in dict) { foreach (var f in d.Value) { AddinPathUtils.InstallPlugin(d.Key, f, needAdmin); } } break; } }
private void LoadRevitApps() { try { var location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (location != null) { var basePath = Path.Combine(location, "RevitPlugin"); Log.Info(string.Format("basePath={0}", basePath)); var pluginDict = AddinPathUtils.GetAddinDict(basePath); Log.Info(string.Format("pluginDict={0}", pluginDict)); var needInstallDict = new Dictionary <string, string[]>(); foreach (var p in pluginDict) { var version = p.Key; AddinPathUtils.RemovePluginsInSpecificFolder(version, false, location); var revitInstalled = RevitInstallInfoUtils.CanbeInstalled(version); if (!revitInstalled) { continue; } var needInstallPaths = new List <string>(); foreach (var d in p.Value) { var installed = AddinPathUtils.PluginInstalledOrNoNeed(version, d, false); if (!installed) { needInstallPaths.Add(d); } } needInstallDict.Add(version, needInstallPaths.ToArray()); } foreach (var d in needInstallDict) { foreach (var p in d.Value) { try { var err = AddinPathUtils.InstallPlugin(d.Key, p, false); if (!String.IsNullOrEmpty(err)) { Log.Warn(err); } } catch (Exception ex) { Log.Error("Loading Revit plugin failed 1. Exception: " + ex.Message, ex); } } } } } catch (Exception ex) { Log.Error("Loading Revit plugin failed 2. Exception: " + ex.Message, ex); } }
internal static void TestNeedUpdateRevitPlugin() { var version = "2014"; var pluginDir = @"E:\Dev\Cloud\CloudCode\AecCloud\bin\Debug\RevitPlugin\2014\BimCloud"; var alluser = false; var installed = AddinPathUtils.PluginInstalledOrNoNeed(version, pluginDir, alluser); Console.WriteLine(installed); Console.ReadKey(); }