Inheritance: InstalledProducts
Esempio n. 1
0
        public static DynamoProducts FindDynamoInstallations(string debugPath = null, IProductLookUp lookUp = null)
        {
            var products = new DynamoProducts(debugPath);

            products.LookUpAndInitProducts(lookUp ?? new InstalledProductLookUp("Dynamo", "*DynamoCore.dll"));
            return(products);
        }
Esempio n. 2
0
        /// <summary>
        /// Finds all unique Dynamo installation on the system that has file
        /// identifiable by the given fileLocator.
        /// </summary>
        /// <param name="additionalDynamoPath">Additional path for Dynamo binaries
        /// to be included in search</param>
        /// <param name="fileLocator">A callback method to locate dynamo specific files.</param>
        /// <returns>List of KeyValuePair of install location and version info
        /// as Tuple. The returned list is sorted based on version info.</returns>
        public static IEnumerable LocateDynamoInstallations(string additionalDynamoPath, Func <string, string> fileLocator)
        {
            var installs = DynamoProducts.FindDynamoInstallations(additionalDynamoPath, new InstalledProductLookUp("Dynamo", fileLocator));

            return
                (installs.Products.Select(
                     p =>
                     new KeyValuePair <string, Tuple <int, int, int, int> >(
                         p.InstallLocation,
                         p.VersionInfo)));
        }
Esempio n. 3
0
        /// <summary>
        /// Finds all unique Dynamo installations on the system
        /// </summary>
        /// <param name="additionalDynamoPath">Additional path for Dynamo binaries
        /// to be included in search</param>
        /// <returns>List of KeyValuePair of install location and version info
        /// as Tuple. The returned list is sorted based on version info.</returns>
        public static IEnumerable FindDynamoInstallations(string additionalDynamoPath)
        {
            var installs = DynamoProducts.FindDynamoInstallations(additionalDynamoPath);

            return
                (installs.Products.Select(
                     p =>
                     new KeyValuePair <string, Tuple <int, int, int, int> >(
                         p.InstallLocation,
                         p.VersionInfo)));
        }
Esempio n. 4
0
 public static DynamoProducts FindDynamoInstallations(string debugPath = null, IProductLookUp lookUp = null)
 {
     var products = new DynamoProducts(debugPath);
     products.LookUpAndInitProducts(lookUp ?? new InstalledProductLookUp("Dynamo", "*DynamoCore.dll"));
     return products;
 }
Esempio n. 5
0
        /// <summary>
        /// Generate new addin files for all applicable
        /// versions of Revit.
        /// </summary>
        /// <param name="products">A collection of revit installs.</param>
        /// <param name="dynamos">DynamoProducts, a collection of installed Dynamo
        /// on this system.</param>
        /// <param name="dynamoUninstallPath">Path of Dynamo being uninstalled</param>
        internal static void GenerateAddins(IRevitProductCollection products, DynamoProducts dynamos, string dynamoUninstallPath = "")
        {
            foreach (var prod in products.Products)
            {
                Console.WriteLine("Generating addins in {0}", prod.AddinsFolder);

                var addinData = DynamoAddinData.Create(prod, dynamos, dynamoUninstallPath);
                if(null != addinData)
                    GenerateDynamoAddin(addinData);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Creates DynamoAddinData to generate addin for given Revit product
        /// based on latest Dynamo installed on the system.
        /// </summary>
        /// <param name="revit">Revit Product for which addin to be generated </param>
        /// <param name="dynamos">Dynamo products installed on the system</param>
        /// <param name="dynamoUninstallPath">dynamo path being uninstalled, can be 
        /// null or empty string</param>
        /// <returns>DynamoAddinData</returns>
        public static DynamoAddinData Create(IRevitProduct revit, DynamoProducts dynamos, string dynamoUninstallPath)
        {
            //Iterate in reverse order to find the first dynamo that is supported for
            //this revit product
            var products = dynamos.Products.Reverse();
            foreach (var p in products)
            {
                //If the current product is being uninstalled, don't generate addin data
                if (DynamoInstall.PathEquals(p.InstallLocation, dynamoUninstallPath))
                    continue;

                var path = Path.Combine(p.InstallLocation, "DynamoRevit.dll");
                //Should be 0.6.3 only supported for Revit2014
                if(File.Exists(path) && revit.VersionString == "Revit2014") 
                    return new DynamoAddinData(revit, new DynamoInstall(p.InstallLocation));

                var subfolder = revit.VersionString.Insert(5, "_");
                path = Path.Combine(p.InstallLocation, subfolder, "DynamoRevitVersionSelector.dll");
                if (File.Exists(path))
                    return new DynamoAddinData(revit, new DynamoInstall(p.InstallLocation));
            }

            return null;
        }