Frapid.WebsiteBuilder.Models.Themes.ThemeUploader.Install C# (CSharp) Method

Install() public method

public Install ( string tenant ) : Frapid.WebsiteBuilder.Models.Themes.ThemeInfo
tenant string
return Frapid.WebsiteBuilder.Models.Themes.ThemeInfo
        public ThemeInfo Install(string tenant)
        {
            try
            {
                if (this.PostedFile == null)
                {
                    this.Download();
                }
                else
                {
                    this.Upload();
                }

                this.ExtractTheme();

                bool isValid = this.Validate();

                if (!isValid)
                {
                    throw new ThemeInstallException("The uploaded archive is not a valid frapid theme!");
                }

                this.CopyTheme(tenant);
                return this.ThemeInfo;
            }
            finally
            {
                if (Directory.Exists(this.ArchivePath.Replace(".zip", "")))
                {
                    Directory.Delete(this.ArchivePath.Replace(".zip", ""), true);
                }
                if (File.Exists(this.ArchivePath))
                {
                    File.Delete(this.ArchivePath);
                }
            }
        }
    }

Usage Example

コード例 #1
0
        private ActionResult Upload(ThemeUploader uploader)
        {
            try
            {
                uploader.Install();
            }
            catch (ThemeUploadException ex)
            {
                return this.AjaxFail(ex.Message, HttpStatusCode.BadRequest);
            }
            catch (ThemeInstallException ex)
            {
                return this.AjaxFail(ex.Message, HttpStatusCode.BadRequest);
            }

            return Json(new {success = true}, JsonRequestBehavior.AllowGet);
        }
All Usage Examples Of Frapid.WebsiteBuilder.Models.Themes.ThemeUploader::Install