FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ASP.NET-MVC-JavaScript-Routing/Output/Program.cs at master · WestDiscGolf/ASP.NET-MVC-JavaScript-Routing · GitHub
WestDiscGolf
/
ASP.NET-MVC-JavaScript-Routing
Public
Notifications
You must be signed in to change notification settings
Fork
5
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ASP.NET-MVC-JavaScript-Routing
/
Output
/
Program.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (37 loc) · 1.79 KB
Breadcrumbs
ASP.NET-MVC-JavaScript-Routing
/
Output
/
Program.cs
Copy path
File metadata and controls
45 lines (37 loc) · 1.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using
System
;
using
System
.
IO
;
using
System
.
Linq
;
using
JsRouting
.
Core
;
namespace
Output
{
public
static
class
Program
{
private
static
readonly
string
[
]
DoNotScan
=
{
"JsRouting."
,
"StructureMap.dll"
}
;
public
static
void
Main
(
string
[
]
args
)
{
if
(
args
.
Length
<
2
)
throw
new
Exception
(
"Must specify JavaScript file as first argument and additional directories containing assemblies after for the routes to be output correctly."
)
;
var
outputLocation
=
args
.
First
(
)
.
Without
(
"
\"
"
)
.
Trim
(
)
;
// get a stream of assemblies that could contain routes, constraints, etc
var
assemblies
=
from
assemblyDirectory
in
args
.
Skip
(
1
)
from
fileLocation
in
Directory
.
EnumerateFiles
(
assemblyDirectory
.
Without
(
"
\"
"
)
.
Trim
(
)
)
where
fileLocation
.
EndsWith
(
".dll"
)
let
fileName
=
Path
.
GetFileName
(
fileLocation
)
where
!
DoNotScan
.
Any
(
fileName
.
Contains
)
// HACK to not scan StrucuteMap and the JsRouting DLLs
select
fileLocation
;
var
outputJs
=
JsRouting
.
Core
.
Output
.
ManagerJs
+
AssemblyLoader
.
Load
(
assemblies
)
.
GetInstance
<
JsRouting
.
Core
.
Output
>
(
)
.
ToJavaScript
(
)
;
// delete file if it already exists
if
(
File
.
Exists
(
outputLocation
)
)
File
.
Delete
(
outputLocation
)
;
// write to path
File
.
WriteAllText
(
outputLocation
,
outputJs
)
;
}
private
static
string
Without
(
this
string
original
,
string
substring
)
{
return
(
original
??
string
.
Empty
)
.
Replace
(
substring
,
string
.
Empty
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL