using Newtonsoft.Json.Linq;
using ZipProject.Models;
-namespace ZipProject.Controllers {
- public class WebZipController : Controller {
+namespace ZipProject.Controllers
+{
+ public class WebZipController : Controller
+ {
private readonly ISession session;
- public WebZipController (IHttpContextAccessor httpContextAccessor) {
+ public WebZipController(IHttpContextAccessor httpContextAccessor)
+ {
this.session = httpContextAccessor.HttpContext.Session;
}
// GET: /<controller>/
- public IActionResult Index (string partial_name) {
- if (string.IsNullOrEmpty (HttpContext.Session.GetString ("lang"))) {
- session.SetString ("lang", "kr");
+ public IActionResult Index(string partial_name)
+ {
+ if (string.IsNullOrEmpty(HttpContext.Session.GetString("lang")))
+ {
+ session.SetString("lang", "kr");
}
- if (string.IsNullOrEmpty (partial_name))
+ if (string.IsNullOrEmpty(partial_name))
ViewData["partial_page"] = "partial_zip";
else
ViewData["partial_page"] = partial_name;
- return View ();
+ return View();
}
- public IActionResult En () {
- session.SetString ("lang", "en");
- return Redirect ("/");
+ public IActionResult En()
+ {
+ session.SetString("lang", "en");
+ return Redirect("/");
}
- public IActionResult Kr () {
- session.SetString ("lang", "kr");
- return Redirect ("/");
+ public IActionResult Kr()
+ {
+ session.SetString("lang", "kr");
+ return Redirect("/");
}
//파일업로드 사이즈 3GB (3(GB) * 1024(MB) * 1024(KB) * 1024(byte))
- [RequestSizeLimit (3221225472)]
- public ActionResult FileUpload (string dirList, List<IFormFile> files, string fileKeyPair, string format, string uuid) {
- JObject keyPair_FileDir = JObject.Parse (fileKeyPair);
+ [RequestSizeLimit(3221225472)]
+ public ActionResult FileUpload(string dirList, List<IFormFile> files, string fileKeyPair, string format, string uuid)
+ {
+ JObject keyPair_FileDir = JObject.Parse(fileKeyPair);
Console.WriteLine(dirList);
- Dictionary<string, object> data = new Dictionary<string, object> ();
- ZipModel zipModel = new ZipModel ();
+ Dictionary<string, object> data = new Dictionary<string, object>();
+ ZipModel zipModel = new ZipModel();
- Dictionary<string, string> test= new Dictionary<string, string> ();
+ Dictionary<string, string> test = new Dictionary<string, string>();
- string[] listDir = dirList.Split (',');
+ string[] listDir = dirList.Split(',');
string filename = listDir[0] + "." + format;
- zipModel.SetParam (keyPair_FileDir, listDir, files, uuid, uuid);
- zipModel.MakeZip ();
+ zipModel.SetParam(keyPair_FileDir, listDir, files, uuid, uuid);
+ zipModel.MakeZip();
- return Json ("");
+ return Json("");
}
- public async Task<ActionResult> FileUploadProgress (string uuid) {
- SimpleLongPolling longPolling = new SimpleLongPolling (uuid);
- var msg = await longPolling.WaitAsync ();
- return Json (msg);
+ public async Task<ActionResult> FileUploadProgress(string uuid)
+ {
+ SimpleLongPolling longPolling = new SimpleLongPolling(uuid);
+ var msg = await longPolling.WaitAsync();
+ return Json(msg);
}
- public ActionResult DownloadZip (string uuid) {
- string path = Environment.CurrentDirectory + "/wwwroot/zipfiles/" + uuid + ".zip";
- byte[] file = System.IO.File.ReadAllBytes (path);
- System.IO.File.Delete (path);
- return File (file, "application/zip");
+ public ActionResult DownloadZip(string uuid)
+ {
+ string path;
+#if !DEBUG
+ path = Environment.CurrentDirectory + "/release/netcoreapp2.1/publish/wwwroot/zipfiles/" + uuid + ".zip";
+#else
+ path = Environment.CurrentDirectory + "/wwwroot/zipfiles/" + uuid + ".zip";
+#endif
+ byte[] file = System.IO.File.ReadAllBytes(path);
+ System.IO.File.Delete(path);
+ return File(file, "application/zip");
}
- public ActionResult tst () {
+ public ActionResult tst()
+ {
double now = 1;
double per = 1;
- now = now + (int) 1;
- return Json (per == (int) 1);
+ now = now + (int)1;
+ return Json(per == (int)1);
}
- public ActionResult Error () {
- return View (new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
+ public ActionResult Error()
+ {
+ return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
+ }
+
+ [HttpGet("/static/{name}")]
+ public IActionResult Static(string name)
+ {
+ string path;
+ string re_name = name.Replace(":", "/");
+ string type = re_name.Split('.')[re_name.Split('.').Count() - 1];
+ string content_type;
+ Dictionary<string, string> pair = new Dictionary<string, string>(){
+ {"css", "text/css"},
+ {"js", "text/javascript"},
+ {"json", "application/json"},
+ {"etc", "Multipart/related"}
+ };
+
+ try
+ {
+ content_type = pair[type];
+ }
+ catch (KeyNotFoundException)
+ {
+ content_type = pair["etc"];
+ }
+
+#if !DEBUG
+ path = Environment.CurrentDirectory + "/release/netcoreapp2.1/publish/wwwroot/" + re_name;
+#else
+ path = Environment.CurrentDirectory + "/wwwroot/" + re_name;
+#endif
+
+ byte[] file = System.IO.File.ReadAllBytes(path);
+ return File(file, content_type, "StaticFile");
}
}
public static string GetText (string lang, string id) {
#if !DEBUG
- string path = Environment.CurrentDirectory + "release/netcoreapp2.1/publish/wwwroot/Language/" + lang + ".json";
+ string path = Environment.CurrentDirectory + "/release/netcoreapp2.1/publish/wwwroot/Language/" + lang + ".json";
#else
string path = Environment.CurrentDirectory + "/wwwroot/Language/" + lang + ".json";
#endif
-
+
string json = File.OpenText (path).ReadToEnd ();
dynamic result = JsonConvert.DeserializeObject<dynamic> (json);
using Microsoft.Extensions.Configuration;\r
using Microsoft.Extensions.Logging;\r
\r
-namespace ZipProject {\r
- public class Program {\r
- public static void Main (string[] args) {\r
+namespace ZipProject\r
+{\r
+ public class Program\r
+ {\r
+ public static void Main(string[] args)\r
+ {\r
string port;\r
- #if !DEBUG //published\r
- port= "5001";\r
- #else //debug\r
- port= "9999";\r
- #endif\r
- CreateWebHostBuilder (args).UseUrls ("http://localhost:" + port).Build ().Run ();\r
+#if !DEBUG //published\r
+ port= "5001";\r
+#else //debug\r
+ port = "9999";\r
+#endif\r
+ CreateWebHostBuilder(args).UseUrls("http://localhost:" + port).Build().Run();\r
}\r
\r
- public static IWebHostBuilder CreateWebHostBuilder (string[] args) =>\r
- WebHost.CreateDefaultBuilder (args)\r
- .UseStartup<Startup> ();\r
+ public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>\r
+ WebHost.CreateDefaultBuilder(args)\r
+ .UseStartup<Startup>();\r
}\r
}
\ No newline at end of file
app.UseCookiePolicy ();\r
app.UseSession ();\r
app.UseStatusCodePages ("text/plain", "status code page, status code: {0}");\r
-\r
app.UseMvc (routes => {\r
routes.MapRoute (\r
name: "default",\r
- template: "{controller=WebZip}/{action=Index}/{id?}");\r
+ template: "{controller=WebZip}/{action=Index}/{id?}"\r
+ );\r
+ // routes.MapRoute(\r
+ // name: "static",\r
+ // template: "static/{controller=WebZip}/{action=Static}/{name?}"\r
+ // );\r
});\r
\r
}\r
-<!DOCTYPE html>\r
+<!DOCTYPE html>\r
<html>\r
<head>\r
<meta charset="utf-8" />\r
<link rel="canonical" href="https://wabiey.com">\r
<title>@ViewData["Title"]</title>\r
\r
- <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />\r
- <link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>\r
+ <link rel="stylesheet" href="/static/lib:bootstrap:dist:css:bootstrap.css" />\r
+ <link rel="stylesheet" href="/static/css:site.css" asp-append-version="true"/>\r
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous" asp-append-version="true">\r
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"\r
- asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"\r
+ asp-fallback-href="/static/lib:bootstrap:dist:css:bootstrap.min.css"\r
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />\r
\r
\r
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js"\r
- asp-fallback-src="~/lib/jquery/dist/jquery.min.js"\r
+ asp-fallback-src="/static/lib:jquery:dist:jquery.min.js"\r
asp-fallback-test="window.jQuery"\r
crossorigin="anonymous"\r
integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT">\r
</script>\r
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"\r
- asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"\r
+ asp-fallback-src="/static/lib:bootstrap:dist:js:bootstrap.min.js"\r
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"\r
crossorigin="anonymous"\r
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">\r
</script>\r
- <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>\r
- <script src="~/js/site.js" asp-append-version="true"></script>\r
+ \r
+ <script src="/static/lib:bootstrap:dist:js:bootstrap.js"></script>\r
+ <script src="/static/js:site.js" asp-append-version="true"></script>\r
<script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>\r
<style>\r
.navbar-default {\r
var _Language;\r
$.ajax({\r
type: "get",\r
- url: "/Language/"+lang+".json",\r
+ url: "/static/Language:"+lang+".json",\r
async: false,\r
cache: false\r
}).done(function(data){\r
});\r
</script>\r
</head>\r
-<body>\r
+<body oncontextmenu= "return false;" onselectstart= "return false;" ondragstart= "return false;">\r
\r
<!-- navbar -->\r
<partial name="_Navbar" />\r
<span class="icon-bar"></span>\r
</button>\r
<span class="navbar-brand" style="padding: 4px;">\r
- <a href=""><img src="~/images/logo.png" class="webzip-navlogo" alt="logo"/></a>\r
+ <a href=""><img src="/static/images:logo.png" class="webzip-navlogo" alt="logo"/></a>\r
</span>\r
</div>\r
<div class="collapse navbar-collapse webzip-navbar">\r
var partial_page= "@ViewData["partial_page"]";\r
</script>\r
\r
- <script src="~/js/Zip/Index.js" asp-append-version="true"></script>\r
+ <script src="/static/js:Zip:Index.js" asp-append-version="true"></script>\r
\r
<!-- #region 모바일 클릭, 더블클릭, 드래그(메뉴소환) 이벤트 -->\r
<script>\r
display: none;\r
z-index: 2000;\r
background: rgba( 255, 255, 255, .8 )\r
- url('/images/spinner.gif')\r
+ url('/static/images:spinner.gif')\r
50% 50%\r
no-repeat;\r
text-align: center;\r
var folder_open= "▼";\r
var folder= "▶";\r
</script>\r
-<script src="~/js/Zip/partial_zip.js" asp-append-version="true"></script>
\ No newline at end of file
+<script src="/static/js:Zip:partial_zip.js" asp-append-version="true"></script>
\ No newline at end of file
--- /dev/null
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+ * You misspelled a built-in dotnet command.\r
+ * You intended to execute a .NET Core program, but dotnet-release/netcoreapp2.1/ZipProject.dll does not exist.\r
+ * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+ * You misspelled a built-in dotnet command.\r
+ * You intended to execute a .NET Core program, but dotnet-release/netcoreapp2.1/ZipProject.dll does not exist.\r
+ * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+ * You misspelled a built-in dotnet command.\r
+ * You intended to execute a .NET Core program, but dotnet-/home/dhkq92/.nicezip/release/netcoreapp2.1/ZipProject.dll does not exist.\r
+ * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+ * You misspelled a built-in dotnet command.\r
+ * You intended to execute a .NET Core program, but dotnet-/home/dhkq92/.nicezip/release/netcoreapp2.1/ZipProject.dll does not exist.\r
+ * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+ * You misspelled a built-in dotnet command.\r
+ * You intended to execute a .NET Core program, but dotnet-/home/dhkq92/.nicezip/release/netcoreapp2.1/ZipProject.dll does not exist.\r
+ * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+
+Unhandled Exception: System.ArgumentException: The content root '/home/dhkq92/.publish/nicezip/nicezip_sources/ZipProject/release/netcoreapp2.1/publish/wwwroot' does not exist.
+Parameter name: contentRootPath
+ at Microsoft.AspNetCore.Hosting.Internal.HostingEnvironmentExtensions.Initialize(IHostingEnvironment hostingEnvironment, String contentRootPath, WebHostOptions options)
+ at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
+ at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
+ at ZipProject.Program.Main(String[] args) in /home/dhkq92/.publish/nicezip/nicezip_sources/ZipProject/Program.cs:line 26
display: none !important;\r
}\r
}\r
-/*# sourceMappingURL=bootstrap.css.map */\r
+++ /dev/null
-
-cd ZipProject
-dotnet publish --configuration ../../../nicezip/release
--- /dev/null
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+ * You misspelled a built-in dotnet command.\r
+ * You intended to execute a .NET Core program, but dotnet-release/netcoreapp2.1/ZipProject.dll does not exist.\r
+ * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
--- /dev/null
+
+cd ZipProject
+dotnet publish --configuration ../../../release
+cd ../../
+./runserver