public static CADMetadataCriteria GetCADMetadataCriteria(CADProduct cadProduct)
 {
     return(cadProduct == null
         ? null
         : new CADMetadataCriteria
     {
         Identifier = new CADMetadataIdentifier
         {
             Application = new CADApplication
             {
                 Name = "Revit",
                 Version = ApplicationGlobals.GetRevitVersion()
             },
             ETIM = new ETIM
             {
                 ClassCode = cadProduct.EtimClassCode,
                 ClassCodeVersion = cadProduct.EtimClassCodeVersion == null || cadProduct.EtimClassCodeVersion.Equals("0") ? "1" : cadProduct.EtimClassCodeVersion,
                 ModelCode = cadProduct.ModellingClassCode,
                 ModelCodeVersion = cadProduct.ModellingClassCodeVersion == null || cadProduct.ModellingClassCodeVersion.Equals("0") ? "1" : cadProduct.ModellingClassCodeVersion
             }
         },
         Options = new CADMetadataIdentifierOptions
         {
             LanguageCode = "nl"
         }
     });
 }
        private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            // Ignore missing resources
            if (args.Name.Contains(".resources"))
            {
                return(null);
            }

            // check for assemblies already loaded
            var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.FullName == args.Name);

            if (assembly != null)
            {
                return(assembly);
            }

            // Try to load by filename - split out the filename of the full assembly name
            // and append the base path of the original assembly (ie. look in the same dir)
            var filename         = args.Name.Split(',')[0] + ".dll".ToLower();
            var dependencyFolder = ApplicationGlobals.GetAppFolder();
            var asmFile          = Path.Combine(dependencyFolder, filename);

            try
            {
                if (File.Exists(asmFile))
                {
                    return(System.Reflection.Assembly.LoadFrom(asmFile));
                }

                return(null);
            }
            catch
            {
                return(null);
            }
        }