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);
}
}
}
}