Beispiel #1
0
        /// <summary>
        /// Exports the block definition, without creating instance.
        /// This means a new block record will be created in the target file.
        /// If the block with the same name already exists in the target file, the old
        /// block will be overwritten.
        /// </summary>
        /// <param name="filePath">The outside file path</param>
        /// <returns>Returns true if the export operation is successful</returns>
        public bool Export(string filePath)
        {
            filePath = DSGeometry.GetFullPath(filePath);

            string kMethodName = "DSBlock.Export";

            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentException(string.Format(Properties.Resources.InvalidInput, filePath, kMethodName), "filePath");
            }

            if (string.IsNullOrEmpty(Name))
            {
                throw new ArgumentException(string.Format(Properties.Resources.InvalidInput, Name, kMethodName), "sourceBlockName");
            }

            IBlockHelper helper = HostFactory.Factory.GetBlockHelper();

            if (null == helper)
            {
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName));
            }

            return(helper.ExportBlockDefinition(filePath, Name));
        }