Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
        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();
        }