mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-02-02 13:07:34 +00:00
Make release screenshots optional.
This commit is contained in:
parent
6f41a9f80f
commit
e8b18cbf92
3 changed files with 19 additions and 14 deletions
|
@ -145,21 +145,24 @@ namespace Project_Unite.Controllers
|
||||||
//Now the download is saved in the DB. Let's get it on the server.
|
//Now the download is saved in the DB. Let's get it on the server.
|
||||||
model.Download.SaveAs(mapped_dir);
|
model.Download.SaveAs(mapped_dir);
|
||||||
|
|
||||||
download_dir = "~/Uploads/Releases/Screenshots/";
|
if (model.Screenshot != null)
|
||||||
mapped_dir = Server.MapPath(download_dir);
|
|
||||||
if (!Directory.Exists(mapped_dir))
|
|
||||||
Directory.CreateDirectory(mapped_dir);
|
|
||||||
|
|
||||||
file_name_d = model.Screenshot.FileName.ToLower(); ;
|
|
||||||
foreach (var c in file_name_d.ToCharArray())
|
|
||||||
{
|
{
|
||||||
if (!ApprovedIdChars.Contains(c))
|
download_dir = "~/Uploads/Releases/Screenshots/";
|
||||||
file_name_d = file_name_d.Replace(c, '_');
|
mapped_dir = Server.MapPath(download_dir);
|
||||||
|
if (!Directory.Exists(mapped_dir))
|
||||||
|
Directory.CreateDirectory(mapped_dir);
|
||||||
|
|
||||||
|
file_name_d = model.Screenshot.FileName.ToLower(); ;
|
||||||
|
foreach (var c in file_name_d.ToCharArray())
|
||||||
|
{
|
||||||
|
if (!ApprovedIdChars.Contains(c))
|
||||||
|
file_name_d = file_name_d.Replace(c, '_');
|
||||||
|
}
|
||||||
|
download_dir += file_name_d;
|
||||||
|
mapped_dir = Server.MapPath(download_dir);
|
||||||
|
download.ScreenshotUrl = download_dir.Remove(0, 1);
|
||||||
|
model.Screenshot.SaveAs(mapped_dir);
|
||||||
}
|
}
|
||||||
download_dir += file_name_d;
|
|
||||||
mapped_dir = Server.MapPath(download_dir);
|
|
||||||
download.ScreenshotUrl = download_dir.Remove(0,1);
|
|
||||||
model.Screenshot.SaveAs(mapped_dir);
|
|
||||||
|
|
||||||
//Now we just save to the database...
|
//Now we just save to the database...
|
||||||
db.Downloads.Add(download);
|
db.Downloads.Add(download);
|
||||||
|
|
|
@ -45,7 +45,6 @@ namespace Project_Unite.Models
|
||||||
[Required(ErrorMessage = "You must name your build!")]
|
[Required(ErrorMessage = "You must name your build!")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage ="A screenshot is necessary for getting users into the game.")]
|
|
||||||
[DataType(DataType.Upload)]
|
[DataType(DataType.Upload)]
|
||||||
public HttpPostedFileBase Screenshot { get; set; }
|
public HttpPostedFileBase Screenshot { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,10 @@
|
||||||
<iframe src="http://youtube.com/embed/@Model.DevUpdateId" frameborder="0" allowfullscreen autoplay="true" style="width:720px;height:480px;"></iframe>
|
<iframe src="http://youtube.com/embed/@Model.DevUpdateId" frameborder="0" allowfullscreen autoplay="true" style="width:720px;height:480px;"></iframe>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(Model.ScreenshotUrl))
|
||||||
|
{
|
||||||
<img src="@Model.ScreenshotUrl" style="width:auto;height:auto;max-width:100%" />
|
<img src="@Model.ScreenshotUrl" style="width:auto;height:auto;max-width:100%" />
|
||||||
|
}
|
||||||
|
|
||||||
@Html.Markdown(Model.Changelog)
|
@Html.Markdown(Model.Changelog)
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue