コード例 #1
0
ファイル: Block.cs プロジェクト: seasailor/designscript
        /// <summary>
        /// Removes unused block definitions from current file
        /// </summary>
        /// <param name="blockName">
        /// The name of the block to be purged, the block must exist in current
        /// file</param>
        /// <returns>Returns true if the block-definition could be purged,
        /// else false</returns>
        public static bool Purge(string blockName)
        {
            string kMethodName = "DSBlock.Purge";

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

            IBlockHelper helper = HostFactory.Factory.GetBlockHelper();

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

            return(helper.PurgeBlock(blockName));
        }