Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guru
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
guru
Commits
1d3c4232
Commit
1d3c4232
authored
Oct 17, 2018
by
Clint Mourlevat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding QrCode Action
parent
0baba17a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
HomeController.cs
Controllers/HomeController.cs
+18
-0
No files found.
Controllers/HomeController.cs
View file @
1d3c4232
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
QRCoder
;
using
UnityEngine
;
using
Color
=
System
.
Drawing
.
Color
;
namespace
Stratis.Guru.Controllers
namespace
Stratis.Guru.Controllers
{
{
...
@@ -31,5 +38,16 @@ namespace Stratis.Guru.Controllers
...
@@ -31,5 +38,16 @@ namespace Stratis.Guru.Controllers
{
{
return
View
();
return
View
();
}
}
[
Route
(
"qr/{value}"
)]
public
IActionResult
Qr
(
string
value
)
{
var
memoryStream
=
new
MemoryStream
();
var
qrGenerator
=
new
QRCodeGenerator
();
var
qrCodeData
=
qrGenerator
.
CreateQrCode
(
value
,
QRCodeGenerator
.
ECCLevel
.
L
);
var
qrCode
=
new
QRCode
(
qrCodeData
);
qrCode
.
GetGraphic
(
20
,
Color
.
Black
,
Color
.
White
,
false
).
Save
(
memoryStream
,
ImageFormat
.
Png
);
return
File
(
memoryStream
.
ToArray
(),
"image/png"
);
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment