Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
send-file-api
Project
Project
Details
Activity
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alan Farhadi
send-file-api
Commits
25fa9324
Commit
25fa9324
authored
5 years ago
by
Mahmoud Bakhtvar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fileName.OpenReadStream is used
parent
0883f181
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
SCUController.cs
Controllers/SCUController.cs
+4
-6
No files found.
Controllers/SCUController.cs
View file @
25fa9324
...
@@ -7,6 +7,7 @@ using System.Reactive.Linq;
...
@@ -7,6 +7,7 @@ using System.Reactive.Linq;
using
System.Reactive.Threading.Tasks
;
using
System.Reactive.Threading.Tasks
;
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Dicom
;
using
Dicom.Network.Client
;
using
Dicom.Network.Client
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
...
@@ -52,15 +53,12 @@ namespace SendFileWebapi.Controllers
...
@@ -52,15 +53,12 @@ namespace SendFileWebapi.Controllers
inputsDto
.
FileNames
.
ToObservable
()
inputsDto
.
FileNames
.
ToObservable
()
.
Select
(
fileName
=>
Observable
.
FromAsync
(
async
()
=>
.
Select
(
fileName
=>
Observable
.
FromAsync
(
async
()
=>
{
{
FileStream
fileStream
=
null
;
using
(
var
stream
=
fileName
.
OpenReadStream
())
using
(
var
stream
=
new
FileStream
(
fileName
.
FileName
,
FileMode
.
Create
))
{
{
await
fileName
.
CopyToAsync
(
stream
);
var
request
=
new
Dicom
.
Network
.
DicomCStoreRequest
(
await
DicomFile
.
OpenAsync
(
stream
));
fileStream
=
stream
;
}
var
request
=
new
Dicom
.
Network
.
DicomCStoreRequest
(
fileStream
.
Name
);
await
client
.
AddRequestAsync
(
request
);
await
client
.
AddRequestAsync
(
request
);
await
client
.
SendAsync
();
await
client
.
SendAsync
();
}
}).
Select
(
x
=>
fileName
.
FileName
).
Catch
<
string
,
Exception
>(
exp
=>
throw
new
Exception
(
$"failed to send:
{
fileName
}
, with error:
{
exp
.
Message
}
"
)))
}).
Select
(
x
=>
fileName
.
FileName
).
Catch
<
string
,
Exception
>(
exp
=>
throw
new
Exception
(
$"failed to send:
{
fileName
}
, with error:
{
exp
.
Message
}
"
)))
.
Concat
()
.
Concat
()
.
Subscribe
(
.
Subscribe
(
...
...
This diff is collapsed.
Click to expand it.
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