Ejemplo n.º 1
0
 public PyRevitAttachment(RevitAddonManifest manifest,
                          RevitProduct product,
                          PyRevitAttachmentType attachmentType)
 {
     Manifest       = manifest;
     Product        = product;
     AttachmentType = attachmentType;
 }
Ejemplo n.º 2
0
 public static PyRevitEngine GetEngineFromManifest(RevitAddonManifest manifest, PyRevitClone clone)
 {
     foreach (var engine in clone.GetEngines())
     {
         if (manifest.Assembly.Contains(engine.Path))
         {
             return(engine);
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
 public static PyRevitClone GetCloneFromManifest(RevitAddonManifest manifest)
 {
     foreach (var clone in PyRevit.GetRegisteredClones())
     {
         if (manifest.Assembly.Contains(clone.ClonePath))
         {
             return(clone);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
        public static void RemoveManifestFile(int revitYear, string addinName, bool currentAndAllUsers = true)
        {
            RevitAddonManifest revitManifest = GetManifest(revitYear, addinName, allUsers: false);

            if (revitManifest != null)
            {
                logger.Debug("Removing manifest file \"{0}\"", revitManifest.FilePath);
                File.Delete(revitManifest.FilePath);
            }
            if (currentAndAllUsers)
            {
                revitManifest = GetManifest(revitYear, addinName, allUsers: true);
                if (revitManifest != null)
                {
                    logger.Debug("Removing all users manifest file \"{0}\"", revitManifest.FilePath);
                    File.Delete(revitManifest.FilePath);
                }
            }
        }
Ejemplo n.º 5
0
        public static RevitAddonManifest GetManifest(int revitYear, string addinName, bool allUsers)
        {
            string addinPath = GetRevitAddonsFolder(revitYear, allUsers: allUsers);

            if (CommonUtils.VerifyPath(addinPath))
            {
                foreach (string file in Directory.GetFiles(addinPath))
                {
                    if (file.ToLower().EndsWith(".addin"))
                    {
                        try {
                            logger.Debug(string.Format("Reading Revit \"{0}\" manifest file \"{1}\"",
                                                       revitYear, file));
                            var revitManifest = new RevitAddonManifest(file);
                            if (revitManifest.Name.ToLower() == addinName.ToLower())
                            {
                                return(revitManifest);
                            }
                        }
                        catch (Exception ex) {
                            logger.Debug(string.Format("Not pyRevit \"{0}\" manifest file \"{1}\" | {2}",
                                                       revitYear,
                                                       file,
                                                       ex.Message)
                                         );
                        }
                    }
                }

                return(null);
            }
            else
            {
                logger.Debug("Addons path \"{0}\" does not exist", addinPath);
            }
            return(null);
        }
Ejemplo n.º 6
0
 // get clone from manifest file
 public static PyRevitClone GetCloneFromManifest(RevitAddonManifest manifest)
 {
     return(new PyRevitClone(Path.GetDirectoryName(manifest.Assembly)));
 }