Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
927e633a
Commit
927e633a
authored
Oct 28, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加DownloadService
parent
0a8be1c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
2 deletions
+71
-2
app/app-detail.component.ts
app/app-detail.component.ts
+4
-1
app/download.service.ts
app/download.service.ts
+25
-0
aria2.ts
aria2.ts
+40
-0
systemjs.config.js
systemjs.config.js
+2
-1
No files found.
app/app-detail.component.ts
View file @
927e633a
...
@@ -3,6 +3,7 @@ import {AppsService} from "./apps.service";
...
@@ -3,6 +3,7 @@ import {AppsService} from "./apps.service";
import
{
InstallConfig
}
from
"
./install-config
"
;
import
{
InstallConfig
}
from
"
./install-config
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
import
{
App
}
from
"
./app
"
;
import
{
App
}
from
"
./app
"
;
import
{
DownloadService
}
from
"
./download.service
"
;
declare
var
System
;
declare
var
System
;
declare
var
process
;
declare
var
process
;
...
@@ -32,6 +33,7 @@ sudo.fork = function (modulePath, args, options) {
...
@@ -32,6 +33,7 @@ sudo.fork = function (modulePath, args, options) {
selector
:
'
app-detail
'
,
selector
:
'
app-detail
'
,
templateUrl
:
'
app/app-detail.component.html
'
,
templateUrl
:
'
app/app-detail.component.html
'
,
styleUrls
:
[
'
app/app-detail.component.css
'
],
styleUrls
:
[
'
app/app-detail.component.css
'
],
providers
:
[
DownloadService
]
})
})
export
class
AppDetailComponent
implements
OnInit
{
export
class
AppDetailComponent
implements
OnInit
{
platform
=
process
.
platform
;
platform
=
process
.
platform
;
...
@@ -43,7 +45,8 @@ export class AppDetailComponent implements OnInit {
...
@@ -43,7 +45,8 @@ export class AppDetailComponent implements OnInit {
installConfig
:
InstallConfig
;
installConfig
:
InstallConfig
;
constructor
(
private
appsService
:
AppsService
,
private
settingsService
:
SettingsService
)
{
constructor
(
private
appsService
:
AppsService
,
private
settingsService
:
SettingsService
,
private
downloadService
:
DownloadService
)
{
}
}
ngOnInit
()
{
ngOnInit
()
{
...
...
app/download.service.ts
0 → 100644
View file @
927e633a
/**
* Created by weijian on 2016/10/26.
*/
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
import
{
ipcRenderer
}
from
"
electron
"
;
@
Injectable
()
export
class
DownloadService
{
constructor
(
private
settingsService
:
SettingsService
)
{
ipcRenderer
.
send
(
"
download-message
"
,
"
123
"
);
}
sendEvent
(
event
,
args
)
{
ipcRenderer
.
send
()
}
listenEvent
()
{
console
.
log
(
ipcRenderer
);
}
}
aria2.ts
0 → 100644
View file @
927e633a
/**
* Created by weijian on 2016/10/27.
*/
const
Rx
=
require
(
"
rxjs/Rx
"
);
const
{
ipcMain
}
=
require
(
'
electron
'
);
import
{
ChildProcess
,
spawn
}
from
"
child_process
"
;
// import * as Aria2 from "aria2";
const
Aria2
=
require
(
"
aria2
"
);
let
a
=
(
createProcess
(
"
D:/Github/mycard/bin/aria2c.exe
"
,
[
'
--enable-rpc
'
,
'
--rpc-allow-origin-all
'
,
"
--continue
"
,
"
--split=10
"
,
"
--min-split-size=1M
"
,
"
--max-connection-per-server=10
"
]))
a
.
on
(
'
error
'
,
(
error
)
=>
{
console
.
log
(
error
);
});
// console.log(Aria2,2);
function
createProcess
(
aria2c_path
:
string
,
args
:
string
[]
=
[]):
ChildProcess
{
return
spawn
(
aria2c_path
,
args
);
}
let
options
=
{
'
host
'
:
'
localhost
'
,
'
port
'
:
6800
,
'
secure
'
:
false
}
let
aria2
=
new
Aria2
(
options
);
aria2
.
onDownloadComplete
=
(
response
)
=>
{
console
.
log
(
response
);
};
let
open
=
aria2
.
open
();
function
addUri
(
uri
:
string
[],
path
:
string
)
{
return
open
.
then
(()
=>
{
return
aria2
.
addUri
(
uri
,
{
'
dir
'
:
path
});
});
}
function
pause
(
gid
:
string
):
Promise
<
string
>
{
return
aria2
.
pause
(
gid
)
}
function
reportStatus
()
{
aria2
.
tellActive
()
}
ipcMain
.
on
()
systemjs.config.js
View file @
927e633a
...
@@ -10,7 +10,8 @@
...
@@ -10,7 +10,8 @@
'
angular2-in-memory-web-api
'
:
'
node_modules/angular2-in-memory-web-api
'
,
'
angular2-in-memory-web-api
'
:
'
node_modules/angular2-in-memory-web-api
'
,
'
rxjs
'
:
'
node_modules/rxjs
'
,
'
rxjs
'
:
'
node_modules/rxjs
'
,
'
ng2-translate
'
:
'
node_modules/ng2-translate/bundles/ng2-translate.js
'
,
'
ng2-translate
'
:
'
node_modules/ng2-translate/bundles/ng2-translate.js
'
,
"
os
"
:
''
"
os
"
:
''
,
"
electron
"
:
"
@node/electron
"
};
};
// packages tells the System loader how to load when no filename and/or no extension
// packages tells the System loader how to load when no filename and/or no extension
var
packages
=
{
var
packages
=
{
...
...
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