Пример #1
0
        public void Add(Template template)
        {
            #region argument checking

            if (template == null)
            {
                throw new ArgumentNullException("template");
            }

            if (!template.IsValid())
            {
                throw new InvalidOperationException("template is invalid");
            }

            #endregion

            try
            {
                // add the template
                PluginStore.Instance.Save(this, template);

                Invalidate();
            }
            catch (MessageException me)
            {
                if (me.ErrorNumber == PluginErrorCodes.IdAlreadyInUse)
                {
                    // throw with a new message
                    throw new MessageException(
                            TemplateErrorCodes.PathAlreadyInUse,
                            ResourceManager.GetLiteral("Admin.Templates.Upload.PathAlreadyInUse")
                        );

                }

                throw;
            }
        }