Files
OurUmbraco/OurUmbraco.Site/macroScripts/Documentation-GithubSync.cshtml
2015-07-26 11:59:33 +02:00

31 lines
911 B
Plaintext

@using OurUmbraco.Documentation.Busineslogic.GithubSourcePull
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
if (string.IsNullOrEmpty(Request["id"]))
{
const string rootFolder = @"~\Documentation";
const string config = @"~\config\githubpull.config";
var rootFolderPath = HttpContext.Current.Server.MapPath(rootFolder);
var configPath = HttpContext.Current.Server.MapPath(config);
if (!Directory.Exists(rootFolderPath))
{
Directory.CreateDirectory(rootFolderPath);
}
var unzip = new ZipDownloader(rootFolderPath, configPath);
unzip.IsProjectDocumentation = true;
unzip.Run();
}
else
{
int id = 0;
if (int.TryParse(Request["id"], out id))
{
ZipDownloader zip = new ZipDownloader(id);
zip.Run();
}
}
}