Esempio n. 1
0
        /// <summary>
        /// Returns a list of data-classes for which an Imex extension exists.
        /// </summary>
        /// <returns></returns>
        public static string[] ListImexDataClasses()
        {
            List <string> dataClasses = new List <string>();

            foreach (ExtensionInfo info in new XmlDataImexExtensionPoint().ListExtensions())
            {
                ImexDataClassAttribute a = AttributeUtils.GetAttribute <ImexDataClassAttribute>(info.ExtensionClass);
                if (a != null)
                {
                    dataClasses.Add(a.DataClass);
                }
            }
            return(dataClasses.ToArray());
        }
Esempio n. 2
0
        /// <summary>
        /// Exports all data-classes for which an Imex extension exists.
        /// </summary>
        /// <param name="cmdLine"></param>
        private void ExportAllClasses(ExportCommandLine cmdLine)
        {
            string path = cmdLine.Path;

            // assume the supplied path is a directory, and create it if it doesn't exist
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            foreach (IXmlDataImex imex in new XmlDataImexExtensionPoint().CreateExtensions())
            {
                ImexDataClassAttribute a = AttributeUtils.GetAttribute <ImexDataClassAttribute>(imex.GetType());
                if (a != null)
                {
                    ImexUtils.Export(imex, Path.Combine(path, a.DataClass), a.DataClass, a.ItemsPerFile);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the default number of items exported per file, for the specified Imex extension class.
        /// </summary>
        /// <param name="imexClass"></param>
        /// <returns></returns>
        public static int GetDefaultItemsPerFile(Type imexClass)
        {
            ImexDataClassAttribute a = AttributeUtils.GetAttribute <ImexDataClassAttribute>(imexClass);

            return(a == null ? 0 : a.ItemsPerFile);
        }