mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-10 22:02:13 +02:00
Compare commits
460 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
05b99801f7 | ||
![]() |
5116330180 | ||
![]() |
cfe6ace07a | ||
![]() |
2eb4356288 | ||
![]() |
1ceff06def | ||
![]() |
57c4765fab | ||
![]() |
f1188d548a | ||
![]() |
327100ae6a | ||
![]() |
3ed887d926 | ||
![]() |
95f96662bf | ||
![]() |
f8b6b17c29 | ||
![]() |
e6afe4d432 | ||
![]() |
961f84f74d | ||
![]() |
934d5034e2 | ||
![]() |
2310d08f99 | ||
![]() |
61a8585e43 | ||
![]() |
44aa33a7e0 | ||
![]() |
0b74f762a3 | ||
![]() |
89460f1c73 | ||
![]() |
6fbffb587b | ||
![]() |
9342496a12 | ||
![]() |
eb5d6d62f5 | ||
![]() |
a134a77b9f | ||
![]() |
ee8464219f | ||
![]() |
f8120363f4 | ||
![]() |
716be92693 | ||
![]() |
73ea3d899d | ||
![]() |
376888cd8f | ||
![]() |
bd672a36df | ||
![]() |
d5d0027843 | ||
![]() |
e782456c99 | ||
![]() |
d0596febac | ||
![]() |
a9e14cc4af | ||
![]() |
35580224c7 | ||
![]() |
b8bfa809e8 | ||
![]() |
bf508d1700 | ||
![]() |
601da8c51a | ||
![]() |
714748e892 | ||
![]() |
6d07008e1f | ||
![]() |
95abf9bb6a | ||
![]() |
9e7d2a2bee | ||
![]() |
bfe453b4de | ||
![]() |
f999e6657b | ||
![]() |
02d0f9c5a1 | ||
![]() |
4341136ddb | ||
![]() |
afd5994d8b | ||
![]() |
a6dbd08dd0 | ||
![]() |
168aebb0fd | ||
![]() |
2aa0dc7f4f | ||
![]() |
0d9e687e66 | ||
![]() |
78d7bceecb | ||
![]() |
088187c33f | ||
![]() |
c1483611f6 | ||
![]() |
27e0736869 | ||
![]() |
cbc1afb497 | ||
![]() |
e453e3924e | ||
![]() |
e3e7cf4a21 | ||
![]() |
1e17510bcd | ||
![]() |
5a8fae4b14 | ||
![]() |
9c3f76def2 | ||
![]() |
12321eebdd | ||
![]() |
9ef75f8963 | ||
![]() |
3a0d814903 | ||
![]() |
058c12175d | ||
![]() |
62fdd46c85 | ||
![]() |
f8dad55c22 | ||
![]() |
83717cc220 | ||
![]() |
09d00eba32 | ||
![]() |
c07fc4de44 | ||
![]() |
ea6f65e725 | ||
![]() |
4392219158 | ||
![]() |
e56875f1a3 | ||
![]() |
87b3f7e108 | ||
![]() |
97bf0e50b0 | ||
![]() |
10e81d15d2 | ||
![]() |
4552e7c1dc | ||
![]() |
a87cdc3443 | ||
![]() |
b65ab8b435 | ||
![]() |
d6cabc0c2d | ||
![]() |
ccd53497af | ||
![]() |
9276be829e | ||
![]() |
bb7fb1ec37 | ||
![]() |
1fd78c7072 | ||
![]() |
4c9cb1d6e5 | ||
![]() |
502f2a0778 | ||
![]() |
8c1c8ba885 | ||
![]() |
8be7d57d50 | ||
![]() |
9cd21ba7d0 | ||
![]() |
5c10d64b68 | ||
![]() |
07df789345 | ||
![]() |
45c07d5cbe | ||
![]() |
31aa7a9bad | ||
![]() |
25dd18ebcc | ||
![]() |
cc615b498d | ||
![]() |
461308c32f | ||
![]() |
c0f7d0846f | ||
![]() |
3389ea1cb4 | ||
![]() |
bd98a950ac | ||
![]() |
eb6e178c2f | ||
![]() |
b71cd56d76 | ||
![]() |
a8c835fb8d | ||
![]() |
67d1435728 | ||
![]() |
573d36b648 | ||
![]() |
9f19802537 | ||
![]() |
0076df1212 | ||
![]() |
e7fd955da0 | ||
![]() |
6595e38b6f | ||
![]() |
dfa91c46a9 | ||
![]() |
b46b36cfd9 | ||
![]() |
305f96b2ec | ||
![]() |
982300ec6e | ||
![]() |
54dfa619d5 | ||
![]() |
d55e9b6e3d | ||
![]() |
53e680ea87 | ||
![]() |
9437765697 | ||
![]() |
61f78a5367 | ||
![]() |
1c192c6cc9 | ||
![]() |
66b8448186 | ||
![]() |
353dadba0b | ||
![]() |
4f9c098e6a | ||
![]() |
b8d0c75f7e | ||
![]() |
f6240c3cf0 | ||
![]() |
38a891ed1c | ||
![]() |
ce7b3489be | ||
![]() |
06266e2cc5 | ||
![]() |
e8bb1680f3 | ||
![]() |
8d6dbcf336 | ||
![]() |
7996417c85 | ||
![]() |
f45c58b2bd | ||
![]() |
1c8dfdc8c5 | ||
![]() |
f846996841 | ||
![]() |
372bd46c47 | ||
![]() |
cf0f355960 | ||
![]() |
b39740848d | ||
![]() |
1e3de38db7 | ||
![]() |
1fa36925ad | ||
![]() |
116a9026a0 | ||
![]() |
61a0c34aef | ||
![]() |
c7656971a2 | ||
![]() |
a2611a5797 | ||
![]() |
6571f3671c | ||
![]() |
11e41485df | ||
![]() |
7bd3c9a541 | ||
![]() |
5893eacc84 | ||
![]() |
e1d28b25a8 | ||
![]() |
ccd0e65e66 | ||
![]() |
f47a5ef13c | ||
![]() |
e566b409b9 | ||
![]() |
f39e23fbe8 | ||
![]() |
674be2843d | ||
![]() |
28bc720ab3 | ||
![]() |
748d85f32f | ||
![]() |
30ba1793c0 | ||
![]() |
a4710b43ba | ||
![]() |
523929e907 | ||
![]() |
25641229b8 | ||
![]() |
7289d763ef | ||
![]() |
2f680840a7 | ||
![]() |
096fb805a8 | ||
![]() |
95becfd00a | ||
![]() |
324bb48543 | ||
![]() |
f968bfe852 | ||
![]() |
754062c891 | ||
![]() |
7e3266489f | ||
![]() |
e65a8abf5e | ||
![]() |
54af84fcd3 | ||
![]() |
98446222c9 | ||
![]() |
c45929fe43 | ||
![]() |
acb4f31d3f | ||
![]() |
b69a731833 | ||
![]() |
c6cb71639b | ||
![]() |
ae8fe6f55b | ||
![]() |
7ffce8fb28 | ||
![]() |
e660c57ccb | ||
![]() |
3c0cae7166 | ||
![]() |
117f18886c | ||
![]() |
df5f799d46 | ||
![]() |
90f3e4f657 | ||
![]() |
c8dff6da72 | ||
![]() |
e007d321f6 | ||
![]() |
2766976c47 | ||
![]() |
18ebf3a95d | ||
![]() |
001074b101 | ||
![]() |
9a7fe91eb8 | ||
![]() |
0a2d0b40fb | ||
![]() |
ccde119454 | ||
![]() |
a4406ff96e | ||
![]() |
071e471b3c | ||
![]() |
d8056918db | ||
![]() |
ac0842f786 | ||
![]() |
d1ff05ac13 | ||
![]() |
6ea759aeab | ||
![]() |
6d0aa05761 | ||
![]() |
1725550b21 | ||
![]() |
12ce858cf3 | ||
![]() |
d14554e45b | ||
![]() |
2b198ef688 | ||
![]() |
1160a609ca | ||
![]() |
6baf3bba8c | ||
![]() |
bcc0b5b6bf | ||
![]() |
d70b4412ed | ||
![]() |
b72248ab3d | ||
![]() |
ec6f361241 | ||
![]() |
0a8d9d3447 | ||
![]() |
5dc7ebaba5 | ||
![]() |
fd6b70ef16 | ||
![]() |
517a82f1c7 | ||
![]() |
59add78cb6 | ||
![]() |
868fb8fa20 | ||
![]() |
2d06ab8d70 | ||
![]() |
3959fdc976 | ||
![]() |
39db187c78 | ||
![]() |
eb66e5618f | ||
![]() |
90f89542e2 | ||
![]() |
62eb3a2f62 | ||
![]() |
7a2ff0a60c | ||
![]() |
9fa6995ccb | ||
![]() |
9c03f0c35e | ||
![]() |
a0fd1db52e | ||
![]() |
12e0998556 | ||
![]() |
dd549b703c | ||
![]() |
c3202979e1 | ||
![]() |
edb2190799 | ||
![]() |
d4b61fe3a9 | ||
![]() |
478c41fed6 | ||
![]() |
394519e779 | ||
![]() |
2da52edbe5 | ||
![]() |
3b9d9ff0f8 | ||
![]() |
796bb70421 | ||
![]() |
ecacc0b129 | ||
![]() |
1606e3379f | ||
![]() |
922583ea5d | ||
![]() |
c76137a70c | ||
![]() |
95402f3d4f | ||
![]() |
daf6d8ff50 | ||
![]() |
37cf3e569c | ||
![]() |
70b9ecee1b | ||
![]() |
d3e43b290f | ||
![]() |
ea069810a5 | ||
![]() |
37587bdc7e | ||
![]() |
499b53e9ed | ||
![]() |
51042e91fc | ||
![]() |
33d85bc4f4 | ||
![]() |
84cb7bd62b | ||
![]() |
5689829cee | ||
![]() |
e123884a14 | ||
![]() |
33b4358696 | ||
![]() |
e714d8ab2c | ||
![]() |
7dc8cd3c8a | ||
![]() |
4ba1ea7000 | ||
![]() |
3478bebebb | ||
![]() |
36ac35f5b5 | ||
![]() |
615ee82f22 | ||
![]() |
33aaf723a9 | ||
![]() |
d3ecb66cc2 | ||
![]() |
b81cdac227 | ||
![]() |
7eec9b059c | ||
![]() |
3f146b0061 | ||
![]() |
78770ea2d2 | ||
![]() |
dc1e389708 | ||
![]() |
5d2f4aa50e | ||
![]() |
a49bbc2c32 | ||
![]() |
7785c9a532 | ||
![]() |
3b4b8ab902 | ||
![]() |
235a2f4f40 | ||
![]() |
17d6ee69ff | ||
![]() |
55e0297f81 | ||
![]() |
f6e2082d3d | ||
![]() |
d14eb12c00 | ||
![]() |
80da2abe10 | ||
![]() |
aa82506f5f | ||
![]() |
a2ce89d2da | ||
![]() |
9e9a98294b | ||
![]() |
b9aaef3d59 | ||
![]() |
db394fe99a | ||
![]() |
2673d5a796 | ||
![]() |
e9e8d29697 | ||
![]() |
ef0948f005 | ||
![]() |
e460c0402a | ||
![]() |
65be91c932 | ||
![]() |
45e8900b94 | ||
![]() |
738f6732a7 | ||
![]() |
de19b79054 | ||
![]() |
cc5fbec7fa | ||
![]() |
6b9609b4c9 | ||
![]() |
f31f89037c | ||
![]() |
960720b3e4 | ||
![]() |
e71eaa9c97 | ||
![]() |
84c2b0c8b9 | ||
![]() |
2e7fc987ac | ||
![]() |
6ab31b0443 | ||
![]() |
8891c04b84 | ||
![]() |
a894dfa736 | ||
![]() |
1622f40942 | ||
![]() |
560a413d19 | ||
![]() |
29a3768947 | ||
![]() |
23b844e86f | ||
![]() |
1e5aedea9d | ||
![]() |
bb10442216 | ||
![]() |
dd0bba9e5e | ||
![]() |
054ced7b44 | ||
![]() |
aa34bd8a83 | ||
![]() |
72605c64cc | ||
![]() |
7f53c52767 | ||
![]() |
c4d653bc2e | ||
![]() |
9ca7f641ad | ||
![]() |
b1c39c697a | ||
![]() |
fad2a10bef | ||
![]() |
4ec5815897 | ||
![]() |
59d3e792b3 | ||
![]() |
69ef08f019 | ||
![]() |
211bfbfdf0 | ||
![]() |
7746d11ea3 | ||
![]() |
bd480d10b3 | ||
![]() |
7961af1431 | ||
![]() |
e6e3d93a66 | ||
![]() |
a9f1daac73 | ||
![]() |
07fe9d1e07 | ||
![]() |
f6ed903ef5 | ||
![]() |
eaa4d0eb04 | ||
![]() |
63f7a8912b | ||
![]() |
4d51cecf4f | ||
![]() |
03a2800a8c | ||
![]() |
d79dd7e73e | ||
![]() |
b10813e420 | ||
![]() |
63ba324281 | ||
![]() |
195ec0a94c | ||
![]() |
c39feb7997 | ||
![]() |
3f4f8c795e | ||
![]() |
c92caf18c5 | ||
![]() |
ed28770170 | ||
![]() |
f045a1f350 | ||
![]() |
75f0cce064 | ||
![]() |
555e0d225c | ||
![]() |
705890d5ec | ||
![]() |
91f80e054c | ||
![]() |
c81c6b1e68 | ||
![]() |
7aecb9ac68 | ||
![]() |
9b1c0eb0c0 | ||
![]() |
e1c70b1e30 | ||
![]() |
133997959f | ||
![]() |
f2be137836 | ||
![]() |
58911849b7 | ||
![]() |
1359ad16f0 | ||
![]() |
01bf0b8144 | ||
![]() |
03843c8833 | ||
![]() |
0c49540671 | ||
![]() |
f16ebe06df | ||
![]() |
1a52731cd2 | ||
![]() |
e518a3b58e | ||
![]() |
33a97b148f | ||
![]() |
7f2aa4ccad | ||
![]() |
974565d907 | ||
![]() |
192406892d | ||
![]() |
869d89d663 | ||
![]() |
64daefb2b6 | ||
![]() |
055ef408f9 | ||
![]() |
eff8444d83 | ||
![]() |
91f2fc8c5a | ||
![]() |
c48711fcd7 | ||
![]() |
77878fbf4b | ||
![]() |
d8a4b1b25a | ||
![]() |
79b42c9e2e | ||
![]() |
41e0aaa2f5 | ||
![]() |
ef0acb5a7c | ||
![]() |
b3ba949215 | ||
![]() |
21d5ef6c22 | ||
![]() |
0fb395391b | ||
![]() |
b864269aaa | ||
![]() |
4b152b438b | ||
![]() |
3b5f061730 | ||
![]() |
1fd92ee5aa | ||
![]() |
e12daf0be9 | ||
![]() |
f929d714ec | ||
![]() |
a2fd26dcdc | ||
![]() |
34aa6eb9fe | ||
![]() |
e1ac1041a4 | ||
![]() |
72a7935dc3 | ||
![]() |
f2f38605bf | ||
![]() |
905d522a9b | ||
![]() |
c67e03c80a | ||
![]() |
ab7c1bc7e3 | ||
![]() |
d49435f805 | ||
![]() |
42b3e06cdd | ||
![]() |
658e112a46 | ||
![]() |
a651dea5a8 | ||
![]() |
e404389254 | ||
![]() |
25bd39e883 | ||
![]() |
97e9f86538 | ||
![]() |
469712c027 | ||
![]() |
f76ec51c62 | ||
![]() |
2a8b5ed6a9 | ||
![]() |
2800bee1cb | ||
![]() |
9573997586 | ||
![]() |
7cbad21e0b | ||
![]() |
a0987d9b50 | ||
![]() |
2ed6859116 | ||
![]() |
d205fb1ab3 | ||
![]() |
f02404cd45 | ||
![]() |
387f367041 | ||
![]() |
e9d7b21558 | ||
![]() |
de38afd346 | ||
![]() |
8806995a65 | ||
![]() |
e3766edc56 | ||
![]() |
53482a6d7d | ||
![]() |
b0f4957d1d | ||
![]() |
dd98aa6592 | ||
![]() |
916df7393b | ||
![]() |
29f72a26d2 | ||
![]() |
121f3c0197 | ||
![]() |
8fe9d08f35 | ||
![]() |
1a162bc3fa | ||
![]() |
acf5d90945 | ||
![]() |
51ed4166d8 | ||
![]() |
1c980f7241 | ||
![]() |
8e475e1681 | ||
![]() |
976f42b48c | ||
![]() |
0311c3f9a9 | ||
![]() |
e2daa21914 | ||
![]() |
68c3f6ed4e | ||
![]() |
c9df7bc47a | ||
![]() |
f2749ed311 | ||
![]() |
6a3cface7a | ||
![]() |
9f54f87c62 | ||
![]() |
857a123162 | ||
![]() |
27f7ec61f0 | ||
![]() |
adc06388e2 | ||
![]() |
d898725704 | ||
![]() |
e93e95a940 | ||
![]() |
ba419a1b8e | ||
![]() |
eb4b068d54 | ||
![]() |
489c900e00 | ||
![]() |
7753ffdad4 | ||
![]() |
4aca537a92 | ||
![]() |
c0a7d00ffc | ||
![]() |
68dd53b962 | ||
![]() |
9ba12621a5 | ||
![]() |
1faf5099f5 | ||
![]() |
bc8b1d14d5 | ||
![]() |
f781deb4a9 | ||
![]() |
8d39a4b1a7 | ||
![]() |
edf97f5d05 | ||
![]() |
507ef9424b | ||
![]() |
4cd12332d2 | ||
![]() |
335e16dd3e | ||
![]() |
26f1ba7016 | ||
![]() |
59cf8c3e9f | ||
![]() |
dfd68d16aa | ||
![]() |
9a4c5ffe5c | ||
![]() |
8cf45a5e45 | ||
![]() |
7834411bbd | ||
![]() |
789f22972c | ||
![]() |
bf3759020a | ||
![]() |
0530bed226 | ||
![]() |
012cec3a8b | ||
![]() |
5e2deb36c0 | ||
![]() |
0cb0dbcb60 | ||
![]() |
75f823f671 | ||
![]() |
27ff36a3cc | ||
![]() |
ad9f116d33 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -194,3 +194,6 @@ FakesAssemblies/
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
/Build.mono
|
||||
/Build.windows
|
||||
/Output
|
||||
|
37
Build.bat
Normal file
37
Build.bat
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
rmdir /s /q build.windows
|
||||
rmdir /s /q build.mono
|
||||
rmdir /s /q Output
|
||||
cd src
|
||||
Msbuild Jackett.sln /t:Clean,Build /p:Configuration=Release /verbosity:minimal
|
||||
cd ..
|
||||
|
||||
xcopy src\Jackett.Console\bin\Release build.windows\ /e /y
|
||||
copy /Y src\Jackett.Service\bin\Release\JackettService.exe build.windows\JackettService.exe
|
||||
copy /Y src\Jackett.Service\bin\Release\JackettService.exe.config build.windows\JackettService.exe.config
|
||||
copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe build.windows\JackettTray.exe
|
||||
copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe.config build.windows\JackettTray.exe.config
|
||||
copy /Y src\Jackett.Updater\bin\Release\JackettUpdater.exe build.windows\JackettUpdater.exe
|
||||
copy /Y src\Jackett.Updater\bin\Release\JackettUpdater.exe.config build.windows\JackettUpdater.exe.config
|
||||
copy /Y LICENSE build.windows\LICENSE
|
||||
copy /Y README.md build.windows\README.md
|
||||
|
||||
|
||||
cd src
|
||||
Msbuild Jackett.sln /t:Clean
|
||||
call "C:\Program Files (x86)\Mono\bin\xbuild.bat" Jackett.sln /t:Build /p:Configuration=Release /verbosity:minimal
|
||||
cd ..
|
||||
|
||||
xcopy src\Jackett.Console\bin\Release build.mono\ /e /y
|
||||
copy /Y src\Jackett.Service\bin\Release\JackettService.exe build.mono\JackettService.exe
|
||||
copy /Y src\Jackett.Service\bin\Release\JackettService.exe.config build.mono\JackettService.exe.config
|
||||
copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe build.mono\JackettTray.exe
|
||||
copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe.config build.mono\JackettTray.exe.config
|
||||
copy /Y src\Jackett.Updater\bin\Release\JackettUpdater.exe build.mono\JackettUpdater.exe
|
||||
copy /Y src\Jackett.Updater\bin\Release\JackettUpdater.exe.config build.mono\JackettUpdater.exe.config
|
||||
copy /Y LICENSE build.mono\LICENSE
|
||||
copy /Y README.md build.mono\README.md
|
||||
copy /Y Upstart.config build.mono\Upstart.config
|
||||
|
||||
iscc Installer.iss
|
||||
|
63
Installer.iss
Normal file
63
Installer.iss
Normal file
@@ -0,0 +1,63 @@
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "Jackett"
|
||||
#define MyAppVersion GetFileVersion("build.windows/Jackett.dll")
|
||||
#define MyAppPublisher "Jackett Inc."
|
||||
#define MyAppURL "https://github.com/Jackett/Jackett"
|
||||
#define MyAppExeName "JackettTray.exe"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application.
|
||||
; Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppId={{C2A9FC00-AA48-4F17-9A72-62FBCEE2785B}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
;AppVerName={#MyAppName} {#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={pf}\{#MyAppName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
DisableProgramGroupPage=yes
|
||||
OutputBaseFilename=setup
|
||||
SetupIconFile=src\Jackett.Console\jackett.ico
|
||||
UninstallDisplayIcon={commonappdata}\Jackett\JackettConsole.exe
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
DisableDirPage=yes
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "windowsService"; Description: "Install as a Windows Service"
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "build.windows\JackettTray.exe"; DestDir: "{commonappdata}\Jackett"; Flags: ignoreversion
|
||||
Source: "build.windows\JackettUpdater.exe"; DestDir: "{commonappdata}\Jackett"; Flags: ignoreversion
|
||||
Source: "build.windows\*"; DestDir: "{commonappdata}\Jackett"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{#MyAppName}"; Filename: "{commonappdata}\Jackett\{#MyAppExeName}"
|
||||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||
Name: "{commondesktop}\{#MyAppName}"; Filename: "{commonappdata}\Jackett\{#MyAppExeName}"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{commonappdata}\Jackett\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[Run]
|
||||
Filename: "{commonappdata}\Jackett\JackettConsole.exe"; Parameters: "--Uninstall"; Flags: waituntilterminated;
|
||||
Filename: "{commonappdata}\Jackett\JackettConsole.exe"; Parameters: "--ReserveUrls"; Flags: waituntilterminated;
|
||||
Filename: "{commonappdata}\Jackett\JackettConsole.exe"; Parameters: "--MigrateSettings"; Flags: waituntilterminated;
|
||||
Filename: "{commonappdata}\Jackett\JackettConsole.exe"; Parameters: "--Install"; Flags: waituntilterminated; Tasks: windowsService
|
||||
Filename: "{commonappdata}\Jackett\JackettConsole.exe"; Parameters: "--Start"; Flags: waituntilterminated; Tasks: windowsService
|
||||
|
||||
[UninstallRun]
|
||||
Filename: "{commonappdata}\Jackett\JackettConsole.exe"; Parameters: "--Uninstall"; Flags: waituntilterminated skipifdoesntexist
|
||||
|
||||
|
131
README.md
131
README.md
@@ -1,30 +1,101 @@
|
||||
# Jackett
|
||||
|
||||
### API Access to your favorite trackers
|
||||
|
||||
This software creates a [Torznab](https://github.com/Sonarr/Sonarr/wiki/Implementing-a-Torznab-indexer) API server on your machine that any Torznab enabled software can consume. Jackett works as a proxy server: it translates Torznab queries into tracker-site-specific http queries, parses the html response into Torznab results, then sends results back to the requesting software.
|
||||
|
||||
Currently [Sonarr](https://sonarr.tv/) is the only software that uses Torznab. [Couchpotato](https://couchpota.to/) will hopefully get Torznab support in the future.
|
||||
|
||||
### Download
|
||||
Download in the [Releases page](https://github.com/zone117x/Jackett/releases)
|
||||
|
||||
### Supported Trackers
|
||||
* [BitMeTV](http://www.bitmetv.org/)
|
||||
* [MoreThan.tv](https://morethan.tv/)
|
||||
* [BIT-HDTV](https://www.bit-hdtv.com)
|
||||
* [Freshon](https://freshon.tv/)
|
||||
* [IPTorrents](https://iptorrents.com/)
|
||||
* [The Pirate Bay](https://thepiratebay.se/)
|
||||
* [RARBG](https://rarbg.com)
|
||||
|
||||
|
||||
### Additional Trackers
|
||||
Jackett's framework allows me (and any other volunteering dev) to implement just about any new tracker in 15-60 minutes. If you'd like support for a new tracker then feel free to leave a request on the [issues page](https://github.com/zone117x/Jackett/issues) or contact me on IRC (see below).
|
||||
|
||||
### Contact & Support
|
||||
I can be contact on IRC at [irc.freenode.net#sonarr](http://webchat.freenode.net/?channels=#sonarr)
|
||||
|
||||
### Screenshots
|
||||
|
||||

|
||||
## Jackett
|
||||
|
||||
This project is a new fork and is recruiting development help. If you are able to help out please contact us.
|
||||
|
||||
Jackett works as a proxy server: it translates queries from apps (Sonarr, SickRage, CouchPotato, Mylar, etc) into tracker-site-specific http queries, parses the html response, then sends results back to the requesting software. This allows for getting recent uploads (like RSS) and performing searches. Jackett is a single repository of maintained indexer scraping & translation logic - removing the burden from other apps.
|
||||
|
||||
Developer note: The software implements the [Torznab](https://github.com/Sonarr/Sonarr/wiki/Implementing-a-Torznab-indexer) (with [nZEDb](https://github.com/nZEDb/nZEDb/blob/master/docs/newznab_api_specification.txt) category numbering) and [TorrentPotato](https://github.com/RuudBurger/CouchPotatoServer/wiki/Couchpotato-torrent-provider) APIs.
|
||||
|
||||
|
||||
|
||||
#### Supported Systems
|
||||
* Windows using .NET 4.5
|
||||
* Linux and OSX using Mono 4 (v3 should work but you may experience crashes).
|
||||
|
||||
|
||||
#### Supported Private Trackers
|
||||
* AlphaRatio
|
||||
* AnimeBytes
|
||||
* Avistaz
|
||||
* bB
|
||||
* BeyondHD
|
||||
* BIT-HDTV
|
||||
* BitMeTV
|
||||
* BlueTigers
|
||||
* BTN
|
||||
* DanishBits
|
||||
* Demonoid
|
||||
* EuTorrents
|
||||
* FileList
|
||||
* FrenchTorrentDb
|
||||
* Freshon
|
||||
* HD-Space
|
||||
* HD-Torrents
|
||||
* Hounddawgs
|
||||
* Immortalseed
|
||||
* IPTorrents
|
||||
* MoreThanTV
|
||||
* NCore
|
||||
* NextGen
|
||||
* Pretome
|
||||
* PrivateHD
|
||||
* SceneAccess
|
||||
* SceneTime
|
||||
* Shazbat
|
||||
* SpeedCD
|
||||
* TehConnection
|
||||
* TorrentBytes
|
||||
* TorrentDay
|
||||
* TorrentLeech
|
||||
* TorrentShack
|
||||
* TV Chaos UK
|
||||
|
||||
#### Installation on Windows
|
||||
|
||||
We recommend you install Jackett as a Windows service using the supplied installer. When installed as a service the tray icon acts as a way to open/start/stop Jackett. If you opted to not install it as a service then Jackett will run its web server from the tray tool.
|
||||
|
||||
Jackett can also be run from the command line using JackettConsole.exe if you would like to see log messages (Ensure the server isn't already running from the tray/service).
|
||||
|
||||
#### Installation on Linux/OSX
|
||||
1. Install [Mono 4](http://www.mono-project.com/download/) or better
|
||||
2. Install libcurl:
|
||||
* Debian/Ubunutu: apt-get install libcurl-dev
|
||||
* Redhat/Fedora: yum install libcurl-devel
|
||||
* For other distros see the [Curl docs](http://curl.haxx.se/dlwiz/?type=devel).
|
||||
3. Download and extract the latest ```.tar.gz``` release from the [releases page](https://github.com/Jackett/Jackett/releases) and run Jackett using mono with the command "mono JackettConsole.exe".
|
||||
|
||||
Detailed instructions for [Ubuntu 14.x](http://www.htpcguides.com/install-jackett-on-ubuntu-14-x-for-custom-torrents-in-sonarr/) and [Ubuntu 15.x](http://www.htpcguides.com/install-jackett-ubuntu-15-x-for-custom-torrents-in-sonarr/)
|
||||
|
||||
#### Installation on Synology
|
||||
1. Install Sonarr & Mono 3.10 from synocommunity.
|
||||
2. Install Mono beta 3.12 from the main Synology repo (Or newer if available).
|
||||
3. Download jackett and place it in /opt/Jackett
|
||||
4. cd /opt
|
||||
5. chown -R {user who will run jackett} Jackett
|
||||
6. Copy Upstart.config to /etc/init/jackett.conf and replace the braces {} in the script with the username that you wish to run Jackett with.
|
||||
9. From anywhere on command line type "start jackett" . You should see output telling you that Jackett is running and you should be able to browse to {IP Address}:9117 . If not you should check /var/log/upstart/jackett.log and see what that says.
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
* Command line switches
|
||||
|
||||
You can pass various options when running via the command line, see --help for details.
|
||||
|
||||
* Unable to connect to certain trackers on Linux
|
||||
|
||||
Try running with the "--SSLFix true" if you are on Redhat/Fedora/NNS based libcurl. If the tracker is currently configured try removing it and adding it again. Alternatively try running with a different client via --UseClient (Warning: safecurl just executes curl and your details may be seen from the process list).
|
||||
|
||||
* Enable logging
|
||||
|
||||
You can get additional logging with the switches "-t -l". Please post logs if you are unable to resolve your issue with these switches ensuring to remove your username/password/cookies.
|
||||
|
||||
#### Creating an issue
|
||||
Please supply as much information about the problem you are experiencing as possible. Your issue has a much greater chance of being resolved if logs are supplied so that we can see what is going on. Creating an issue with '### isn't working' doesn't help anyone to fix the problem.
|
||||
|
||||
### Contributing
|
||||
All contributions are welcome just send a pull request. Jackett's framework allows our team (and any other volunteering dev) to implement new trackers in an hour or two. If you'd like support for a new tracker but are not a developer then feel free to leave a request on the [issues page](https://github.com/zone117x/Jackett/issues). It is recommended to use Visual studio 2015 when making code changes in this project. We currently only support private trackers.
|
||||
|
||||
|
||||
### Screenshots
|
||||
|
||||

|
||||
|
20
Upstart.config
Normal file
20
Upstart.config
Normal file
@@ -0,0 +1,20 @@
|
||||
author "sea3pea0"
|
||||
description "Upstart Script to run NzbDrone as a service on Ubuntu/Debian based systems, as well as others"
|
||||
|
||||
#Set username for the process. Should probably be what you use for logging in
|
||||
setuid {username to run jackett}
|
||||
setgid users
|
||||
|
||||
#This is the install directory. If you installed using a deb package or the NzbDrone Repository you do not need to change this
|
||||
|
||||
env DIR=/opt/Jackett
|
||||
env LD_LIBRARY_PATH=/usr/local/nzbdrone/lib
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
|
||||
respawn
|
||||
script
|
||||
chdir $DIR
|
||||
exec /volume1/@appstore/Mono/usr/bin/mono --debug JackettConsole.exe
|
||||
end script
|
239
src/CurlSharp/Callbacks/CurlEasyCallbacks.cs
Normal file
239
src/CurlSharp/Callbacks/CurlEasyCallbacks.cs
Normal file
@@ -0,0 +1,239 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when cURL has debug information for the client.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For usage, see the sample <c>Upload.cs</c>.
|
||||
/// Arguments passed to the recipient include:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>infoType</term>
|
||||
/// <description>
|
||||
/// Type of debug information, see
|
||||
/// <see cref="CurlInfoType" />.
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>message</term>
|
||||
/// <description>Debug information as a string.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>extraData</term>
|
||||
/// <description>Client-provided extra data.</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public delegate void CurlDebugCallback(CurlInfoType infoType, String message, Object extraData);
|
||||
|
||||
/// <summary>
|
||||
/// Called when cURL has header data for the client.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For usage, see the sample <c>Headers.cs</c>.
|
||||
/// Arguments passed to the recipient include:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>buf</term>
|
||||
/// <description>Header data from cURL to the client.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>size</term>
|
||||
/// <description>Size of a character, in bytes.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>nmemb</term>
|
||||
/// <description>Number of characters.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>extraData</term>
|
||||
/// <description>Client-provided extra data.</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// Your implementation should return the number of bytes (not
|
||||
/// characters) processed. Usually this is <c>size * nmemb</c>.
|
||||
/// Return -1 to abort the transfer.
|
||||
/// </remarks>
|
||||
public delegate int CurlHeaderCallback(byte[] buf, int size, int nmemb, Object extraData);
|
||||
|
||||
/// <summary>
|
||||
/// Called when cURL needs for the client to perform an
|
||||
/// IOCTL operation. An example might be when an FTP
|
||||
/// upload requires rewinding of the input file to deal
|
||||
/// with a resend occasioned by an error.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>cmd</term>
|
||||
/// <description>
|
||||
/// A <see cref="CurlIoCommand" />; for now, only
|
||||
/// <c>RestartRead</c> should be passed.
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>extraData</term>
|
||||
/// <description>
|
||||
/// Client-provided extra data; in the
|
||||
/// case of an FTP upload, it might be a
|
||||
/// <c>FileStream</c> object.
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// Your implementation should return a <see cref="CurlIoError" />,
|
||||
/// which should be <see cref="CurlIoError.Ok" /> if everything
|
||||
/// is okay.
|
||||
/// </remarks>
|
||||
public delegate CurlIoError CurlIoctlCallback(CurlIoCommand cmd, Object extraData);
|
||||
|
||||
/// <summary>
|
||||
/// Called when cURL wants to report progress.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For usage, see the sample <c>Upload.cs</c>.
|
||||
/// Arguments passed to the recipient include:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>extraData</term>
|
||||
/// <description>Client-provided extra data.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>dlTotal</term>
|
||||
/// <description>Number of bytes to download.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>dlNow</term>
|
||||
/// <description>Number of bytes downloaded so far.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>ulTotal</term>
|
||||
/// <description>Number of bytes to upload.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>ulNow</term>
|
||||
/// <description>Number of bytes uploaded so far.</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// Your implementation should return 0 to continue, or a non-zero
|
||||
/// value to abort the transfer.
|
||||
/// </remarks>
|
||||
public delegate int CurlProgressCallback(Object extraData, double dlTotal, double dlNow,
|
||||
double ulTotal, double ulNow);
|
||||
|
||||
/// <summary>
|
||||
/// Called when cURL wants to read data from the client.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For usage, see the sample <c>Upload.cs</c>.
|
||||
/// Arguments passed to the recipient include:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>buf</term>
|
||||
/// <description>
|
||||
/// Buffer into which your client should write data
|
||||
/// for cURL.
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>size</term>
|
||||
/// <description>Size of a character, usually 1.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>nmemb</term>
|
||||
/// <description>Number of characters.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>extraData</term>
|
||||
/// <description>Client-provided extra data.</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// Your implementation should return the number of bytes (not
|
||||
/// characters) written to <c>buf</c>. Return 0 to abort the transfer.
|
||||
/// </remarks>
|
||||
public delegate int CurlReadCallback([Out] byte[] buf, int size, int nmemb, Object extraData);
|
||||
|
||||
/// <summary>
|
||||
/// Called when cURL wants to report an Ssl event.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For usage, see the sample <c>SSLGet.cs</c>.
|
||||
/// Arguments passed to the recipient include:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>ctx</term>
|
||||
/// <description>
|
||||
/// An <see cref="CurlSslContext" /> object that wraps an
|
||||
/// OpenSSL <c>SSL_CTX</c> pointer.
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>extraData</term>
|
||||
/// <description>Client-provided extra data.</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// Your implementation should return a <see cref="CurlCode" />,
|
||||
/// which should be <see cref="CurlCode.Ok" /> if everything
|
||||
/// is okay.
|
||||
/// </remarks>
|
||||
public delegate CurlCode CurlSslContextCallback(CurlSslContext ctx, Object extraData);
|
||||
|
||||
/// <summary>
|
||||
/// Called when cURL has data for the client.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For usage, see the example <c>EasyGet.cs</c>.
|
||||
/// Arguments passed to the delegate implementation include:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>buf</term>
|
||||
/// <description>Data cURL is providing to the client.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>size</term>
|
||||
/// <description>Size of a character, usually 1.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>nmemb</term>
|
||||
/// <description>Number of characters.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>extraData</term>
|
||||
/// <description>Client-provided extra data.</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// Your implementation should return the number of bytes (not
|
||||
/// characters) processed. Return 0 to abort the transfer.
|
||||
/// </remarks>
|
||||
public delegate int CurlWriteCallback(byte[] buf, int size, int nmemb, Object extraData);
|
||||
}
|
75
src/CurlSharp/Callbacks/CurlShareCallbacks.cs
Normal file
75
src/CurlSharp/Callbacks/CurlShareCallbacks.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when <c>cURL</c> wants to lock a shared resource.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For a usage example, refer to the <c>ShareDemo.cs</c> sample.
|
||||
/// Arguments passed to your delegate implementation include:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>data</term>
|
||||
/// <term>
|
||||
/// Type of data to lock; one of the values in the
|
||||
/// <see cref="CurlLockData" /> enumeration.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>access</term>
|
||||
/// <term>
|
||||
/// Lock access requested; one of the values in the
|
||||
/// <see cref="CurlLockAccess" /> enumeration.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>userData</term>
|
||||
/// <term>
|
||||
/// Client-provided data that is not touched internally by
|
||||
/// <c>cURL</c>. This is set via
|
||||
/// <see cref="CurlShareOption.UserData" /> when calling the
|
||||
/// <see cref="CurlShare.SetOpt" /> member of the <see cref="CurlShare" />
|
||||
/// class.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public delegate void CurlShareLockCallback(CurlLockData data, CurlLockAccess access, Object userData);
|
||||
|
||||
/// <summary>
|
||||
/// Called when <c>cURL</c> wants to unlock a shared resource.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For a usage example, refer to the <c>ShareDemo.cs</c> sample.
|
||||
/// Arguments passed to your delegate implementation include:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Argument</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>data</term>
|
||||
/// <term>
|
||||
/// Type of data to unlock; one of the values in the
|
||||
/// <see cref="CurlLockData" /> enumeration.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>userData</term>
|
||||
/// <term>
|
||||
/// Client-provided data that is not touched internally by
|
||||
/// <c>cURL</c>. This is set via
|
||||
/// <see cref="CurlShareOption.UserData" /> when calling the
|
||||
/// <see cref="CurlShare.SetOpt" /> member of the <see cref="CurlShare" />
|
||||
/// class.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public delegate void CurlShareUnlockCallback(CurlLockData data, Object userData);
|
||||
}
|
170
src/CurlSharp/Curl.cs
Normal file
170
src/CurlSharp/Curl.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Top-level class for initialization and cleanup.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// It also implements static methods for capabilities that don't
|
||||
/// logically belong in a class.
|
||||
/// </remarks>
|
||||
public static class Curl
|
||||
{
|
||||
// for state management
|
||||
private static CurlCode _initCode;
|
||||
|
||||
/// <summary>
|
||||
/// Class constructor - initialize global status.
|
||||
/// </summary>
|
||||
static Curl()
|
||||
{
|
||||
_initCode = CurlCode.FailedInit;
|
||||
}
|
||||
|
||||
// hidden instance stuff
|
||||
|
||||
/// <summary>
|
||||
/// Get the underlying cURL version as a string, example "7.12.2".
|
||||
/// </summary>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// Thrown if cURL isn't properly initialized.
|
||||
/// </exception>
|
||||
public static string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
EnsureCurl();
|
||||
return Marshal.PtrToStringAnsi(NativeMethods.curl_version());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process-wide initialization -- call only once per process.
|
||||
/// </summary>
|
||||
/// <param name="flags">
|
||||
/// An or'd combination of
|
||||
/// <see cref="CurlInitFlag" /> members.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="CurlCode" />, hopefully
|
||||
/// <c>CurlCode.Ok</c>.
|
||||
/// </returns>
|
||||
public static CurlCode GlobalInit(CurlInitFlag flags)
|
||||
{
|
||||
_initCode = NativeMethods.curl_global_init((int)flags);
|
||||
#if USE_LIBCURLSHIM
|
||||
if (_initCode == CurlCode.Ok)
|
||||
NativeMethods.curl_shim_initialize();
|
||||
#endif
|
||||
return _initCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process-wide cleanup -- call just before exiting process.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// While it's not necessary that your program call this method
|
||||
/// before exiting, doing so will prevent leaks of native cURL resources.
|
||||
/// </remarks>
|
||||
public static void GlobalCleanup()
|
||||
{
|
||||
if (_initCode == CurlCode.Ok)
|
||||
{
|
||||
#if USE_LIBCURLSHIM
|
||||
NativeMethods.curl_shim_cleanup();
|
||||
#endif
|
||||
NativeMethods.curl_global_cleanup();
|
||||
_initCode = CurlCode.FailedInit;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// URL encode a String.
|
||||
/// </summary>
|
||||
/// <param name="url">The string to URL encode.</param>
|
||||
/// <param name="length">
|
||||
/// Input string length;
|
||||
/// use 0 for cURL to determine.
|
||||
/// </param>
|
||||
/// <returns>A new URL encoded string.</returns>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// Thrown if cURL isn't properly initialized.
|
||||
/// </exception>
|
||||
public static string Escape(string url, int length)
|
||||
{
|
||||
EnsureCurl();
|
||||
var p = NativeMethods.curl_escape(url, length);
|
||||
var s = Marshal.PtrToStringAnsi(p);
|
||||
NativeMethods.curl_free(p);
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// URL decode a String.
|
||||
/// </summary>
|
||||
/// <param name="url">The string to URL decode.</param>
|
||||
/// <param name="length">
|
||||
/// Input string length;
|
||||
/// use 0 for cURL to determine.
|
||||
/// </param>
|
||||
/// <returns>A new URL decoded string.</returns>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// Thrown if cURL isn't properly initialized.
|
||||
/// </exception>
|
||||
public static string Unescape(string url, int length)
|
||||
{
|
||||
EnsureCurl();
|
||||
var p = NativeMethods.curl_unescape(url, length);
|
||||
var s = Marshal.PtrToStringAnsi(p);
|
||||
NativeMethods.curl_free(p);
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="CurlVersionInfoData" /> object.
|
||||
/// </summary>
|
||||
/// <param name="ver">
|
||||
/// Specify a <see cref="CurlVersion" />, such as
|
||||
/// <c>CurlVersion.Now</c>.
|
||||
/// </param>
|
||||
/// <returns>A <see cref="CurlVersionInfoData" /> object.</returns>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// Thrown if cURL isn't properly initialized.
|
||||
/// </exception>
|
||||
public static CurlVersionInfoData GetVersionInfo(CurlVersion ver)
|
||||
{
|
||||
EnsureCurl();
|
||||
return new CurlVersionInfoData(ver);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by other classes to ensure valid cURL state.
|
||||
/// </summary>
|
||||
internal static void EnsureCurl()
|
||||
{
|
||||
if (_initCode != CurlCode.Ok)
|
||||
throw new InvalidOperationException("cURL not initialized");
|
||||
}
|
||||
}
|
||||
}
|
2116
src/CurlSharp/CurlEasy.cs
Normal file
2116
src/CurlSharp/CurlEasy.cs
Normal file
File diff suppressed because it is too large
Load Diff
388
src/CurlSharp/CurlHttpMultiPartForm.cs
Normal file
388
src/CurlSharp/CurlHttpMultiPartForm.cs
Normal file
@@ -0,0 +1,388 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2014 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This trivial class wraps the internal <c>curl_forms</c> struct.
|
||||
/// </summary>
|
||||
public sealed class CurlForms
|
||||
{
|
||||
/// <summary>The <see cref="CurlFormOption" />.</summary>
|
||||
public CurlFormOption Option;
|
||||
|
||||
/// <summary>Value for the option.</summary>
|
||||
public Object Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps a section of multipart form data to be submitted via the
|
||||
/// <see cref="CurlOption.HttpPost" /> option in the
|
||||
/// <see cref="CurlEasy.SetOpt" /> member of the <see cref="CurlEasy" /> class.
|
||||
/// </summary>
|
||||
public class CurlHttpMultiPartForm : IDisposable
|
||||
{
|
||||
// the two curlform pointers
|
||||
private readonly IntPtr[] _pItems;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// This is thrown
|
||||
/// if <see cref="Curl" /> hasn't bee properly initialized.
|
||||
/// </exception>
|
||||
public CurlHttpMultiPartForm()
|
||||
{
|
||||
Curl.EnsureCurl();
|
||||
_pItems = new IntPtr[2];
|
||||
_pItems[0] = IntPtr.Zero;
|
||||
_pItems[1] = IntPtr.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Free unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~CurlHttpMultiPartForm()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
// for CurlEasy.SetOpt()
|
||||
internal IntPtr GetHandle()
|
||||
{
|
||||
return _pItems[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a multi-part form section.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// Argument list, as described in the remarks.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="CurlFormCode" />, hopefully
|
||||
/// <c>CurlFormCode.Ok</c>.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// This is definitely the workhorse method for this class. It
|
||||
/// should be called in roughly the same manner as
|
||||
/// <c>curl_formadd()</c>, except you would omit the first two
|
||||
/// <c>struct curl_httppost**</c> arguments (<c>firstitem</c> and
|
||||
/// <c>lastitem</c>), which are wrapped in this class. So you should
|
||||
/// pass arguments in the following sequence:
|
||||
/// <para>
|
||||
/// <c>
|
||||
/// CurlHttpMultiPartForm.AddSection(option1, value1, ..., optionX, valueX,
|
||||
/// CurlFormOption.End)
|
||||
/// </c>
|
||||
/// ;
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// For a complete list of possible options, see the documentation for
|
||||
/// the <see cref="CurlFormOption" /> enumeration.
|
||||
/// </para>
|
||||
/// <note>
|
||||
/// The pointer options (<c>PtrName</c>, etc.) make an
|
||||
/// internal copy of the passed <c>byte</c> array. Therefore, any
|
||||
/// changes you make to the client copy of this array AFTER calling
|
||||
/// this method, won't be reflected internally with <c>cURL</c>. The
|
||||
/// purpose of providing the pointer options is to support the
|
||||
/// posting of non-string binary data.
|
||||
/// </note>
|
||||
/// </remarks>
|
||||
public CurlFormCode AddSection(params object[] args)
|
||||
{
|
||||
var nCount = args.Length;
|
||||
var nRealCount = nCount;
|
||||
var retCode = CurlFormCode.Ok;
|
||||
CurlForms[] aForms = null;
|
||||
|
||||
// one arg or even number of args is an error
|
||||
if ((nCount == 1) || (nCount%2 == 0))
|
||||
return CurlFormCode.Incomplete;
|
||||
|
||||
// ensure the last argument is End
|
||||
var iCode = (CurlFormOption)
|
||||
Convert.ToInt32(args.GetValue(nCount - 1));
|
||||
if (iCode != CurlFormOption.End)
|
||||
return CurlFormCode.Incomplete;
|
||||
|
||||
// walk through any passed arrays to get the true number of
|
||||
// items and ensure the child arrays are properly (and not
|
||||
// prematurely) terminated with End
|
||||
for (var i = 0; i < nCount; i += 2)
|
||||
{
|
||||
iCode = (CurlFormOption) Convert.ToInt32(args.GetValue(i));
|
||||
switch (iCode)
|
||||
{
|
||||
case CurlFormOption.Array:
|
||||
{
|
||||
aForms = args.GetValue(i + 1) as CurlForms[];
|
||||
if (aForms == null)
|
||||
return CurlFormCode.Incomplete;
|
||||
var nFormsCount = aForms.Length;
|
||||
for (var j = 0; j < nFormsCount; j++)
|
||||
{
|
||||
var pcf = aForms.GetValue(j) as CurlForms;
|
||||
if (pcf == null)
|
||||
return CurlFormCode.Incomplete;
|
||||
if (j == nFormsCount - 1)
|
||||
{
|
||||
if (pcf.Option != CurlFormOption.End)
|
||||
return CurlFormCode.Incomplete;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pcf.Option == CurlFormOption.End)
|
||||
return CurlFormCode.Incomplete;
|
||||
}
|
||||
}
|
||||
// -2 accounts for the fact that we're a) not
|
||||
// including the item with End and b) not
|
||||
// including Array in what we pass to cURL
|
||||
nRealCount += 2*(nFormsCount - 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// allocate the IntPtr array for the data
|
||||
var aPointers = new IntPtr[nRealCount];
|
||||
for (var i = 0; i < nRealCount - 1; i++)
|
||||
aPointers[i] = IntPtr.Zero;
|
||||
aPointers[nRealCount - 1] = (IntPtr) CurlFormOption.End;
|
||||
|
||||
// now we go through the args
|
||||
aForms = null;
|
||||
var formArrayPos = 0;
|
||||
var argArrayPos = 0;
|
||||
var ptrArrayPos = 0;
|
||||
Object obj = null;
|
||||
|
||||
while ((retCode == CurlFormCode.Ok) &&
|
||||
(ptrArrayPos < nRealCount))
|
||||
{
|
||||
if (aForms != null)
|
||||
{
|
||||
var pcf = aForms.GetValue(formArrayPos++)
|
||||
as CurlForms;
|
||||
if (pcf == null)
|
||||
{
|
||||
retCode = CurlFormCode.UnknownOption;
|
||||
break;
|
||||
}
|
||||
iCode = pcf.Option;
|
||||
obj = pcf.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCode = (CurlFormOption) Convert.ToInt32(
|
||||
args.GetValue(argArrayPos++));
|
||||
obj = (iCode == CurlFormOption.End)
|
||||
? null
|
||||
: args.GetValue(argArrayPos++);
|
||||
}
|
||||
|
||||
switch (iCode)
|
||||
{
|
||||
// handle byte-array pointer-related items
|
||||
case CurlFormOption.PtrName:
|
||||
case CurlFormOption.PtrContents:
|
||||
case CurlFormOption.BufferPtr:
|
||||
{
|
||||
var bytes = obj as byte[];
|
||||
if (bytes == null)
|
||||
retCode = CurlFormCode.UnknownOption;
|
||||
else
|
||||
{
|
||||
var nLen = bytes.Length;
|
||||
var ptr = Marshal.AllocHGlobal(nLen);
|
||||
if (ptr != IntPtr.Zero)
|
||||
{
|
||||
aPointers[ptrArrayPos++] = (IntPtr) iCode;
|
||||
// copy bytes to unmanaged buffer
|
||||
for (var j = 0; j < nLen; j++)
|
||||
Marshal.WriteByte(ptr, bytes[j]);
|
||||
aPointers[ptrArrayPos++] = ptr;
|
||||
}
|
||||
else
|
||||
retCode = CurlFormCode.Memory;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// length values
|
||||
case CurlFormOption.NameLength:
|
||||
case CurlFormOption.ContentsLength:
|
||||
case CurlFormOption.BufferLength:
|
||||
aPointers[ptrArrayPos++] = (IntPtr) iCode;
|
||||
aPointers[ptrArrayPos++] = (IntPtr)
|
||||
Convert.ToInt32(obj);
|
||||
break;
|
||||
|
||||
// strings
|
||||
case CurlFormOption.CopyName:
|
||||
case CurlFormOption.CopyContents:
|
||||
case CurlFormOption.FileContent:
|
||||
case CurlFormOption.File:
|
||||
case CurlFormOption.ContentType:
|
||||
case CurlFormOption.Filename:
|
||||
case CurlFormOption.Buffer:
|
||||
{
|
||||
aPointers[ptrArrayPos++] = (IntPtr) iCode;
|
||||
var s = obj as String;
|
||||
if (s == null)
|
||||
retCode = CurlFormCode.UnknownOption;
|
||||
else
|
||||
{
|
||||
var p = Marshal.StringToHGlobalAnsi(s);
|
||||
if (p != IntPtr.Zero)
|
||||
aPointers[ptrArrayPos++] = p;
|
||||
else
|
||||
retCode = CurlFormCode.Memory;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// array case: already handled
|
||||
case CurlFormOption.Array:
|
||||
if (aForms != null)
|
||||
retCode = CurlFormCode.IllegalArray;
|
||||
else
|
||||
{
|
||||
aForms = obj as CurlForms[];
|
||||
if (aForms == null)
|
||||
retCode = CurlFormCode.UnknownOption;
|
||||
}
|
||||
break;
|
||||
|
||||
// slist
|
||||
case CurlFormOption.ContentHeader:
|
||||
{
|
||||
aPointers[ptrArrayPos++] = (IntPtr) iCode;
|
||||
var s = obj as CurlSlist;
|
||||
if (s == null)
|
||||
retCode = CurlFormCode.UnknownOption;
|
||||
else
|
||||
aPointers[ptrArrayPos++] = s.Handle;
|
||||
break;
|
||||
}
|
||||
|
||||
// erroneous stuff
|
||||
case CurlFormOption.Nothing:
|
||||
retCode = CurlFormCode.Incomplete;
|
||||
break;
|
||||
|
||||
// end
|
||||
case CurlFormOption.End:
|
||||
if (aForms != null) // end of form
|
||||
{
|
||||
aForms = null;
|
||||
formArrayPos = 0;
|
||||
}
|
||||
else
|
||||
aPointers[ptrArrayPos++] = (IntPtr) iCode;
|
||||
break;
|
||||
|
||||
// default is unknown
|
||||
default:
|
||||
retCode = CurlFormCode.UnknownOption;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ensure we didn't come up short on parameters
|
||||
if (ptrArrayPos != nRealCount)
|
||||
retCode = CurlFormCode.Incomplete;
|
||||
|
||||
// if we're OK here, call into curl
|
||||
if (retCode == CurlFormCode.Ok)
|
||||
{
|
||||
#if USE_LIBCURLSHIM
|
||||
retCode = (CurlFormCode) NativeMethods.curl_shim_formadd(_pItems, aPointers, nRealCount);
|
||||
#else
|
||||
retCode = (CurlFormCode) NativeMethods.curl_formadd(ref _pItems[0], ref _pItems[1],
|
||||
(int) aPointers[0], aPointers[1],
|
||||
(int) aPointers[2], aPointers[3],
|
||||
(int) aPointers[4]);
|
||||
#endif
|
||||
}
|
||||
|
||||
// unmarshal native allocations
|
||||
for (var i = 0; i < nRealCount - 1; i += 2)
|
||||
{
|
||||
iCode = (CurlFormOption) (int) aPointers[i];
|
||||
switch (iCode)
|
||||
{
|
||||
case CurlFormOption.CopyName:
|
||||
case CurlFormOption.CopyContents:
|
||||
case CurlFormOption.FileContent:
|
||||
case CurlFormOption.File:
|
||||
case CurlFormOption.ContentType:
|
||||
case CurlFormOption.Filename:
|
||||
case CurlFormOption.Buffer:
|
||||
// byte buffer cases
|
||||
case CurlFormOption.PtrName:
|
||||
case CurlFormOption.PtrContents:
|
||||
case CurlFormOption.BufferPtr:
|
||||
{
|
||||
if (aPointers[i + 1] != IntPtr.Zero)
|
||||
Marshal.FreeHGlobal(aPointers[i + 1]);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retCode;
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// clean up managed objects
|
||||
}
|
||||
|
||||
// clean up native objects
|
||||
if (_pItems[0] != IntPtr.Zero)
|
||||
NativeMethods.curl_formfree(_pItems[0]);
|
||||
_pItems[0] = IntPtr.Zero;
|
||||
_pItems[1] = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
302
src/CurlSharp/CurlMulti.cs
Normal file
302
src/CurlSharp/CurlMulti.cs
Normal file
@@ -0,0 +1,302 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2014 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the <c>curl_multi_xxx</c> API.
|
||||
/// </summary>
|
||||
public class CurlMulti : IDisposable
|
||||
{
|
||||
// private members
|
||||
private readonly Hashtable _htEasy;
|
||||
private int _maxFd;
|
||||
private CurlMultiInfo[] _multiInfo;
|
||||
private bool _bGotMultiInfo;
|
||||
#if USE_LIBCURLSHIM
|
||||
private IntPtr _fdSets;
|
||||
#else
|
||||
private NativeMethods.fd_set _fd_read, _fd_write, _fd_except;
|
||||
#endif
|
||||
private IntPtr _pMulti;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// This is thrown
|
||||
/// if <see cref="Curl" /> hasn't bee properly initialized.
|
||||
/// </exception>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if the native <c>CurlMulti</c> handle wasn't
|
||||
/// created successfully.
|
||||
/// </exception>
|
||||
public CurlMulti()
|
||||
{
|
||||
Curl.EnsureCurl();
|
||||
_pMulti = NativeMethods.curl_multi_init();
|
||||
ensureHandle();
|
||||
_maxFd = 0;
|
||||
#if USE_LIBCURLSHIM
|
||||
_fdSets = IntPtr.Zero;
|
||||
_fdSets = NativeMethods.curl_shim_alloc_fd_sets();
|
||||
#else
|
||||
_fd_read = NativeMethods.fd_set.Create();
|
||||
_fd_read = NativeMethods.fd_set.Create();
|
||||
_fd_write = NativeMethods.fd_set.Create();
|
||||
_fd_except = NativeMethods.fd_set.Create();
|
||||
#endif
|
||||
_multiInfo = null;
|
||||
_bGotMultiInfo = false;
|
||||
_htEasy = new Hashtable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Max file descriptor
|
||||
/// </summary>
|
||||
public int MaxFd
|
||||
{
|
||||
get { return _maxFd; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~CurlMulti()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
// if (disposing) // managed member cleanup
|
||||
// unmanaged cleanup
|
||||
if (_pMulti != IntPtr.Zero)
|
||||
{
|
||||
NativeMethods.curl_multi_cleanup(_pMulti);
|
||||
_pMulti = IntPtr.Zero;
|
||||
}
|
||||
|
||||
#if USE_LIBCURLSHIM
|
||||
if (_fdSets != IntPtr.Zero)
|
||||
{
|
||||
NativeMethods.curl_shim_free_fd_sets(_fdSets);
|
||||
_fdSets = IntPtr.Zero;
|
||||
}
|
||||
#else
|
||||
_fd_read.Cleanup();
|
||||
_fd_write.Cleanup();
|
||||
_fd_except.Cleanup();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureHandle()
|
||||
{
|
||||
if (_pMulti == IntPtr.Zero)
|
||||
throw new NullReferenceException("No internal multi handle");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an CurlEasy object.
|
||||
/// </summary>
|
||||
/// <param name="curlEasy">
|
||||
/// <see cref="CurlEasy" /> object to add.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="CurlMultiCode" />, hopefully <c>CurlMultiCode.Ok</c>
|
||||
/// </returns>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if the native <c>CurlMulti</c> handle wasn't
|
||||
/// created successfully.
|
||||
/// </exception>
|
||||
public CurlMultiCode AddHandle(CurlEasy curlEasy)
|
||||
{
|
||||
ensureHandle();
|
||||
var p = curlEasy.Handle;
|
||||
_htEasy.Add(p, curlEasy);
|
||||
return NativeMethods.curl_multi_add_handle(_pMulti, p);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove an CurlEasy object.
|
||||
/// </summary>
|
||||
/// <param name="curlEasy">
|
||||
/// <see cref="CurlEasy" /> object to remove.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="CurlMultiCode" />, hopefully <c>CurlMultiCode.Ok</c>
|
||||
/// </returns>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if the native <c>CurlMulti</c> handle wasn't
|
||||
/// created successfully.
|
||||
/// </exception>
|
||||
public CurlMultiCode RemoveHandle(CurlEasy curlEasy)
|
||||
{
|
||||
ensureHandle();
|
||||
var p = curlEasy.Handle;
|
||||
_htEasy.Remove(p);
|
||||
return NativeMethods.curl_multi_remove_handle(_pMulti, curlEasy.Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a string description of an error code.
|
||||
/// </summary>
|
||||
/// <param name="errorNum">
|
||||
/// The <see cref="CurlMultiCode" /> for which to obtain the error
|
||||
/// string description.
|
||||
/// </param>
|
||||
/// <returns>The string description.</returns>
|
||||
public String StrError(CurlMultiCode errorNum)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(NativeMethods.curl_multi_strerror(errorNum));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read/write data to/from each CurlEasy object.
|
||||
/// </summary>
|
||||
/// <param name="runningObjects">
|
||||
/// The number of <see cref="CurlEasy" /> objects still in process is
|
||||
/// written by this function to this reference parameter.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="CurlMultiCode" />, hopefully <c>CurlMultiCode.Ok</c>
|
||||
/// </returns>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if the native <c>CurlMulti</c> handle wasn't
|
||||
/// created successfully.
|
||||
/// </exception>
|
||||
public CurlMultiCode Perform(ref int runningObjects)
|
||||
{
|
||||
ensureHandle();
|
||||
return NativeMethods.curl_multi_perform(_pMulti, ref runningObjects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set internal file desriptor information before calling Select.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="CurlMultiCode" />, hopefully <c>CurlMultiCode.Ok</c>
|
||||
/// </returns>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if the native <c>CurlMulti</c> handle wasn't
|
||||
/// created successfully.
|
||||
/// </exception>
|
||||
public CurlMultiCode FdSet()
|
||||
{
|
||||
ensureHandle();
|
||||
#if USE_LIBCURLSHIM
|
||||
return NativeMethods.curl_shim_multi_fdset(_pMulti, _fdSets, ref _maxFd);
|
||||
#else
|
||||
NativeMethods.FD_ZERO(_fd_read);
|
||||
NativeMethods.FD_ZERO(_fd_write);
|
||||
NativeMethods.FD_ZERO(_fd_except);
|
||||
return NativeMethods.curl_multi_fdset(_pMulti, ref _fd_read, ref _fd_write, ref _fd_except, ref _maxFd);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call <c>select()</c> on the CurlEasy objects.
|
||||
/// </summary>
|
||||
/// <param name="timeoutMillis">
|
||||
/// The timeout for the internal <c>select()</c> call,
|
||||
/// in milliseconds.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Number or <see cref="CurlEasy" /> objects with pending reads.
|
||||
/// </returns>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if the native <c>CurlMulti</c> handle wasn't
|
||||
/// created successfully.
|
||||
/// </exception>
|
||||
public int Select(int timeoutMillis)
|
||||
{
|
||||
ensureHandle();
|
||||
#if USE_LIBCURLSHIM
|
||||
return NativeMethods.curl_shim_select(_maxFd + 1, _fdSets, timeoutMillis);
|
||||
#else
|
||||
var timeout = NativeMethods.timeval.Create(timeoutMillis);
|
||||
return NativeMethods.select(_maxFd + 1, ref _fd_read, ref _fd_write, ref _fd_except, ref timeout);
|
||||
//return NativeMethods.select2(_maxFd + 1, _fd_read, _fd_write, _fd_except, timeout);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Obtain status information for a CurlMulti transfer. Requires
|
||||
/// CurlSharp be compiled with the libcurlshim helper.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// An array of <see cref="CurlMultiInfo" /> objects, one for each
|
||||
/// <see cref="CurlEasy" /> object child.
|
||||
/// </returns>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if the native <c>CurlMulti</c> handle wasn't
|
||||
/// created successfully.
|
||||
/// </exception>
|
||||
public CurlMultiInfo[] InfoRead()
|
||||
{
|
||||
if (_bGotMultiInfo)
|
||||
return _multiInfo;
|
||||
|
||||
_bGotMultiInfo = true;
|
||||
|
||||
#if USE_LIBCURLSHIM
|
||||
var nMsgs = 0;
|
||||
var pInfo = NativeMethods.curl_shim_multi_info_read(_pMulti, ref nMsgs);
|
||||
if (pInfo != IntPtr.Zero)
|
||||
{
|
||||
_multiInfo = new CurlMultiInfo[nMsgs];
|
||||
for (var i = 0; i < nMsgs; i++)
|
||||
{
|
||||
var msg = (CurlMessage) Marshal.ReadInt32(pInfo, i*12);
|
||||
var pEasy = Marshal.ReadIntPtr(pInfo, i*12 + 4);
|
||||
var code = (CurlCode) Marshal.ReadInt32(pInfo, i*12 + 8);
|
||||
_multiInfo[i] = new CurlMultiInfo(msg, (CurlEasy) _htEasy[pEasy], code);
|
||||
}
|
||||
NativeMethods.curl_shim_multi_info_free(pInfo);
|
||||
}
|
||||
|
||||
return _multiInfo;
|
||||
|
||||
#else
|
||||
|
||||
throw new NotImplementedException(
|
||||
"Sorry, CurlMulti.InfoRead is not implemented on this system."
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
65
src/CurlSharp/CurlMultiInfo.cs
Normal file
65
src/CurlSharp/CurlMultiInfo.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Wraps the <c>cURL</c> struct <c>CURLMsg</c>. This class provides
|
||||
/// status information following a <see cref="CurlMulti" /> transfer.
|
||||
/// </summary>
|
||||
public sealed class CurlMultiInfo
|
||||
{
|
||||
// private members
|
||||
private readonly CurlEasy _mCurlEasy;
|
||||
private readonly CurlMessage _msg;
|
||||
private readonly CurlCode _result;
|
||||
|
||||
internal CurlMultiInfo(CurlMessage msg, CurlEasy curlEasy, CurlCode result)
|
||||
{
|
||||
_msg = msg;
|
||||
_mCurlEasy = curlEasy;
|
||||
_result = result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the status code from the <see cref="CurlMessage" /> enumeration.
|
||||
/// </summary>
|
||||
public CurlMessage Msg
|
||||
{
|
||||
get { return _msg; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="CurlEasy" /> object for this child.
|
||||
/// </summary>
|
||||
public CurlEasy CurlEasyHandle
|
||||
{
|
||||
get { return _mCurlEasy; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the return code for the transfer, as a
|
||||
/// <see cref="CurlCode" />.
|
||||
/// </summary>
|
||||
public CurlCode Result
|
||||
{
|
||||
get { return _result; }
|
||||
}
|
||||
}
|
||||
}
|
276
src/CurlSharp/CurlShare.cs
Normal file
276
src/CurlSharp/CurlShare.cs
Normal file
@@ -0,0 +1,276 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This class provides an infrastructure for serializing access to data
|
||||
/// shared by multiple <see cref="CurlEasy" /> objects, including cookie data
|
||||
/// and Dns hosts. It implements the <c>curl_share_xxx</c> API.
|
||||
/// </summary>
|
||||
public class CurlShare : IDisposable
|
||||
{
|
||||
// private members
|
||||
private GCHandle _hThis; // for handle extraction
|
||||
private CurlShareCode _lastErrorCode;
|
||||
private string _lastErrorDescription;
|
||||
#if USE_LIBCURLSHIM
|
||||
private NativeMethods._ShimLockCallback _pDelLock; // lock delegate
|
||||
private NativeMethods._ShimUnlockCallback _pDelUnlock; // unlock delegate
|
||||
#endif
|
||||
private IntPtr _pShare; // share handle
|
||||
private CurlShareLockCallback _pfLock; // client lock delegate
|
||||
private CurlShareUnlockCallback _pfUnlock; // client unlock delegate
|
||||
private IntPtr _ptrThis; // numeric handle
|
||||
private Object _userData; // user data for delegates
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// This is thrown
|
||||
/// if <see cref="Curl" /> hasn't bee properly initialized.
|
||||
/// </exception>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if
|
||||
/// the native <c>share</c> handle wasn't created successfully.
|
||||
/// </exception>
|
||||
public CurlShare()
|
||||
{
|
||||
Curl.EnsureCurl();
|
||||
_pShare = NativeMethods.curl_share_init();
|
||||
EnsureHandle();
|
||||
LockFunction = null;
|
||||
UnlockFunction = null;
|
||||
UserData = null;
|
||||
installDelegates();
|
||||
}
|
||||
|
||||
public object UserData
|
||||
{
|
||||
get { return _userData; }
|
||||
set { _userData = value; }
|
||||
}
|
||||
|
||||
public CurlShareUnlockCallback UnlockFunction
|
||||
{
|
||||
get { return _pfUnlock; }
|
||||
set { _pfUnlock = value; }
|
||||
}
|
||||
|
||||
public CurlShareLockCallback LockFunction
|
||||
{
|
||||
get { return _pfLock; }
|
||||
set { _pfLock = value; }
|
||||
}
|
||||
|
||||
public CurlLockData Share
|
||||
{
|
||||
set { setShareOption(CurlShareOption.Share, value); }
|
||||
}
|
||||
|
||||
public CurlLockData Unshare
|
||||
{
|
||||
set { setShareOption(CurlShareOption.Unshare, value); }
|
||||
}
|
||||
|
||||
public CurlShareCode LastErrorCode
|
||||
{
|
||||
get { return _lastErrorCode; }
|
||||
}
|
||||
|
||||
public string LastErrorDescription
|
||||
{
|
||||
get { return _lastErrorDescription; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~CurlShare()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set options for this object.
|
||||
/// </summary>
|
||||
/// <param name="option">
|
||||
/// One of the values in the <see cref="CurlShareOption" />
|
||||
/// enumeration.
|
||||
/// </param>
|
||||
/// <param name="parameter">
|
||||
/// An appropriate object based on the value passed in the
|
||||
/// <c>option</c> argument. See <see cref="CurlShareOption" />
|
||||
/// for more information about the appropriate parameter type.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="CurlShareCode" />, hopefully
|
||||
/// <c>CurlShareCode.Ok</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="System.NullReferenceException">
|
||||
/// This is thrown if
|
||||
/// the native <c>share</c> handle wasn't created successfully.
|
||||
/// </exception>
|
||||
public CurlShareCode SetOpt(CurlShareOption option, Object parameter)
|
||||
{
|
||||
EnsureHandle();
|
||||
var retCode = CurlShareCode.Ok;
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case CurlShareOption.LockFunction:
|
||||
var lf = parameter as CurlShareLockCallback;
|
||||
if (lf == null)
|
||||
return CurlShareCode.BadOption;
|
||||
_pfLock = lf;
|
||||
break;
|
||||
|
||||
case CurlShareOption.UnlockFunction:
|
||||
var ulf = parameter as CurlShareUnlockCallback;
|
||||
if (ulf == null)
|
||||
return CurlShareCode.BadOption;
|
||||
_pfUnlock = ulf;
|
||||
break;
|
||||
|
||||
case CurlShareOption.Share:
|
||||
case CurlShareOption.Unshare:
|
||||
{
|
||||
var opt = (CurlLockData) Convert.ToInt32(parameter);
|
||||
retCode = setShareOption(option, opt);
|
||||
break;
|
||||
}
|
||||
|
||||
case CurlShareOption.UserData:
|
||||
_userData = parameter;
|
||||
break;
|
||||
|
||||
default:
|
||||
retCode = CurlShareCode.BadOption;
|
||||
break;
|
||||
}
|
||||
return retCode;
|
||||
}
|
||||
|
||||
private void setLastError(CurlShareCode code, CurlShareOption opt)
|
||||
{
|
||||
if (_lastErrorCode == CurlShareCode.Ok && code != CurlShareCode.Ok)
|
||||
{
|
||||
_lastErrorCode = code;
|
||||
_lastErrorDescription = string.Format("Error: {0} setting option {1}", StrError(code), opt);
|
||||
}
|
||||
}
|
||||
|
||||
private CurlShareCode setShareOption(CurlShareOption option, CurlLockData value)
|
||||
{
|
||||
var retCode = (value != CurlLockData.Cookie) && (value != CurlLockData.Dns)
|
||||
? CurlShareCode.BadOption
|
||||
: NativeMethods.curl_share_setopt(_pShare, option, (IntPtr) value);
|
||||
setLastError(retCode, option);
|
||||
return retCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a String description of an error code.
|
||||
/// </summary>
|
||||
/// <param name="errorNum">
|
||||
/// The <see cref="CurlShareCode" /> for which to obtain the error
|
||||
/// string description.
|
||||
/// </param>
|
||||
/// <returns>The string description.</returns>
|
||||
public String StrError(CurlShareCode errorNum)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(NativeMethods.curl_share_strerror(errorNum));
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
// if (disposing) cleanup managed objects
|
||||
if (_pShare != IntPtr.Zero)
|
||||
{
|
||||
#if USE_LIBCURLSHIM
|
||||
NativeMethods.curl_shim_cleanup_share_delegates(_pShare);
|
||||
#endif
|
||||
NativeMethods.curl_share_cleanup(_pShare);
|
||||
_hThis.Free();
|
||||
_ptrThis = IntPtr.Zero;
|
||||
_pShare = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal IntPtr GetHandle()
|
||||
{
|
||||
return _pShare;
|
||||
}
|
||||
|
||||
private void EnsureHandle()
|
||||
{
|
||||
if (_pShare == IntPtr.Zero)
|
||||
throw new NullReferenceException("No internal share handle");
|
||||
}
|
||||
|
||||
private void installDelegates()
|
||||
{
|
||||
_hThis = GCHandle.Alloc(this);
|
||||
_ptrThis = (IntPtr)_hThis;
|
||||
#if USE_LIBCURLSHIM
|
||||
_pDelLock = LockDelegate;
|
||||
_pDelUnlock = UnlockDelegate;
|
||||
NativeMethods.curl_shim_install_share_delegates(_pShare, _ptrThis, _pDelLock, _pDelUnlock);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void LockDelegate(int data, int access, IntPtr userPtr)
|
||||
{
|
||||
var gch = (GCHandle) userPtr;
|
||||
var share = (CurlShare) gch.Target;
|
||||
if (share == null)
|
||||
return;
|
||||
if (share.LockFunction == null)
|
||||
return;
|
||||
share.LockFunction((CurlLockData) data, (CurlLockAccess) access, share.UserData);
|
||||
}
|
||||
|
||||
internal static void UnlockDelegate(int data, IntPtr userPtr)
|
||||
{
|
||||
var gch = (GCHandle) userPtr;
|
||||
var share = (CurlShare) gch.Target;
|
||||
if (share == null)
|
||||
return;
|
||||
if (share.UnlockFunction == null)
|
||||
return;
|
||||
share.UnlockFunction((CurlLockData) data, share.UserData);
|
||||
}
|
||||
}
|
||||
}
|
103
src/CurlSharp/CurlSharp.csproj
Normal file
103
src/CurlSharp/CurlSharp.csproj
Normal file
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{74420A79-CC16-442C-8B1E-7C1B913844F0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CurlSharp</RootNamespace>
|
||||
<AssemblyName>CurlSharp</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Curl.cs" />
|
||||
<Compile Include="CurlEasy.cs" />
|
||||
<Compile Include="CurlHttpMultiPartForm.cs" />
|
||||
<Compile Include="CurlMulti.cs" />
|
||||
<Compile Include="CurlMultiInfo.cs" />
|
||||
<Compile Include="CurlShare.cs" />
|
||||
<Compile Include="CurlSlist.cs" />
|
||||
<Compile Include="CurlSslContext.cs" />
|
||||
<Compile Include="CurlVersionInfoData.cs" />
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="Enums\CurlClosePolicy.cs" />
|
||||
<Compile Include="Enums\CurlCode.cs" />
|
||||
<Compile Include="Enums\CurlFormCode.cs" />
|
||||
<Compile Include="Enums\CurlFormOption.cs" />
|
||||
<Compile Include="Enums\CurlFtpAuth.cs" />
|
||||
<Compile Include="Enums\CurlFtpSsl.cs" />
|
||||
<Compile Include="Enums\CurlHttpAuth.cs" />
|
||||
<Compile Include="Enums\CurlHttpVersion.cs" />
|
||||
<Compile Include="Enums\CurlInfo.cs" />
|
||||
<Compile Include="Enums\CurlInfoType.cs" />
|
||||
<Compile Include="Enums\CurlInitFlag.cs" />
|
||||
<Compile Include="Enums\CurlIoCommand.cs" />
|
||||
<Compile Include="Enums\CurlIoError.cs" />
|
||||
<Compile Include="Enums\CurlIpResolve.cs" />
|
||||
<Compile Include="Enums\CurlLockAccess.cs" />
|
||||
<Compile Include="Enums\CurlLockData.cs" />
|
||||
<Compile Include="Enums\CurlMessage.cs" />
|
||||
<Compile Include="Enums\CurlMultiCode.cs" />
|
||||
<Compile Include="Enums\CurlNetrcOption.cs" />
|
||||
<Compile Include="Enums\CurlOption.cs" />
|
||||
<Compile Include="Enums\CurlProxyType.cs" />
|
||||
<Compile Include="Enums\CurlShareCode.cs" />
|
||||
<Compile Include="Enums\CurlShareOption.cs" />
|
||||
<Compile Include="Enums\CurlSslVersion.cs" />
|
||||
<Compile Include="Enums\CurlTimeCond.cs" />
|
||||
<Compile Include="Enums\CurlVersion.cs" />
|
||||
<Compile Include="Enums\CurlVersionFeatureBitmask.cs" />
|
||||
<Compile Include="Callbacks\CurlEasyCallbacks.cs" />
|
||||
<Compile Include="Callbacks\CurlShareCallbacks.cs" />
|
||||
<Compile Include="SSLFix.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup />
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
|
||||
<CSharpFormattingPolicy IndentSwitchBody="True" IndentBlocksInsideExpressions="True" AnonymousMethodBraceStyle="NextLine" PropertyBraceStyle="NextLine" PropertyGetBraceStyle="NextLine" PropertySetBraceStyle="NextLine" EventBraceStyle="NextLine" EventAddBraceStyle="NextLine" EventRemoveBraceStyle="NextLine" StatementBraceStyle="NextLine" ElseNewLinePlacement="NewLine" CatchNewLinePlacement="NewLine" FinallyNewLinePlacement="NewLine" WhileNewLinePlacement="DoNotCare" ArrayInitializerWrapping="DoNotChange" ArrayInitializerBraceStyle="NextLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
144
src/CurlSharp/CurlSlist.cs
Normal file
144
src/CurlSharp/CurlSlist.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This class wraps a linked list of strings used in <c>cURL</c>. Use it
|
||||
/// to build string lists where they're required, such as when calling
|
||||
/// <see cref="CurlEasy.SetOpt" /> with <see cref="CurlOption.Quote" />
|
||||
/// as the option.
|
||||
/// </summary>
|
||||
public class CurlSlist : IDisposable
|
||||
{
|
||||
#if !USE_LIBCURLSHIM
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private class curl_slist
|
||||
{
|
||||
/// char*
|
||||
[MarshalAs(UnmanagedType.LPStr)] public string data;
|
||||
|
||||
/// curl_slist*
|
||||
public IntPtr next;
|
||||
}
|
||||
#endif
|
||||
private IntPtr _handle;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// This is thrown
|
||||
/// if <see cref="Curl" /> hasn't bee properly initialized.
|
||||
/// </exception>
|
||||
public CurlSlist()
|
||||
{
|
||||
Curl.EnsureCurl();
|
||||
_handle = IntPtr.Zero;
|
||||
}
|
||||
|
||||
public CurlSlist(IntPtr handle)
|
||||
{
|
||||
_handle = handle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read-only copy of the strings stored in the SList
|
||||
/// </summary>
|
||||
public List<string> Strings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_handle == IntPtr.Zero)
|
||||
return null;
|
||||
var strings = new List<string>();
|
||||
|
||||
#if !USE_LIBCURLSHIM
|
||||
var slist = new curl_slist();
|
||||
Marshal.PtrToStructure(_handle, slist);
|
||||
|
||||
while (true)
|
||||
{
|
||||
strings.Add(slist.data);
|
||||
if (slist.next != IntPtr.Zero)
|
||||
Marshal.PtrToStructure(slist.next, slist);
|
||||
else
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return strings;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
~CurlSlist()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a string to the list.
|
||||
/// </summary>
|
||||
/// <param name="str">The <c>string</c> to append.</param>
|
||||
public void Append(string str)
|
||||
{
|
||||
#if USE_LIBCURLSHIM
|
||||
_handle = NativeMethods.curl_shim_add_string_to_slist(_handle, str);
|
||||
#else
|
||||
_handle = NativeMethods.curl_slist_append(_handle, str);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Free all internal strings.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
internal IntPtr Handle
|
||||
{
|
||||
get { return _handle; }
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (_handle != IntPtr.Zero)
|
||||
{
|
||||
#if USE_LIBCURLSHIM
|
||||
NativeMethods.curl_shim_free_slist(_handle);
|
||||
#else
|
||||
NativeMethods.curl_slist_free_all(_handle);
|
||||
#endif
|
||||
_handle = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
49
src/CurlSharp/CurlSslContext.cs
Normal file
49
src/CurlSharp/CurlSslContext.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// An instance of this class is passed to the delegate
|
||||
/// <see cref="CurlSslContextCallback" />, if it's implemented.
|
||||
/// Within that delegate, the code will have to make native calls to
|
||||
/// the <c>OpenSSL</c> library with the value returned from the
|
||||
/// <see cref="CurlSslContext.Context" /> property cast to an
|
||||
/// <c>SSL_CTX</c> pointer.
|
||||
/// </summary>
|
||||
public sealed class CurlSslContext
|
||||
{
|
||||
private readonly IntPtr _pvContext;
|
||||
|
||||
internal CurlSslContext(IntPtr pvContext)
|
||||
{
|
||||
_pvContext = pvContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the underlying OpenSSL context.
|
||||
/// </summary>
|
||||
public IntPtr Context
|
||||
{
|
||||
get { return _pvContext; }
|
||||
}
|
||||
}
|
||||
}
|
207
src/CurlSharp/CurlVersionInfoData.cs
Normal file
207
src/CurlSharp/CurlVersionInfoData.cs
Normal file
@@ -0,0 +1,207 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This class wraps a <c>curl_version_info_data</c> struct. An instance is
|
||||
/// obtained by calling <see cref="Curl.GetVersionInfo" />.
|
||||
/// </summary>
|
||||
public sealed class CurlVersionInfoData
|
||||
{
|
||||
private const int OFFSET_AGE = 0;
|
||||
private const int OFFSET_VERSION = 4;
|
||||
private const int OFFSET_VERSION_NUM = 8;
|
||||
private const int OFFSET_HOST = 12;
|
||||
private const int OFFSET_FEATURES = 16;
|
||||
private const int OFFSET_SSL_VERSION = 20;
|
||||
private const int OFFSET_SSL_VERSION_NUM = 24;
|
||||
private const int OFFSET_LIBZ_VERSION = 28;
|
||||
private const int OFFSET_PROTOCOLS = 32;
|
||||
private const int OFFSET_ARES_VERSION = 36;
|
||||
private const int OFFSET_ARES_VERSION_NUM = 40;
|
||||
private const int OFFSET_LIBIDN_VERSION = 44;
|
||||
|
||||
private readonly IntPtr m_pVersionInfoData;
|
||||
|
||||
internal CurlVersionInfoData(CurlVersion ver)
|
||||
{
|
||||
m_pVersionInfoData = NativeMethods.curl_version_info(ver);
|
||||
}
|
||||
#if USE_LIBCURLSHIM
|
||||
/// <summary>
|
||||
/// Age of this struct, depending on how recent the linked-in
|
||||
/// <c>libcurl</c> is, as a <see cref="CurlVersion" />.
|
||||
/// </summary>
|
||||
public CurlVersion Age
|
||||
{
|
||||
get { return (CurlVersion) NativeMethods.curl_shim_get_version_int_value(m_pVersionInfoData, OFFSET_AGE); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the internal cURL version, as a <c>string</c>.
|
||||
/// </summary>
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(
|
||||
NativeMethods.curl_shim_get_version_char_ptr(m_pVersionInfoData, OFFSET_VERSION));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the internal cURL version number, a A 24-bit number created
|
||||
/// like this: [8 bits major number] | [8 bits minor number] | [8
|
||||
/// bits patch number]. For example, Version 7.12.2 is <c>0x070C02</c>.
|
||||
/// </summary>
|
||||
public int VersionNum
|
||||
{
|
||||
get { return NativeMethods.curl_shim_get_version_int_value(m_pVersionInfoData, OFFSET_VERSION_NUM); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the host information on which the underlying cURL was built.
|
||||
/// </summary>
|
||||
public string Host
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
Marshal.PtrToStringAnsi(NativeMethods.curl_shim_get_version_char_ptr(m_pVersionInfoData, OFFSET_HOST));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a bitmask of features, containing bits or'd from the
|
||||
/// <see cref="CurlVersionFeatureBitmask" /> enumeration.
|
||||
/// </summary>
|
||||
public int Features
|
||||
{
|
||||
get { return NativeMethods.curl_shim_get_version_int_value(m_pVersionInfoData, OFFSET_FEATURES); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the Ssl version, if it's linked in.
|
||||
/// </summary>
|
||||
public string SslVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
Marshal.PtrToStringAnsi(NativeMethods.curl_shim_get_version_char_ptr(m_pVersionInfoData,
|
||||
OFFSET_SSL_VERSION));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the Ssl version number, if Ssl is linked in.
|
||||
/// </summary>
|
||||
public int SSLVersionNum
|
||||
{
|
||||
get { return NativeMethods.curl_shim_get_version_int_value(m_pVersionInfoData, OFFSET_SSL_VERSION_NUM); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the libz version, if libz is linked in.
|
||||
/// </summary>
|
||||
public string LibZVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
Marshal.PtrToStringAnsi(NativeMethods.curl_shim_get_version_char_ptr(m_pVersionInfoData,
|
||||
OFFSET_LIBZ_VERSION));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the names of the supported protocols.
|
||||
/// </summary>
|
||||
public string[] Protocols
|
||||
{
|
||||
get
|
||||
{
|
||||
var nProts = NativeMethods.curl_shim_get_number_of_protocols(
|
||||
m_pVersionInfoData, OFFSET_PROTOCOLS);
|
||||
var aProts = new String[nProts];
|
||||
for (var i = 0; i < nProts; i++)
|
||||
{
|
||||
aProts[i] =
|
||||
Marshal.PtrToStringAnsi(NativeMethods.curl_shim_get_protocol_string(m_pVersionInfoData,
|
||||
OFFSET_PROTOCOLS, i));
|
||||
}
|
||||
return aProts;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the ARes version, if ARes is linked in.
|
||||
/// </summary>
|
||||
public string ARes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Age > CurlVersion.First)
|
||||
{
|
||||
return
|
||||
Marshal.PtrToStringAnsi(NativeMethods.curl_shim_get_version_char_ptr(m_pVersionInfoData,
|
||||
OFFSET_ARES_VERSION));
|
||||
}
|
||||
return "n.a.";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the ARes version number, if ARes is linked in.
|
||||
/// </summary>
|
||||
public int AResNum
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Age > CurlVersion.First)
|
||||
{
|
||||
return NativeMethods.curl_shim_get_version_int_value(m_pVersionInfoData, OFFSET_ARES_VERSION_NUM);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the libidn version, if libidn is linked in.
|
||||
/// </summary>
|
||||
public string LibIdn
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Age > CurlVersion.Second)
|
||||
{
|
||||
return
|
||||
Marshal.PtrToStringAnsi(NativeMethods.curl_shim_get_version_char_ptr(m_pVersionInfoData,
|
||||
OFFSET_LIBIDN_VERSION));
|
||||
}
|
||||
return "n.a.";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
46
src/CurlSharp/Enums/CurlClosePolicy.cs
Normal file
46
src/CurlSharp/Enums/CurlClosePolicy.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains values used to specify the order in which cached connections
|
||||
/// are closed. One of these is passed as the
|
||||
/// <see cref="CurlOption.ClosePolicy" /> option in a call
|
||||
/// to <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlClosePolicy
|
||||
{
|
||||
/// <summary>
|
||||
/// No close policy. Never use this.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Close the oldest cached connections first.
|
||||
/// </summary>
|
||||
Oldest = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Close the least recently used connections first.
|
||||
/// </summary>
|
||||
LeastRecentlyUsed = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Close the connections with the least traffic first.
|
||||
/// </summary>
|
||||
LeastTraffic = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Close the slowest connections first.
|
||||
/// </summary>
|
||||
Slowest = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Currently unimplemented.
|
||||
/// </summary>
|
||||
Callback = 5,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 6
|
||||
};
|
||||
}
|
403
src/CurlSharp/Enums/CurlCode.cs
Normal file
403
src/CurlSharp/Enums/CurlCode.cs
Normal file
@@ -0,0 +1,403 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Status code returned from <see cref="CurlEasy" /> functions.
|
||||
/// </summary>
|
||||
public enum CurlCode
|
||||
{
|
||||
/// <summary>
|
||||
/// All fine. Proceed as usual.
|
||||
/// </summary>
|
||||
Ok = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Aborted by callback. An internal callback returned "abort"
|
||||
/// to libcurl.
|
||||
/// </summary>
|
||||
AbortedByCallback = 42,
|
||||
|
||||
/// <summary>
|
||||
/// Internal error. A function was called in a bad order.
|
||||
/// </summary>
|
||||
BadCallingOrder = 44,
|
||||
|
||||
/// <summary>
|
||||
/// Unrecognized transfer encoding.
|
||||
/// </summary>
|
||||
BadContentEncoding = 61,
|
||||
|
||||
/// <summary>
|
||||
/// Attempting FTP resume beyond file size.
|
||||
/// </summary>
|
||||
BadDownloadResume = 36,
|
||||
|
||||
/// <summary>
|
||||
/// Internal error. A function was called with a bad parameter.
|
||||
/// </summary>
|
||||
BadFunctionArgument = 43,
|
||||
|
||||
/// <summary>
|
||||
/// Bad password entered. An error was signaled when the password was
|
||||
/// entered. This can also be the result of a "bad password" returned
|
||||
/// from a specified password callback.
|
||||
/// </summary>
|
||||
BadPasswordEntered = 46,
|
||||
|
||||
/// <summary>
|
||||
/// Failed to connect to host or proxy.
|
||||
/// </summary>
|
||||
CouldntConnect = 7,
|
||||
|
||||
/// <summary>
|
||||
/// Couldn't resolve host. The given remote host was not resolved.
|
||||
/// </summary>
|
||||
CouldntResolveHost = 6,
|
||||
|
||||
/// <summary>
|
||||
/// Couldn't resolve proxy. The given proxy host could not be resolved.
|
||||
/// </summary>
|
||||
CouldntResolveProxy = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Very early initialization code failed. This is likely to be an
|
||||
/// internal error or problem.
|
||||
/// </summary>
|
||||
FailedInit = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Maximum file size exceeded.
|
||||
/// </summary>
|
||||
FilesizeExceeded = 63,
|
||||
|
||||
/// <summary>
|
||||
/// A file given with FILE:// couldn't be opened. Most likely
|
||||
/// because the file path doesn't identify an existing file. Did
|
||||
/// you check file permissions?
|
||||
/// </summary>
|
||||
FileCouldntReadFile = 37,
|
||||
|
||||
/// <summary>
|
||||
/// We were denied access when trying to login to an FTP server or
|
||||
/// when trying to change working directory to the one given in the URL.
|
||||
/// </summary>
|
||||
FtpAccessDenied = 9,
|
||||
|
||||
/// <summary>
|
||||
/// An internal failure to lookup the host used for the new
|
||||
/// connection.
|
||||
/// </summary>
|
||||
FtpCantGetHost = 15,
|
||||
|
||||
/// <summary>
|
||||
/// A bad return code on either PASV or EPSV was sent by the FTP
|
||||
/// server, preventing libcurl from being able to continue.
|
||||
/// </summary>
|
||||
FtpCantReconnect = 16,
|
||||
|
||||
/// <summary>
|
||||
/// The FTP SIZE command returned error. SIZE is not a kosher FTP
|
||||
/// command, it is an extension and not all servers support it. This
|
||||
/// is not a surprising error.
|
||||
/// </summary>
|
||||
FtpCouldntGetSize = 32,
|
||||
|
||||
/// <summary>
|
||||
/// This was either a weird reply to a 'RETR' command or a zero byte
|
||||
/// transfer complete.
|
||||
/// </summary>
|
||||
FtpCouldntRetrFile = 19,
|
||||
|
||||
/// <summary>
|
||||
/// libcurl failed to set ASCII transfer type (TYPE A).
|
||||
/// </summary>
|
||||
FtpCouldntSetAscii = 29,
|
||||
|
||||
/// <summary>
|
||||
/// Received an error when trying to set the transfer mode to binary.
|
||||
/// </summary>
|
||||
FtpCouldntSetBinary = 17,
|
||||
|
||||
/// <summary>
|
||||
/// FTP couldn't STOR file. The server denied the STOR operation.
|
||||
/// The error buffer usually contains the server's explanation to this.
|
||||
/// </summary>
|
||||
FtpCouldntStorFile = 25,
|
||||
|
||||
/// <summary>
|
||||
/// The FTP REST command returned error. This should never happen
|
||||
/// if the server is sane.
|
||||
/// </summary>
|
||||
FtpCouldntUseRest = 31,
|
||||
|
||||
/// <summary>
|
||||
/// The FTP PORT command returned error. This mostly happen when
|
||||
/// you haven't specified a good enough address for libcurl to use.
|
||||
/// See <see cref="CurlOption.FtpPort" />.
|
||||
/// </summary>
|
||||
FtpPortFailed = 30,
|
||||
|
||||
/// <summary>
|
||||
/// When sending custom "QUOTE" commands to the remote server, one
|
||||
/// of the commands returned an error code that was 400 or higher.
|
||||
/// </summary>
|
||||
FtpQuoteError = 21,
|
||||
|
||||
/// <summary>
|
||||
/// Requested FTP Ssl level failed.
|
||||
/// </summary>
|
||||
FtpSslFailed = 64,
|
||||
|
||||
/// <summary>
|
||||
/// The FTP server rejected access to the server after the password
|
||||
/// was sent to it. It might be because the username and/or the
|
||||
/// password were incorrect or just that the server is not allowing
|
||||
/// you access for the moment etc.
|
||||
/// </summary>
|
||||
FtpUserPasswordIncorrect = 10,
|
||||
|
||||
/// <summary>
|
||||
/// FTP servers return a 227-line as a response to a PASV command.
|
||||
/// If libcurl fails to parse that line, this return code is
|
||||
/// passed back.
|
||||
/// </summary>
|
||||
FtpWeird227Format = 14,
|
||||
|
||||
/// <summary>
|
||||
/// After having sent the FTP password to the server, libcurl expects
|
||||
/// a proper reply. This error code indicates that an unexpected code
|
||||
/// was returned.
|
||||
/// </summary>
|
||||
FtpWeirdPassReply = 11,
|
||||
|
||||
/// <summary>
|
||||
/// libcurl failed to get a sensible result back from the server as
|
||||
/// a response to either a PASV or a EPSV command. The server is flawed.
|
||||
/// </summary>
|
||||
FtpWeirdPasvReply = 13,
|
||||
|
||||
/// <summary>
|
||||
/// After connecting to an FTP server, libcurl expects to get a
|
||||
/// certain reply back. This error code implies that it got a strange
|
||||
/// or bad reply. The given remote server is probably not an
|
||||
/// OK FTP server.
|
||||
/// </summary>
|
||||
FtpWeirdServerReply = 8,
|
||||
|
||||
/// <summary>
|
||||
/// After having sent user name to the FTP server, libcurl expects a
|
||||
/// proper reply. This error code indicates that an unexpected code
|
||||
/// was returned.
|
||||
/// </summary>
|
||||
FtpWeirdUserReply = 12,
|
||||
|
||||
/// <summary>
|
||||
/// After a completed file transfer, the FTP server did not respond a
|
||||
/// proper "transfer successful" code.
|
||||
/// </summary>
|
||||
FtpWriteError = 20,
|
||||
|
||||
/// <summary>
|
||||
/// Function not found. A required LDAP function was not found.
|
||||
/// </summary>
|
||||
FunctionNotFound = 41,
|
||||
|
||||
/// <summary>
|
||||
/// Nothing was returned from the server, and under the circumstances,
|
||||
/// getting nothing is considered an error.
|
||||
/// </summary>
|
||||
GotNothing = 52,
|
||||
|
||||
/// <summary>
|
||||
/// This is an odd error that mainly occurs due to internal confusion.
|
||||
/// </summary>
|
||||
HttpPostError = 34,
|
||||
|
||||
/// <summary>
|
||||
/// The HTTP server does not support or accept range requests.
|
||||
/// </summary>
|
||||
HttpRangeError = 33,
|
||||
|
||||
/// <summary>
|
||||
/// This is returned if <see cref="CurlOption.FailOnError" />
|
||||
/// is set TRUE and the HTTP server returns an error code that
|
||||
/// is >= 400.
|
||||
/// </summary>
|
||||
HttpReturnedError = 22,
|
||||
|
||||
/// <summary>
|
||||
/// Interface error. A specified outgoing interface could not be
|
||||
/// used. Set which interface to use for outgoing connections'
|
||||
/// source IP address with <see cref="CurlOption.Interface" />.
|
||||
/// </summary>
|
||||
InterfaceFailed = 45,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker; do not use in client applications.
|
||||
/// </summary>
|
||||
Last = 67,
|
||||
|
||||
/// <summary>
|
||||
/// LDAP cannot bind. LDAP bind operation failed.
|
||||
/// </summary>
|
||||
LdapCannotBind = 38,
|
||||
|
||||
/// <summary>
|
||||
/// Invalid LDAP URL.
|
||||
/// </summary>
|
||||
LdapInvalidUrl = 62,
|
||||
|
||||
/// <summary>
|
||||
/// LDAP search failed.
|
||||
/// </summary>
|
||||
LdapSearchFailed = 39,
|
||||
|
||||
/// <summary>
|
||||
/// Library not found. The LDAP library was not found.
|
||||
/// </summary>
|
||||
LibraryNotFound = 40,
|
||||
|
||||
/// <summary>
|
||||
/// Malformat user. User name badly specified. *Not currently used*
|
||||
/// </summary>
|
||||
MalformatUser = 24,
|
||||
|
||||
/// <summary>
|
||||
/// This is not an error. This used to be another error code in an
|
||||
/// old libcurl version and is currently unused.
|
||||
/// </summary>
|
||||
Obsolete = 50,
|
||||
|
||||
/// <summary>
|
||||
/// Operation timeout. The specified time-out period was reached
|
||||
/// according to the conditions.
|
||||
/// </summary>
|
||||
OperationTimeouted = 28,
|
||||
|
||||
/// <summary>
|
||||
/// Out of memory. A memory allocation request failed. This is serious
|
||||
/// badness and things are severely messed up if this ever occurs.
|
||||
/// </summary>
|
||||
OutOfMemory = 27,
|
||||
|
||||
/// <summary>
|
||||
/// A file transfer was shorter or larger than expected. This
|
||||
/// happens when the server first reports an expected transfer size,
|
||||
/// and then delivers data that doesn't match the previously
|
||||
/// given size.
|
||||
/// </summary>
|
||||
PartialFile = 18,
|
||||
|
||||
/// <summary>
|
||||
/// There was a problem reading a local file or an error returned by
|
||||
/// the read callback.
|
||||
/// </summary>
|
||||
ReadError = 26,
|
||||
|
||||
/// <summary>
|
||||
/// Failure with receiving network data.
|
||||
/// </summary>
|
||||
RecvError = 56,
|
||||
|
||||
/// <summary>
|
||||
/// Failed sending network data.
|
||||
/// </summary>
|
||||
SendError = 55,
|
||||
|
||||
/// <summary>
|
||||
/// Sending the data requires a rewind that failed.
|
||||
/// </summary>
|
||||
SendFailRewind = 65,
|
||||
|
||||
/// <summary>
|
||||
/// CurlShare is in use.
|
||||
/// </summary>
|
||||
ShareInUse = 57,
|
||||
|
||||
/// <summary>
|
||||
/// Problem with the CA cert (path? access rights?)
|
||||
/// </summary>
|
||||
SslCaCert = 60,
|
||||
|
||||
/// <summary>
|
||||
/// There's a problem with the local client certificate.
|
||||
/// </summary>
|
||||
SslCertProblem = 58,
|
||||
|
||||
/// <summary>
|
||||
/// Couldn't use specified cipher.
|
||||
/// </summary>
|
||||
SslCipher = 59,
|
||||
|
||||
/// <summary>
|
||||
/// A problem occurred somewhere in the Ssl/TLS handshake. You really
|
||||
/// want to use the <see cref="CurlEasy.CurlDebugCallback" /> delegate and read
|
||||
/// the message there as it pinpoints the problem slightly more. It
|
||||
/// could be certificates (file formats, paths, permissions),
|
||||
/// passwords, and others.
|
||||
/// </summary>
|
||||
SslConnectError = 35,
|
||||
|
||||
/// <summary>
|
||||
/// Failed to initialize Ssl engine.
|
||||
/// </summary>
|
||||
SslEngineInitFailed = 66,
|
||||
|
||||
/// <summary>
|
||||
/// The specified crypto engine wasn't found.
|
||||
/// </summary>
|
||||
SslEngineNotFound = 53,
|
||||
|
||||
/// <summary>
|
||||
/// Failed setting the selected Ssl crypto engine as default!
|
||||
/// </summary>
|
||||
SslEngineSetFailed = 54,
|
||||
|
||||
/// <summary>
|
||||
/// The remote server's Ssl certificate was deemed not OK.
|
||||
/// </summary>
|
||||
SslPeerCertificate = 51,
|
||||
|
||||
/// <summary>
|
||||
/// A telnet option string was improperly formatted.
|
||||
/// </summary>
|
||||
TelnetOptionSyntax = 49,
|
||||
|
||||
/// <summary>
|
||||
/// Too many redirects. When following redirects, libcurl hit the
|
||||
/// maximum amount. Set your limit with
|
||||
/// <see cref="CurlOption.MaxRedirs" />.
|
||||
/// </summary>
|
||||
TooManyRedirects = 47,
|
||||
|
||||
/// <summary>
|
||||
/// An option set with <see cref="CurlOption.TelnetOptions" />
|
||||
/// was not recognized/known. Refer to the appropriate documentation.
|
||||
/// </summary>
|
||||
UnknownTelnetOption = 48,
|
||||
|
||||
/// <summary>
|
||||
/// The URL you passed to libcurl used a protocol that this libcurl
|
||||
/// does not support. The support might be a compile-time option that
|
||||
/// wasn't used, it can be a misspelled protocol string or just a
|
||||
/// protocol libcurl has no code for.
|
||||
/// </summary>
|
||||
UnsupportedProtocol = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The URL was not properly formatted.
|
||||
/// </summary>
|
||||
UrlMalformat = 3,
|
||||
|
||||
/// <summary>
|
||||
/// URL user malformatted. The user-part of the URL syntax was not
|
||||
/// correct.
|
||||
/// </summary>
|
||||
UrlMalformatUser = 4,
|
||||
|
||||
/// <summary>
|
||||
/// An error occurred when writing received data to a local file,
|
||||
/// or an error was returned to libcurl from a write callback.
|
||||
/// </summary>
|
||||
WriteError = 23,
|
||||
};
|
||||
}
|
76
src/CurlSharp/Enums/CurlFormCode.cs
Normal file
76
src/CurlSharp/Enums/CurlFormCode.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* Project: libcurl.NET
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
* $Id: Enums.cs,v 1.1 2005/02/17 22:47:25 jeffreyphillips Exp $
|
||||
**************************************************************************/
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// One of these is returned by <see cref="CurlHttpMultiPartForm.AddSection" />.
|
||||
/// </summary>
|
||||
public enum CurlFormCode
|
||||
{
|
||||
/// <summary>
|
||||
/// The section was added properly.
|
||||
/// </summary>
|
||||
Ok = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Out-of-memory when adding the section.
|
||||
/// </summary>
|
||||
Memory = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Invalid attempt to add the same option more than once to a
|
||||
/// section.
|
||||
/// </summary>
|
||||
OptionTwice = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Invalid attempt to pass a <c>null</c> string or byte array in
|
||||
/// one of the arguments.
|
||||
/// </summary>
|
||||
Null = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Invalid attempt to pass an unrecognized option in one of the
|
||||
/// arguments.
|
||||
/// </summary>
|
||||
UnknownOption = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Incomplete argument lists.
|
||||
/// </summary>
|
||||
Incomplete = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Invalid attempt to provide a nested <c>Array</c>.
|
||||
/// </summary>
|
||||
IllegalArray = 6,
|
||||
|
||||
/// <summary>
|
||||
/// This will not be returned so long as HTTP is enabled, which
|
||||
/// it always is in libcurl.NET.
|
||||
/// </summary>
|
||||
Disabled = 7,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 8
|
||||
};
|
||||
}
|
142
src/CurlSharp/Enums/CurlFormOption.cs
Normal file
142
src/CurlSharp/Enums/CurlFormOption.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// These are options available to build a multi-part form section
|
||||
/// in a call to <see cref="CurlHttpMultiPartForm.AddSection" />
|
||||
/// </summary>
|
||||
public enum CurlFormOption
|
||||
{
|
||||
/// <summary>
|
||||
/// Another possibility to send options to
|
||||
/// <see cref="CurlHttpMultiPartForm.AddSection" /> is this option, that
|
||||
/// passes a <see cref="CurlForms" /> array reference as its value.
|
||||
/// Each <see cref="CurlForms" /> array element has a
|
||||
/// <see cref="CurlFormOption" /> and a <c>string</c>. All available
|
||||
/// options can be used in an array, except the <c>Array</c>
|
||||
/// option itself! The last argument in such an array must always be
|
||||
/// <c>End</c>.
|
||||
/// </summary>
|
||||
Array = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a <c>string</c>, tells libcurl that a buffer is to be
|
||||
/// used to upload data instead of using a file.
|
||||
/// </summary>
|
||||
Buffer = 11,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by an <c>int</c> with the size of the
|
||||
/// <c>BufferPtr</c> byte array, tells libcurl the length of
|
||||
/// the data to upload.
|
||||
/// </summary>
|
||||
BufferLength = 13,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a <c>byte[]</c> array, tells libcurl the address of
|
||||
/// the buffer containing data to upload (as indicated with
|
||||
/// <c>Buffer</c>). You must also use
|
||||
/// <c>BufferLength</c> to set the length of the buffer area.
|
||||
/// </summary>
|
||||
BufferPtr = 12,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies extra headers for the form POST section. This takes an
|
||||
/// <see cref="CurlSlist" /> prepared in the usual way using
|
||||
/// <see cref="CurlSlist.Append" /> and appends the list of headers to
|
||||
/// those libcurl automatically generates.
|
||||
/// </summary>
|
||||
ContentHeader = 15,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by an <c>int</c> setting the length of the contents.
|
||||
/// </summary>
|
||||
ContentsLength = 6,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a <c>string</c> with a content-type will make cURL
|
||||
/// use this given content-type for this file upload part, possibly
|
||||
/// instead of an internally chosen one.
|
||||
/// </summary>
|
||||
ContentType = 14,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a <c>string</c> is used for the contents of this part, the
|
||||
/// actual data to send away. If you'd like it to contain zero bytes,
|
||||
/// you need to set the length of the name with
|
||||
/// <c>ContentsLength</c>.
|
||||
/// </summary>
|
||||
CopyContents = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a <c>string</c> used to set the name of this part.
|
||||
/// If you'd like it to contain zero bytes, you need to set the
|
||||
/// length of the name with <c>NameLength</c>.
|
||||
/// </summary>
|
||||
CopyName = 1,
|
||||
|
||||
/// <summary>
|
||||
/// This should be the last argument to a call to
|
||||
/// <see cref="CurlHttpMultiPartForm.AddSection" />.
|
||||
/// </summary>
|
||||
End = 17,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a file name, makes this part a file upload part. It
|
||||
/// sets the file name field to the actual file name used here,
|
||||
/// it gets the contents of the file and passes as data and sets the
|
||||
/// content-type if the given file match one of the new internally
|
||||
/// known file extension. For <c>File</c> the user may send
|
||||
/// one or more files in one part by providing multiple <c>File</c>
|
||||
/// arguments each followed by the filename (and each <c>File</c>
|
||||
/// is allowed to have a <c>ContentType</c>).
|
||||
/// </summary>
|
||||
File = 10,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a file name, and does the file read: the contents
|
||||
/// will be used in as data in this part.
|
||||
/// </summary>
|
||||
FileContent = 7,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a <c>string</c> file name, will make libcurl use the
|
||||
/// given name in the file upload part, instead of the actual file
|
||||
/// name given to <c>File</c>.
|
||||
/// </summary>
|
||||
Filename = 16,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by an <c>int</c> setting the length of the name.
|
||||
/// </summary>
|
||||
NameLength = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Not used.
|
||||
/// </summary>
|
||||
Nothing = 0,
|
||||
|
||||
/// <summary>
|
||||
/// No longer used.
|
||||
/// </summary>
|
||||
Obsolete = 9,
|
||||
|
||||
/// <summary>
|
||||
/// No longer used.
|
||||
/// </summary>
|
||||
Obsolete2 = 18,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a <c>byte[]</c> used for the contents of this part.
|
||||
/// If you'd like it to contain zero bytes, you need to set the
|
||||
/// length of the name with <c>ContentsLength</c>.
|
||||
/// </summary>
|
||||
PtrContents = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Followed by a <c>byte[]</c> used for the name of this part.
|
||||
/// If you'd like it to contain zero bytes, you need to set the
|
||||
/// length of the name with <c>NameLength</c>.
|
||||
/// </summary>
|
||||
PtrName = 2
|
||||
};
|
||||
}
|
31
src/CurlSharp/Enums/CurlFtpAuth.cs
Normal file
31
src/CurlSharp/Enums/CurlFtpAuth.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This enumeration contains values used to specify the FTP Ssl
|
||||
/// authorization level using the
|
||||
/// <see cref="CurlOption.FtpSslAuth" /> option when calling
|
||||
/// <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlFtpAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// Let <c>libcurl</c> decide on the authorization scheme.
|
||||
/// </summary>
|
||||
Default = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Use "AUTH Ssl".
|
||||
/// </summary>
|
||||
SSL = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Use "AUTH TLS".
|
||||
/// </summary>
|
||||
TLS = 2,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker. Do not use in a client application.
|
||||
/// </summary>
|
||||
Last = 3
|
||||
};
|
||||
}
|
37
src/CurlSharp/Enums/CurlFtpSsl.cs
Normal file
37
src/CurlSharp/Enums/CurlFtpSsl.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This enumeration contains values used to specify the FTP Ssl level
|
||||
/// using the <see cref="CurlOption.FtpSsl" /> option when calling
|
||||
/// <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlFtpSsl
|
||||
{
|
||||
/// <summary>
|
||||
/// Don't attempt to use Ssl.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Try using Ssl, proceed as normal otherwise.
|
||||
/// </summary>
|
||||
Try = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Require Ssl for the control connection or fail with
|
||||
/// <see cref="CurlCode.FtpSslFailed" />.
|
||||
/// </summary>
|
||||
Control = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Require Ssl for all communication or fail with
|
||||
/// <see cref="CurlCode.FtpSslFailed" />.
|
||||
/// </summary>
|
||||
All = 3,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker. Do not use in a client application.
|
||||
/// </summary>
|
||||
Last = 4
|
||||
};
|
||||
}
|
65
src/CurlSharp/Enums/CurlHttpAuth.cs
Normal file
65
src/CurlSharp/Enums/CurlHttpAuth.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This enumeration contains values used to specify the HTTP authentication
|
||||
/// when using the <see cref="CurlOption.HttpAuth" /> option when
|
||||
/// calling <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlHttpAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// No authentication.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// HTTP Basic authentication. This is the default choice, and the
|
||||
/// only method that is in wide-spread use and supported virtually
|
||||
/// everywhere. This is sending the user name and password over the
|
||||
/// network in plain text, easily captured by others.
|
||||
/// </summary>
|
||||
Basic = 1,
|
||||
|
||||
/// <summary>
|
||||
/// HTTP Digest authentication. Digest authentication is defined
|
||||
/// in RFC2617 and is a more secure way to do authentication over
|
||||
/// public networks than the regular old-fashioned Basic method.
|
||||
/// </summary>
|
||||
Digest = 2,
|
||||
|
||||
/// <summary>
|
||||
/// HTTP GSS-Negotiate authentication. The GSS-Negotiate (also known
|
||||
/// as plain "Negotiate") method was designed by Microsoft and is
|
||||
/// used in their web applications. It is primarily meant as a
|
||||
/// support for Kerberos5 authentication but may be also used along
|
||||
/// with another authentication methods. For more information see IETF
|
||||
/// draft draft-brezak-spnego-http-04.txt.
|
||||
/// <note>
|
||||
/// You need to use a version of libcurl.NET built with a suitable
|
||||
/// GSS-API library for this to work. This is not currently standard.
|
||||
/// </note>
|
||||
/// </summary>
|
||||
GssNegotiate = 4,
|
||||
|
||||
/// <summary>
|
||||
/// HTTP Ntlm authentication. A proprietary protocol invented and
|
||||
/// used by Microsoft. It uses a challenge-response and hash concept
|
||||
/// similar to Digest, to prevent the password from being eavesdropped.
|
||||
/// </summary>
|
||||
Ntlm = 8,
|
||||
|
||||
/// <summary>
|
||||
/// This is a convenience macro that sets all bits and thus makes
|
||||
/// libcurl pick any it finds suitable. libcurl will automatically
|
||||
/// select the one it finds most secure.
|
||||
/// </summary>
|
||||
Any = 15, // ~0
|
||||
|
||||
/// <summary>
|
||||
/// This is a convenience macro that sets all bits except Basic
|
||||
/// and thus makes libcurl pick any it finds suitable. libcurl
|
||||
/// will automatically select the one it finds most secure.
|
||||
/// </summary>
|
||||
AnySafe = 14 // ~Basic
|
||||
};
|
||||
}
|
31
src/CurlSharp/Enums/CurlHttpVersion.cs
Normal file
31
src/CurlSharp/Enums/CurlHttpVersion.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains values used to specify the HTTP version level when using
|
||||
/// the <see cref="CurlOption.HttpVersion" /> option in a call
|
||||
/// to <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlHttpVersion
|
||||
{
|
||||
/// <summary>
|
||||
/// We don't care about what version the library uses. libcurl will
|
||||
/// use whatever it thinks fit.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Enforce HTTP 1.0 requests.
|
||||
/// </summary>
|
||||
Http1_0 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Enforce HTTP 1.1 requests.
|
||||
/// </summary>
|
||||
Http1_1 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Last entry in enumeration; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 3
|
||||
};
|
||||
}
|
222
src/CurlSharp/Enums/CurlInfo.cs
Normal file
222
src/CurlSharp/Enums/CurlInfo.cs
Normal file
@@ -0,0 +1,222 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This enumeration is used to extract information associated with an
|
||||
/// <see cref="CurlEasy" /> transfer. Specifically, a member of this
|
||||
/// enumeration is passed as the first argument to
|
||||
/// CurlEasy.GetInfo specifying the item to retrieve in the
|
||||
/// second argument, which is a reference to an <c>int</c>, a
|
||||
/// <c>double</c>, a <c>string</c>, a <c>DateTime</c> or an <c>object</c>.
|
||||
/// </summary>
|
||||
public enum CurlInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The second argument receives the elapsed time, as a <c>double</c>,
|
||||
/// in seconds, from the start until the connect to the remote host
|
||||
/// (or proxy) was completed.
|
||||
/// </summary>
|
||||
ConnectTime = 0x300005,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as a <c>double</c>, the content-length
|
||||
/// of the download. This is the value read from the Content-Length: field.
|
||||
/// </summary>
|
||||
ContentLengthDownload = 0x30000F,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as a <c>double</c>, the specified size
|
||||
/// of the upload.
|
||||
/// </summary>
|
||||
ContentLengthUpload = 0x300010,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as a <c>string</c>, the content-type of
|
||||
/// the downloaded object. This is the value read from the Content-Type:
|
||||
/// field. If you get <c>null</c>, it means that the server didn't
|
||||
/// send a valid Content-Type header or that the protocol used
|
||||
/// doesn't support this.
|
||||
/// </summary>
|
||||
ContentType = 0x100012,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as a <c>string</c>, the last
|
||||
/// used effective URL.
|
||||
/// </summary>
|
||||
EffectiveUrl = 0x100001,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as a <c>long</c>, the remote time
|
||||
/// of the retrieved document. You should construct a <c>DateTime</c>
|
||||
/// from this value, as shown in the <c>InfoDemo</c> sample. If you
|
||||
/// get a date in the distant
|
||||
/// past, it can be because of many reasons (unknown, the server
|
||||
/// hides it or the server doesn't support the command that tells
|
||||
/// document time etc) and the time of the document is unknown. Note
|
||||
/// that you must tell the server to collect this information before
|
||||
/// the transfer is made, by using the
|
||||
/// <see cref="CurlOption.Filetime" /> option to
|
||||
/// <see cref="CurlEasy.SetOpt" />. (Added in 7.5)
|
||||
/// </summary>
|
||||
Filetime = 0x20000E,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <c>int</c> specifying the total size
|
||||
/// of all the headers received.
|
||||
/// </summary>
|
||||
HeaderSize = 0x20000B,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as an <c>int</c>, a bitmask indicating
|
||||
/// the authentication method(s) available. The meaning of the bits is
|
||||
/// explained in the documentation of
|
||||
/// <see cref="CurlOption.HttpAuth" />. (Added in 7.10.8)
|
||||
/// </summary>
|
||||
HttpAuthAvail = 0x200017,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <c>int</c> indicating the numeric
|
||||
/// connect code for the HTTP request.
|
||||
/// </summary>
|
||||
HttpConnectCode = 0x200016,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker; do not use in client applications.
|
||||
/// </summary>
|
||||
LastOne = 0x1C,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as a <c>double</c>, the time, in
|
||||
/// seconds it took from the start until the name resolving was
|
||||
/// completed.
|
||||
/// </summary>
|
||||
NameLookupTime = 0x300004,
|
||||
|
||||
/// <summary>
|
||||
/// Never used.
|
||||
/// </summary>
|
||||
None = 0x0,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <c>int</c> indicating the
|
||||
/// number of current connections. (Added in 7.13.0)
|
||||
/// </summary>
|
||||
NumConnects = 0x20001A,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <c>int</c> indicating the operating
|
||||
/// system error number: <c>_errro</c> or <c>GetLastError()</c>,
|
||||
/// depending on the platform. (Added in 7.12.2)
|
||||
/// </summary>
|
||||
OsErrno = 0x200019,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as a <c>double</c>, the time, in
|
||||
/// seconds, it took from the start until the file transfer is just about
|
||||
/// to begin. This includes all pre-transfer commands and negotiations
|
||||
/// that are specific to the particular protocol(s) involved.
|
||||
/// </summary>
|
||||
PreTransferTime = 0x300006,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives a reference to the private data
|
||||
/// associated with the <see cref="CurlEasy" /> object (set with the
|
||||
/// <see cref="CurlOption.Private" /> option to
|
||||
/// <see cref="CurlEasy.SetOpt" />. (Added in 7.10.3)
|
||||
/// </summary>
|
||||
Private = 0x100015,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as an <c>int</c>, a bitmask
|
||||
/// indicating the authentication method(s) available for your
|
||||
/// proxy authentication. This will be a bitmask of
|
||||
/// <see cref="CurlHttpAuth" /> enumeration constants.
|
||||
/// (Added in 7.10.8)
|
||||
/// </summary>
|
||||
ProxyAuthAvail = 0x200018,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <c>int</c> indicating the total
|
||||
/// number of redirections that were actually followed. (Added in 7.9.7)
|
||||
/// </summary>
|
||||
RedirectCount = 0x200014,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives, as a <c>double</c>, the total time, in
|
||||
/// seconds, for all redirection steps include name lookup, connect,
|
||||
/// pretransfer and transfer before final transaction was started.
|
||||
/// <c>RedirectTime</c> contains the complete execution
|
||||
/// time for multiple redirections. (Added in 7.9.7)
|
||||
/// </summary>
|
||||
RedirectTime = 0x300013,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <c>int</c> containing the total size
|
||||
/// of the issued requests. This is so far only for HTTP requests. Note
|
||||
/// that this may be more than one request if
|
||||
/// <see cref="CurlOption.FollowLocation" /> is <c>true</c>.
|
||||
/// </summary>
|
||||
RequestSize = 0x20000C,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <c>int</c> with the last received HTTP
|
||||
/// or FTP code. This option was known as <c>CURLINFO_HTTP_CODE</c> in
|
||||
/// libcurl 7.10.7 and earlier.
|
||||
/// </summary>
|
||||
ResponseCode = 0x200002,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives a <c>double</c> with the total amount of
|
||||
/// bytes that were downloaded. The amount is only for the latest transfer
|
||||
/// and will be reset again for each new transfer.
|
||||
/// </summary>
|
||||
SizeDownload = 0x300008,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives a <c>double</c> with the total amount
|
||||
/// of bytes that were uploaded.
|
||||
/// </summary>
|
||||
SizeUpload = 0x300007,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives a <c>double</c> with the average
|
||||
/// download speed that cURL measured for the complete download.
|
||||
/// </summary>
|
||||
SpeedDownload = 0x300009,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives a <c>double</c> with the average
|
||||
/// upload speed that libcurl measured for the complete upload.
|
||||
/// </summary>
|
||||
SpeedUpload = 0x30000A,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <see cref="CurlSlist" /> containing
|
||||
/// the names of the available Ssl engines.
|
||||
/// </summary>
|
||||
SslEngines = 0x40001B,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives an <c>int</c> with the result of
|
||||
/// the certificate verification that was requested (using the
|
||||
/// <see cref="CurlOption.SslVerifyPeer" /> option in
|
||||
/// <see cref="CurlEasy.SetOpt" />.
|
||||
/// </summary>
|
||||
SslVerifyResult = 0x20000D,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives a <c>double</c> specifying the time,
|
||||
/// in seconds, from the start until the first byte is just about to be
|
||||
/// transferred. This includes <c>PreTransferTime</c> and
|
||||
/// also the time the server needs to calculate the result.
|
||||
/// </summary>
|
||||
StartTransferTime = 0x300011,
|
||||
|
||||
/// <summary>
|
||||
/// The second argument receives a <c>double</c> indicating the total transaction
|
||||
/// time in seconds for the previous transfer. This time does not include
|
||||
/// the connect time, so if you want the complete operation time,
|
||||
/// you should add the <c>ConnectTime</c>.
|
||||
/// </summary>
|
||||
TotalTime = 0x300003,
|
||||
};
|
||||
}
|
50
src/CurlSharp/Enums/CurlInfoType.cs
Normal file
50
src/CurlSharp/Enums/CurlInfoType.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A member of this enumeration is passed as the first parameter to the
|
||||
/// <see cref="CurlEasy.CurlDebugCallback" /> delegate to which libcurl passes
|
||||
/// debug messages.
|
||||
/// </summary>
|
||||
public enum CurlInfoType
|
||||
{
|
||||
/// <summary>
|
||||
/// The data is informational text.
|
||||
/// </summary>
|
||||
Text = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The data is header (or header-like) data received from the peer.
|
||||
/// </summary>
|
||||
HeaderIn = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The data is header (or header-like) data sent to the peer.
|
||||
/// </summary>
|
||||
HeaderOut = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The data is protocol data received from the peer.
|
||||
/// </summary>
|
||||
DataIn = 3,
|
||||
|
||||
/// <summary>
|
||||
/// The data is protocol data sent to the peer.
|
||||
/// </summary>
|
||||
DataOut = 4,
|
||||
|
||||
/// <summary>
|
||||
/// The data is Ssl-related data sent to the peer.
|
||||
/// </summary>
|
||||
SslDataIn = 5,
|
||||
|
||||
/// <summary>
|
||||
/// The data is Ssl-related data received from the peer.
|
||||
/// </summary>
|
||||
SslDataOut = 6,
|
||||
|
||||
/// <summary>
|
||||
/// End of enumeration marker, don't use in a client application.
|
||||
/// </summary>
|
||||
End = 7
|
||||
};
|
||||
}
|
34
src/CurlSharp/Enums/CurlInitFlag.cs
Normal file
34
src/CurlSharp/Enums/CurlInitFlag.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains values used to initialize libcurl internally. One of
|
||||
/// these is passed in the call to <see cref="Curl.GlobalInit" />.
|
||||
/// </summary>
|
||||
public enum CurlInitFlag
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialise nothing extra. This sets no bit.
|
||||
/// </summary>
|
||||
Nothing = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Initialize Ssl.
|
||||
/// </summary>
|
||||
Ssl = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the Win32 socket libraries.
|
||||
/// </summary>
|
||||
Win32 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Initialize everything possible. This sets all known bits.
|
||||
/// </summary>
|
||||
All = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Equivalent to <c>All</c>.
|
||||
/// </summary>
|
||||
Default = All
|
||||
};
|
||||
}
|
27
src/CurlSharp/Enums/CurlIoCommand.cs
Normal file
27
src/CurlSharp/Enums/CurlIoCommand.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Your handler for the <see cref="CurlEasy.CurlIoctlCallback" />
|
||||
/// delegate is passed one of these values as its first parameter.
|
||||
/// Right now, the only supported value is
|
||||
/// <code>RestartRead</code>.
|
||||
/// </summary>
|
||||
public enum CurlIoCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// No IOCTL operation; we should never see this.
|
||||
/// </summary>
|
||||
Nop = 0,
|
||||
|
||||
/// <summary>
|
||||
/// When this is sent, your callback may need to, for example,
|
||||
/// rewind a local file that is being sent via FTP.
|
||||
/// </summary>
|
||||
RestartRead = 1,
|
||||
|
||||
/// <summary>
|
||||
/// End of enumeration marker, don't use in a client application.
|
||||
/// </summary>
|
||||
Last = 2
|
||||
}
|
||||
}
|
30
src/CurlSharp/Enums/CurlIoError.cs
Normal file
30
src/CurlSharp/Enums/CurlIoError.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Your handler for the <see cref="CurlEasy.CurlIoctlCallback" /> delegate
|
||||
/// should return a member of this enumeration.
|
||||
/// </summary>
|
||||
public enum CurlIoError
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicate that the callback processed everything okay.
|
||||
/// </summary>
|
||||
Ok = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Unknown command sent to callback. Right now, only
|
||||
/// <code>RestartRead</code> is supported.
|
||||
/// </summary>
|
||||
UnknownCommand = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Indicate to libcurl that a restart failed.
|
||||
/// </summary>
|
||||
FailRestart = 2,
|
||||
|
||||
/// <summary>
|
||||
/// End of enumeration marker, don't use in a client application.
|
||||
/// </summary>
|
||||
Last = 3
|
||||
}
|
||||
}
|
26
src/CurlSharp/Enums/CurlIpResolve.cs
Normal file
26
src/CurlSharp/Enums/CurlIpResolve.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This enumeration contains values used to specify the IP resolution
|
||||
/// method when using the <see cref="CurlOption.IpResolve" />
|
||||
/// option in a call to <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlIpResolve
|
||||
{
|
||||
/// <summary>
|
||||
/// Default, resolves addresses to all IP versions that your system
|
||||
/// allows.
|
||||
/// </summary>
|
||||
Whatever = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Resolve to ipv4 addresses.
|
||||
/// </summary>
|
||||
V4 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Resolve to ipv6 addresses.
|
||||
/// </summary>
|
||||
V6 = 2
|
||||
};
|
||||
}
|
31
src/CurlSharp/Enums/CurlLockAccess.cs
Normal file
31
src/CurlSharp/Enums/CurlLockAccess.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Values containing the type of shared access requested when libcurl
|
||||
/// calls the <see cref="CurlShare.CurlShareLockCallback" /> delegate.
|
||||
/// </summary>
|
||||
public enum CurlLockAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// Unspecified action; the delegate should never receive this.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The delegate receives this call when libcurl is requesting
|
||||
/// read access to the shared resource.
|
||||
/// </summary>
|
||||
Shared = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The delegate receives this call when libcurl is requesting
|
||||
/// write access to the shared resource.
|
||||
/// </summary>
|
||||
Single = 2,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 3
|
||||
};
|
||||
}
|
48
src/CurlSharp/Enums/CurlLockData.cs
Normal file
48
src/CurlSharp/Enums/CurlLockData.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Members of this enumeration should be passed to
|
||||
/// <see cref="CurlShare.SetOpt" /> when it is called with the
|
||||
/// <c>CurlShare</c> or <c>Unshare</c> options
|
||||
/// provided in the <see cref="CurlShareOption" /> enumeration.
|
||||
/// </summary>
|
||||
public enum CurlLockData
|
||||
{
|
||||
/// <summary>
|
||||
/// Not used.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Used internally by libcurl.
|
||||
/// </summary>
|
||||
Share = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Cookie data will be shared across the <see cref="CurlEasy" /> objects
|
||||
/// using this shared object.
|
||||
/// </summary>
|
||||
Cookie = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Cached Dns hosts will be shared across the <see cref="CurlEasy" />
|
||||
/// objects using this shared object.
|
||||
/// </summary>
|
||||
Dns = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Not supported yet.
|
||||
/// </summary>
|
||||
SslSession = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Not supported yet.
|
||||
/// </summary>
|
||||
Connect = 5,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 6
|
||||
};
|
||||
}
|
25
src/CurlSharp/Enums/CurlMessage.cs
Normal file
25
src/CurlSharp/Enums/CurlMessage.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// The status code associated with an <see cref="CurlEasy" /> object in a
|
||||
/// <see cref="CurlMulti" /> operation. One of these is returned in response
|
||||
/// to reading the <see cref="CurlMultiInfo.Msg" /> property.
|
||||
/// </summary>
|
||||
public enum CurlMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// First entry in the enumeration, not used.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The associated <see cref="CurlEasy" /> object completed.
|
||||
/// </summary>
|
||||
Done = 1,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker, not used.
|
||||
/// </summary>
|
||||
Last = 2
|
||||
};
|
||||
}
|
46
src/CurlSharp/Enums/CurlMultiCode.cs
Normal file
46
src/CurlSharp/Enums/CurlMultiCode.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains return codes for many of the functions in the
|
||||
/// <see cref="CurlMulti" /> class.
|
||||
/// </summary>
|
||||
public enum CurlMultiCode
|
||||
{
|
||||
/// <summary>
|
||||
/// You should call <see cref="CurlMulti.Perform" /> again before calling
|
||||
/// <see cref="CurlMulti.Select" />.
|
||||
/// </summary>
|
||||
CallMultiPerform = -1,
|
||||
|
||||
/// <summary>
|
||||
/// The function succeded.
|
||||
/// </summary>
|
||||
Ok = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The internal <see cref="CurlMulti" /> is bad.
|
||||
/// </summary>
|
||||
BadHandle = 1,
|
||||
|
||||
/// <summary>
|
||||
/// One of the <see cref="CurlEasy" /> handles associated with the
|
||||
/// <see cref="CurlMulti" /> object is bad.
|
||||
/// </summary>
|
||||
BadEasyHandle = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Out of memory. This is a severe problem.
|
||||
/// </summary>
|
||||
OutOfMemory = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Internal error deep within the libcurl library.
|
||||
/// </summary>
|
||||
InternalError = 4,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker, not used.
|
||||
/// </summary>
|
||||
Last = 5
|
||||
};
|
||||
}
|
43
src/CurlSharp/Enums/CurlNetrcOption.cs
Normal file
43
src/CurlSharp/Enums/CurlNetrcOption.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains values used to specify the preference of libcurl between
|
||||
/// using user names and passwords from your ~/.netrc file, relative to
|
||||
/// user names and passwords in the URL supplied with
|
||||
/// <see cref="CurlOption.Url" />. This is passed when using
|
||||
/// the <see cref="CurlOption.Netrc" /> option in a call
|
||||
/// to <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlNetrcOption
|
||||
{
|
||||
/// <summary>
|
||||
/// The library will ignore the file and use only the information
|
||||
/// in the URL. This is the default.
|
||||
/// </summary>
|
||||
Ignored = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The use of your ~/.netrc file is optional, and information in the
|
||||
/// URL is to be preferred. The file will be scanned with the host
|
||||
/// and user name (to find the password only) or with the host only,
|
||||
/// to find the first user name and password after that machine,
|
||||
/// which ever information is not specified in the URL.
|
||||
/// <para>
|
||||
/// Undefined values of the option will have this effect.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
Optional = 1,
|
||||
|
||||
/// <summary>
|
||||
/// This value tells the library that use of the file is required,
|
||||
/// to ignore the information in the URL, and to search the file
|
||||
/// with the host only.
|
||||
/// </summary>
|
||||
Required = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Last entry in enumeration; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 3
|
||||
};
|
||||
}
|
1577
src/CurlSharp/Enums/CurlOption.cs
Normal file
1577
src/CurlSharp/Enums/CurlOption.cs
Normal file
File diff suppressed because it is too large
Load Diff
27
src/CurlSharp/Enums/CurlProxyType.cs
Normal file
27
src/CurlSharp/Enums/CurlProxyType.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This enumeration contains values used to specify the proxy type when
|
||||
/// using the <see cref="CurlOption.Proxy" /> option when calling
|
||||
/// <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlProxyType
|
||||
{
|
||||
/// <summary>
|
||||
/// Ordinary HTTP proxy.
|
||||
/// </summary>
|
||||
Http = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Use if the proxy supports SOCKS4 user authentication. If you're
|
||||
/// unfamiliar with this, consult your network administrator.
|
||||
/// </summary>
|
||||
Socks4 = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Use if the proxy supports SOCKS5 user authentication. If you're
|
||||
/// unfamiliar with this, consult your network administrator.
|
||||
/// </summary>
|
||||
Socks5 = 5
|
||||
};
|
||||
}
|
40
src/CurlSharp/Enums/CurlShareCode.cs
Normal file
40
src/CurlSharp/Enums/CurlShareCode.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains return codes from many of the functions in the
|
||||
/// <see cref="CurlShare" /> class.
|
||||
/// </summary>
|
||||
public enum CurlShareCode
|
||||
{
|
||||
/// <summary>
|
||||
/// The function succeeded.
|
||||
/// </summary>
|
||||
Ok = 0,
|
||||
|
||||
/// <summary>
|
||||
/// A bad option was passed to <see cref="CurlShare.SetOpt" />.
|
||||
/// </summary>
|
||||
BadOption = 1,
|
||||
|
||||
/// <summary>
|
||||
/// An attempt was made to pass an option to
|
||||
/// <see cref="CurlShare.SetOpt" /> while the CurlShare object is in use.
|
||||
/// </summary>
|
||||
InUse = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="CurlShare" /> object's internal handle is invalid.
|
||||
/// </summary>
|
||||
Invalid = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Out of memory. This is a severe problem.
|
||||
/// </summary>
|
||||
NoMem = 4,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 5
|
||||
};
|
||||
}
|
53
src/CurlSharp/Enums/CurlShareOption.cs
Normal file
53
src/CurlSharp/Enums/CurlShareOption.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A member of this enumeration is passed to the function
|
||||
/// <see cref="CurlShare.SetOpt" /> to configure a <see cref="CurlShare" />
|
||||
/// transfer.
|
||||
/// </summary>
|
||||
public enum CurlShareOption
|
||||
{
|
||||
/// <summary>
|
||||
/// Start-of-enumeration; do not use in application code.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The parameter, which should be a member of the
|
||||
/// <see cref="CurlLockData" /> enumeration, specifies a type of
|
||||
/// data that should be shared.
|
||||
/// </summary>
|
||||
Share = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The parameter, which should be a member of the
|
||||
/// <see cref="CurlLockData" /> enumeration, specifies a type of
|
||||
/// data that should be unshared.
|
||||
/// </summary>
|
||||
Unshare = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The parameter should be a reference to a
|
||||
/// <see cref="CurlShare.CurlShareLockCallback" /> delegate.
|
||||
/// </summary>
|
||||
LockFunction = 3,
|
||||
|
||||
/// <summary>
|
||||
/// The parameter should be a reference to a
|
||||
/// <see cref="CurlShare.CurlShareUnlockCallback" /> delegate.
|
||||
/// </summary>
|
||||
UnlockFunction = 4,
|
||||
|
||||
/// <summary>
|
||||
/// The parameter allows you to specify an object reference that
|
||||
/// will passed to the <see cref="CurlShare.CurlShareLockCallback" /> delegate and
|
||||
/// the <see cref="CurlShare.CurlShareUnlockCallback" /> delegate.
|
||||
/// </summary>
|
||||
UserData = 5,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 6
|
||||
};
|
||||
}
|
36
src/CurlSharp/Enums/CurlSslVersion.cs
Normal file
36
src/CurlSharp/Enums/CurlSslVersion.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains values used to specify the Ssl version level when using
|
||||
/// the <see cref="CurlOption.SslVersion" /> option in a call
|
||||
/// to <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlSslVersion
|
||||
{
|
||||
/// <summary>
|
||||
/// Use whatever version the Ssl library selects.
|
||||
/// </summary>
|
||||
Default = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Use TLS version 1.
|
||||
/// </summary>
|
||||
Tlsv1 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Use Ssl version 2. This is not a good option unless it's the
|
||||
/// only version supported by the remote server.
|
||||
/// </summary>
|
||||
Sslv2 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Use Ssl version 3. This is a preferred option.
|
||||
/// </summary>
|
||||
Sslv3 = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Last entry in enumeration; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 4
|
||||
};
|
||||
}
|
39
src/CurlSharp/Enums/CurlTimeCond.cs
Normal file
39
src/CurlSharp/Enums/CurlTimeCond.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains values used to specify the time condition when using
|
||||
/// the <see cref="CurlOption.TimeCondition" /> option in a call
|
||||
/// to <see cref="CurlEasy.SetOpt" />
|
||||
/// </summary>
|
||||
public enum CurlTimeCond
|
||||
{
|
||||
/// <summary>
|
||||
/// Use no time condition.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The time condition is true if the resource has been modified
|
||||
/// since the date/time passed in
|
||||
/// <see cref="CurlOption.TimeValue" />.
|
||||
/// </summary>
|
||||
IfModSince = 1,
|
||||
|
||||
/// <summary>
|
||||
/// True if the resource has not been modified since the date/time
|
||||
/// passed in <see cref="CurlOption.TimeValue" />.
|
||||
/// </summary>
|
||||
IfUnmodSince = 2,
|
||||
|
||||
/// <summary>
|
||||
/// True if the resource's last modification date/time equals that
|
||||
/// passed in <see cref="CurlOption.TimeValue" />.
|
||||
/// </summary>
|
||||
LastMod = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Last entry in enumeration; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 4
|
||||
};
|
||||
}
|
34
src/CurlSharp/Enums/CurlVersion.cs
Normal file
34
src/CurlSharp/Enums/CurlVersion.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A member of this enumeration is passed to the function
|
||||
/// <see cref="Curl.GetVersionInfo" />
|
||||
/// </summary>
|
||||
public enum CurlVersion
|
||||
{
|
||||
/// <summary>
|
||||
/// Capabilities associated with the initial version of libcurl.
|
||||
/// </summary>
|
||||
First = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Capabilities associated with the second version of libcurl.
|
||||
/// </summary>
|
||||
Second = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Capabilities associated with the third version of libcurl.
|
||||
/// </summary>
|
||||
Third = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Same as <c>Third</c>.
|
||||
/// </summary>
|
||||
Now = Third,
|
||||
|
||||
/// <summary>
|
||||
/// End-of-enumeration marker; do not use in application code.
|
||||
/// </summary>
|
||||
Last = 3
|
||||
};
|
||||
}
|
71
src/CurlSharp/Enums/CurlVersionFeatureBitmask.cs
Normal file
71
src/CurlSharp/Enums/CurlVersionFeatureBitmask.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A bitmask of libcurl features OR'd together as the value of the
|
||||
/// property <see cref="CurlVersionInfoData.Features" />. The feature
|
||||
/// bits are summarized in the table below.
|
||||
/// </summary>
|
||||
public enum CurlVersionFeatureBitmask
|
||||
{
|
||||
/// <summary>
|
||||
/// Supports Ipv6.
|
||||
/// </summary>
|
||||
Ipv6 = 0x01,
|
||||
|
||||
/// <summary>
|
||||
/// Supports kerberos4 (when using FTP).
|
||||
/// </summary>
|
||||
Kerberos64 = 0x02,
|
||||
|
||||
/// <summary>
|
||||
/// Supports Ssl (HTTPS/FTPS).
|
||||
/// </summary>
|
||||
Ssl = 0x04,
|
||||
|
||||
/// <summary>
|
||||
/// Supports HTTP deflate using libz.
|
||||
/// </summary>
|
||||
LibZ = 0x08,
|
||||
|
||||
/// <summary>
|
||||
/// Supports HTTP Ntlm (added in 7.10.6).
|
||||
/// </summary>
|
||||
Ntlm = 0x10,
|
||||
|
||||
/// <summary>
|
||||
/// Supports HTTP GSS-Negotiate (added in 7.10.6).
|
||||
/// </summary>
|
||||
GssNegotiate = 0x20,
|
||||
|
||||
/// <summary>
|
||||
/// libcurl was built with extra debug capabilities built-in. This
|
||||
/// is mainly of interest for libcurl hackers. (added in 7.10.6)
|
||||
/// </summary>
|
||||
Debug = 0x40,
|
||||
|
||||
/// <summary>
|
||||
/// libcurl was built with support for asynchronous name lookups,
|
||||
/// which allows more exact timeouts (even on Windows) and less
|
||||
/// blocking when using the multi interface. (added in 7.10.7)
|
||||
/// </summary>
|
||||
AsynchDns = 0x80,
|
||||
|
||||
/// <summary>
|
||||
/// libcurl was built with support for Spnego authentication
|
||||
/// (Simple and Protected GSS-API Negotiation Mechanism, defined
|
||||
/// in RFC 2478.) (added in 7.10.8)
|
||||
/// </summary>
|
||||
Spnego = 0x100,
|
||||
|
||||
/// <summary>
|
||||
/// libcurl was built with support for large files.
|
||||
/// </summary>
|
||||
LargeFile = 0x200,
|
||||
|
||||
/// <summary>
|
||||
/// libcurl was built with support for IDNA, domain names with
|
||||
/// international letters.
|
||||
/// </summary>
|
||||
Idn = 0x400
|
||||
};
|
||||
}
|
402
src/CurlSharp/NativeMethods.cs
Normal file
402
src/CurlSharp/NativeMethods.cs
Normal file
@@ -0,0 +1,402 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* CurlS#arp
|
||||
*
|
||||
* Copyright (c) 2014 Dr. Masroor Ehsan (masroore@gmail.com)
|
||||
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
|
||||
*
|
||||
* This software is licensed as described in the file LICENSE, which you
|
||||
* should have received as part of this distribution.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of this Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the LICENSE file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
|
||||
* ANY KIND, either express or implied.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
//#define USE_LIBCURLSHIM
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// P/Invoke signatures.
|
||||
/// </summary>
|
||||
internal static unsafe class NativeMethods
|
||||
{
|
||||
#if WIN64
|
||||
private const string CURL_LIB = "libcurl64.dll";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if USE_LIBCURLSHIM
|
||||
private const string CURLSHIM_LIB = "libcurlshim64.dll";
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
#if LINUX
|
||||
private const string CURL_LIB = "libcurl";
|
||||
#else
|
||||
private const string CURL_LIB = "libcurl.dll";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if USE_LIBCURLSHIM
|
||||
private const string CURLSHIM_LIB = "libcurlshim.dll";
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if !USE_LIBCURLSHIM
|
||||
#if LINUX
|
||||
private const string WINSOCK_LIB = "libc";
|
||||
#else
|
||||
private const string WINSOCK_LIB = "ws2_32.dll";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// internal delegates from cURL
|
||||
|
||||
// libcurl imports
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_global_init (int flags);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_global_cleanup ();
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern IntPtr curl_escape (String url, int length);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern IntPtr curl_unescape (String url, int length);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_free (IntPtr p);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_version ();
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_easy_init ();
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_easy_cleanup (IntPtr pCurl);
|
||||
|
||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
internal delegate int _CurlGenericCallback (IntPtr ptr, int sz, int nmemb, IntPtr userdata);
|
||||
|
||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
internal delegate int _CurlProgressCallback (
|
||||
IntPtr extraData, double dlTotal, double dlNow, double ulTotal, double ulNow);
|
||||
|
||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
internal delegate int _CurlDebugCallback (
|
||||
IntPtr ptrCurl, CurlInfoType infoType, string message, int size, IntPtr ptrUserData);
|
||||
|
||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
internal delegate int _CurlSslCtxCallback (IntPtr ctx, IntPtr parm);
|
||||
|
||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
internal delegate CurlIoError _CurlIoctlCallback (CurlIoCommand cmd, IntPtr parm);
|
||||
|
||||
// curl_easy_setopt() overloads
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, IntPtr parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, string parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, byte[] parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, long parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, bool parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
|
||||
internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlGenericCallback parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
|
||||
internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlProgressCallback parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
|
||||
internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlDebugCallback parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
|
||||
internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlSslCtxCallback parm);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
|
||||
internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlIoctlCallback parm);
|
||||
|
||||
#if !USE_LIBCURLSHIM
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlMultiCode curl_multi_fdset (IntPtr pmulti,
|
||||
[In, Out] ref fd_set read_fd_set,
|
||||
[In, Out] ref fd_set write_fd_set,
|
||||
[In, Out] ref fd_set exc_fd_set,
|
||||
[In, Out] ref int max_fd);
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
internal struct fd_set
|
||||
{
|
||||
internal uint fd_count;
|
||||
//[MarshalAs(UnmanagedType.ByValArray, SizeConst = FD_SETSIZE)] internal IntPtr[] fd_array;
|
||||
internal fixed uint fd_array[FD_SETSIZE];
|
||||
|
||||
internal const int FD_SETSIZE = 64;
|
||||
|
||||
internal void Cleanup ()
|
||||
{
|
||||
//fd_array = null;
|
||||
}
|
||||
|
||||
internal static fd_set Create ()
|
||||
{
|
||||
return new fd_set {
|
||||
//fd_array = new IntPtr[FD_SETSIZE],
|
||||
fd_count = 0
|
||||
};
|
||||
}
|
||||
|
||||
internal static fd_set Create (IntPtr socket)
|
||||
{
|
||||
var handle = Create ();
|
||||
handle.fd_count = 1;
|
||||
handle.fd_array [0] = (uint)socket;
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void FD_ZERO (fd_set fds)
|
||||
{
|
||||
for (var i = 0; i < fd_set.FD_SETSIZE; i++) {
|
||||
//fds.fd_array[i] = (IntPtr) 0;
|
||||
fds.fd_array [i] = 0;
|
||||
}
|
||||
fds.fd_count = 0;
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
internal struct timeval
|
||||
{
|
||||
/// <summary>
|
||||
/// Time interval, in seconds.
|
||||
/// </summary>
|
||||
internal int tv_sec;
|
||||
|
||||
/// <summary>
|
||||
/// Time interval, in microseconds.
|
||||
/// </summary>
|
||||
internal int tv_usec;
|
||||
|
||||
internal static timeval Create (int milliseconds)
|
||||
{
|
||||
return new timeval {
|
||||
tv_sec = milliseconds / 1000,
|
||||
tv_usec = (milliseconds % 1000) * 1000
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
[DllImport (WINSOCK_LIB, EntryPoint = "select")]
|
||||
internal static extern int select (
|
||||
int nfds, // number of sockets, (ignored in winsock)
|
||||
[In, Out] ref fd_set readfds, // read sockets to watch
|
||||
[In, Out] ref fd_set writefds, // write sockets to watch
|
||||
[In, Out] ref fd_set exceptfds, // error sockets to watch
|
||||
ref timeval timeout);
|
||||
|
||||
//[DllImport(WINSOCK_LIB, EntryPoint = "select")]
|
||||
//internal static extern int select(int ndfs, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout);
|
||||
#endif
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_easy_perform (IntPtr pCurl);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_easy_duphandle (IntPtr pCurl);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_easy_strerror (CurlCode err);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_easy_getinfo (IntPtr pCurl, CurlInfo info, ref IntPtr pInfo);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlCode curl_easy_getinfo (IntPtr pCurl, CurlInfo info, ref double dblVal);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_easy_reset (IntPtr pCurl);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_multi_init ();
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlMultiCode curl_multi_cleanup (IntPtr pmulti);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlMultiCode curl_multi_add_handle (IntPtr pmulti, IntPtr peasy);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlMultiCode curl_multi_remove_handle (IntPtr pmulti, IntPtr peasy);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_multi_strerror (CurlMultiCode errorNum);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlMultiCode curl_multi_perform (IntPtr pmulti, ref int runningHandles);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_formfree (IntPtr pForm);
|
||||
|
||||
#if !USE_LIBCURLSHIM
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern int curl_formadd (ref IntPtr pHttppost, ref IntPtr pLastPost,
|
||||
int codeFirst, IntPtr bufFirst,
|
||||
int codeNext, IntPtr bufNext,
|
||||
int codeLast);
|
||||
#endif
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_share_init ();
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlShareCode curl_share_cleanup (IntPtr pShare);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_share_strerror (CurlShareCode errorCode);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlShareCode curl_share_setopt (IntPtr pShare, CurlShareOption optCode, IntPtr option);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern IntPtr curl_slist_append (IntPtr slist, string data);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlShareCode curl_slist_free_all (IntPtr pList);
|
||||
|
||||
[DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_version_info (CurlVersion ver);
|
||||
|
||||
#if USE_LIBCURLSHIM
|
||||
|
||||
// libcurlshim imports
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_initialize();
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_cleanup();
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_shim_alloc_strings();
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl,
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal static extern IntPtr curl_shim_add_string_to_slist(
|
||||
IntPtr pStrings, String str);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl,
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal static extern IntPtr curl_shim_get_string_from_slist(
|
||||
IntPtr pSlist, ref IntPtr pStr);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl,
|
||||
CharSet = CharSet.Ansi)]
|
||||
internal static extern IntPtr curl_shim_add_string(IntPtr pStrings, String str);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_free_strings(IntPtr pStrings);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern int curl_shim_install_delegates(IntPtr pCurl, IntPtr pThis,
|
||||
_ShimWriteCallback pWrite, _ShimReadCallback pRead,
|
||||
_ShimProgressCallback pProgress, _ShimDebugCallback pDebug,
|
||||
_ShimHeaderCallback pHeader, _ShimSslCtxCallback pCtx,
|
||||
_ShimIoctlCallback pIoctl);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_cleanup_delegates(IntPtr pThis);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_get_file_time(int unixTime,
|
||||
ref int yy, ref int mm, ref int dd, ref int hh, ref int mn, ref int ss);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_free_slist(IntPtr p);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_shim_alloc_fd_sets();
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_free_fd_sets(IntPtr fdsets);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern CurlMultiCode curl_shim_multi_fdset(IntPtr multi,
|
||||
IntPtr fdsets, ref int maxFD);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern int curl_shim_select(int maxFD, IntPtr fdsets,
|
||||
int milliseconds);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_shim_multi_info_read(IntPtr multi,
|
||||
ref int nMsgs);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_multi_info_free(IntPtr multiInfo);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern int curl_shim_formadd(IntPtr[] ppForms, IntPtr[] pParams, int nParams);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern int curl_shim_install_share_delegates(IntPtr pShare,
|
||||
IntPtr pThis, _ShimLockCallback pLock, _ShimUnlockCallback pUnlock);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void curl_shim_cleanup_share_delegates(IntPtr pShare);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern int curl_shim_get_version_int_value(IntPtr p, int offset);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_shim_get_version_char_ptr(IntPtr p, int offset);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern int curl_shim_get_number_of_protocols(IntPtr p, int offset);
|
||||
|
||||
[DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern IntPtr curl_shim_get_protocol_string(IntPtr p, int offset, int index);
|
||||
|
||||
internal delegate void _ShimLockCallback(int data, int access, IntPtr userPtr);
|
||||
|
||||
internal delegate void _ShimUnlockCallback(int data, IntPtr userPtr);
|
||||
|
||||
internal delegate int _ShimDebugCallback(CurlInfoType infoType, IntPtr msgBuf, int msgBufSize, IntPtr parm);
|
||||
|
||||
internal delegate int _ShimHeaderCallback(IntPtr buf, int sz, int nmemb, IntPtr stream);
|
||||
|
||||
internal delegate CurlIoError _ShimIoctlCallback(CurlIoCommand cmd, IntPtr parm);
|
||||
|
||||
internal delegate int _ShimProgressCallback(IntPtr parm, double dlTotal, double dlNow, double ulTotal, double ulNow);
|
||||
|
||||
internal delegate int _ShimReadCallback(IntPtr buf, int sz, int nmemb, IntPtr parm);
|
||||
|
||||
internal delegate int _ShimSslCtxCallback(IntPtr ctx, IntPtr parm);
|
||||
|
||||
internal delegate int _ShimWriteCallback(IntPtr buf, int sz, int nmemb, IntPtr parm);
|
||||
#endif
|
||||
}
|
||||
}
|
22
src/CurlSharp/Properties/AssemblyInfo.cs
Normal file
22
src/CurlSharp/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
[assembly: AssemblyTitle ("CurlSharp")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("max")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
[assembly: AssemblyVersion ("1.0.*")]
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
13
src/CurlSharp/SSLFix.cs
Normal file
13
src/CurlSharp/SSLFix.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CurlSharp
|
||||
{
|
||||
public class SSLFix
|
||||
{
|
||||
public const string CipherList = "rsa_aes_128_sha,ecdhe_rsa_aes_256_sha,ecdhe_ecdsa_aes_128_sha";
|
||||
}
|
||||
}
|
38
src/Jackett.Console/App.config
Normal file
38
src/Jackett.Console/App.config
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
60
src/Jackett.Console/ConsoleOptions.cs
Normal file
60
src/Jackett.Console/ConsoleOptions.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using CommandLine;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett.Console
|
||||
{
|
||||
public class ConsoleOptions
|
||||
{
|
||||
[Option('i', "Install", HelpText = "Install Jackett windows service (Must be admin)")]
|
||||
public bool Install { get; set; }
|
||||
|
||||
[Option('r', "ReserveUrls", HelpText = "(Re)Register windows port reservations (Required for listening on all interfaces).")]
|
||||
public bool ReserveUrls { get; set; }
|
||||
|
||||
[Option('u', "Uninstall", HelpText = "Uninstall Jackett windows service (Must be admin).")]
|
||||
public bool Uninstall { get; set; }
|
||||
|
||||
[Option('l', "Logging", HelpText = "Log all requests/responses to Jackett")]
|
||||
public bool Logging { get; set; }
|
||||
|
||||
[Option('t', "Tracing", HelpText = "Enable tracing")]
|
||||
public bool Tracing { get; set; }
|
||||
|
||||
[Option('c', "UseClient", HelpText = "Override web client selection. [automatic(Default)/libcurl/safecurl/httpclient]")]
|
||||
public string Client { get; set; }
|
||||
|
||||
[Option('s', "Start", HelpText = "Start the Jacket Windows service (Must be admin)")]
|
||||
public bool StartService { get; set; }
|
||||
|
||||
[Option('k', "Stop", HelpText = "Stop the Jacket Windows service (Must be admin)")]
|
||||
public bool StopService { get; set; }
|
||||
|
||||
[Option('x', "ListenPublic", HelpText = "Listen publicly")]
|
||||
public bool ListenPublic { get; set; }
|
||||
|
||||
[Option('z', "ListenPrivate", HelpText = "Only allow local access")]
|
||||
public bool ListenPrivate { get; set; }
|
||||
|
||||
[Option('h', "Help", HelpText = "Show Help")]
|
||||
public bool ShowHelp { get; set; }
|
||||
|
||||
[Option('v', "Version", HelpText = "Show Version")]
|
||||
public bool ShowVersion { get; set; }
|
||||
|
||||
[Option('p', "Port", HelpText = "Web server port")]
|
||||
public int Port { get; set; }
|
||||
|
||||
[Option('m', "MigrateSettings", HelpText = "Migrate settings manually (Must be admin on Windows)")]
|
||||
public bool MigrateSettings { get; set; }
|
||||
|
||||
[Option('f', "SSLFix", HelpText = "[true/false] Linux Libcurl NSS Missing ECC Ciphers workaround (Use if you can't access some trackers) .")]
|
||||
public bool? SSLFix { get; set; }
|
||||
|
||||
[ParserState]
|
||||
public IParserState LastParserState { get; set; }
|
||||
}
|
||||
}
|
180
src/Jackett.Console/Jackett.Console.csproj
Normal file
180
src/Jackett.Console/Jackett.Console.csproj
Normal file
@@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jackett.Console</RootNamespace>
|
||||
<AssemblyName>JackettConsole</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>jackett.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>JackettConsole.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi.Owin, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.Owin.3.3.0\lib\net45\Autofac.Integration.WebApi.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="AutoMapper, Version=4.1.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.4.1.1\lib\net45\AutoMapper.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.FileSystems, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.StaticFiles, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.StaticFiles.3.0.1\lib\net45\Microsoft.Owin.StaticFiles.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.2.0\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Tracing, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Tracing.5.2.3\lib\net45\System.Web.Http.Tracing.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ConsoleOptions.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CurlSharp\CurlSharp.csproj">
|
||||
<Project>{74420a79-cc16-442c-8b1e-7c1b913844f0}</Project>
|
||||
<Name>CurlSharp</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
||||
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
||||
<Name>Jackett</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="jackett.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
212
src/Jackett.Console/Program.cs
Normal file
212
src/Jackett.Console/Program.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using CommandLine;
|
||||
using CommandLine.Text;
|
||||
using Jackett;
|
||||
using Jackett.Console;
|
||||
using Jackett.Indexers;
|
||||
using Jackett.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JackettConsole
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
var options = new ConsoleOptions();
|
||||
if (!Parser.Default.ParseArguments(args, options) || options.ShowHelp == true)
|
||||
{
|
||||
if (options.LastParserState != null && options.LastParserState.Errors.Count > 0)
|
||||
{
|
||||
var help = new HelpText();
|
||||
var errors = help.RenderParsingErrorsText(options, 2); // indent with two spaces
|
||||
Console.WriteLine("Jackett v" + Engine.ConfigService.GetVersion());
|
||||
Console.WriteLine("Switch error: " + errors);
|
||||
Console.WriteLine("See --help for further details on switches.");
|
||||
Environment.ExitCode = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var text = HelpText.AutoBuild(options, (HelpText current) => HelpText.DefaultParsingErrorsHandler(options, current));
|
||||
text.Copyright = " ";
|
||||
text.Heading = "Jackett v" + Engine.ConfigService.GetVersion() + " options:";
|
||||
Console.WriteLine(text);
|
||||
Environment.ExitCode = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (options.ListenPublic && options.ListenPrivate)
|
||||
{
|
||||
Console.WriteLine("You can only use listen private OR listen publicly.");
|
||||
Environment.ExitCode = 1;
|
||||
return;
|
||||
}
|
||||
/* ====== Options ===== */
|
||||
|
||||
// SSL Fix
|
||||
Startup.DoSSLFix = options.SSLFix;
|
||||
|
||||
// Use curl
|
||||
if (options.Client != null)
|
||||
Startup.ClientOverride = options.Client.ToLowerInvariant();
|
||||
|
||||
// Logging
|
||||
if (options.Logging)
|
||||
Startup.LogRequests = true;
|
||||
|
||||
// Tracing
|
||||
if (options.Tracing)
|
||||
Startup.TracingEnabled = true;
|
||||
|
||||
// Log after the fact as using the logger will cause the options above to be used
|
||||
|
||||
if (options.Logging)
|
||||
Engine.Logger.Info("Logging enabled.");
|
||||
|
||||
if (options.Tracing)
|
||||
Engine.Logger.Info("Tracing enabled.");
|
||||
|
||||
if (options.SSLFix == true)
|
||||
Engine.Logger.Info("SSL ECC workaround enabled.");
|
||||
else if (options.SSLFix == false)
|
||||
Engine.Logger.Info("SSL ECC workaround has been disabled.");
|
||||
/* ====== Actions ===== */
|
||||
|
||||
// Install service
|
||||
if (options.Install)
|
||||
{
|
||||
Engine.ServiceConfig.Install();
|
||||
return;
|
||||
}
|
||||
|
||||
// Uninstall service
|
||||
if (options.Uninstall)
|
||||
{
|
||||
Engine.Server.ReserveUrls(doInstall: false);
|
||||
Engine.ServiceConfig.Uninstall();
|
||||
return;
|
||||
}
|
||||
|
||||
// Reserve urls
|
||||
if (options.ReserveUrls)
|
||||
{
|
||||
Engine.Server.ReserveUrls(doInstall: true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Start Service
|
||||
if (options.StartService)
|
||||
{
|
||||
if (!Engine.ServiceConfig.ServiceRunning())
|
||||
{
|
||||
Engine.ServiceConfig.Start();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop Service
|
||||
if (options.StopService)
|
||||
{
|
||||
if (Engine.ServiceConfig.ServiceRunning())
|
||||
{
|
||||
Engine.ServiceConfig.Stop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Migrate settings
|
||||
if (options.MigrateSettings)
|
||||
{
|
||||
Engine.ConfigService.PerformMigration();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Show Version
|
||||
if (options.ShowVersion)
|
||||
{
|
||||
Console.WriteLine("Jackett v" + Engine.ConfigService.GetVersion());
|
||||
return;
|
||||
}
|
||||
|
||||
/* ====== Overrides ===== */
|
||||
|
||||
// Override listen public
|
||||
if (options.ListenPublic || options.ListenPrivate)
|
||||
{
|
||||
if (Engine.Server.Config.AllowExternal != options.ListenPublic)
|
||||
{
|
||||
Engine.Logger.Info("Overriding external access to " + options.ListenPublic);
|
||||
Engine.Server.Config.AllowExternal = options.ListenPublic;
|
||||
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
{
|
||||
if (ServerUtil.IsUserAdministrator())
|
||||
{
|
||||
Engine.Server.ReserveUrls(doInstall: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Engine.Logger.Error("Unable to switch to public listening without admin rights.");
|
||||
Environment.ExitCode = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Engine.Server.SaveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
// Override port
|
||||
if (options.Port != 0)
|
||||
{
|
||||
if (Engine.Server.Config.Port != options.Port)
|
||||
{
|
||||
Engine.Logger.Info("Overriding port to " + options.Port);
|
||||
Engine.Server.Config.Port = options.Port;
|
||||
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
{
|
||||
if (ServerUtil.IsUserAdministrator())
|
||||
{
|
||||
Engine.Server.ReserveUrls(doInstall: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Engine.Logger.Error("Unable to switch ports when not running as administrator");
|
||||
Environment.ExitCode = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Engine.Server.SaveConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Engine.Server.Initalize();
|
||||
Engine.Server.Start();
|
||||
Engine.RunTime.Spin();
|
||||
Engine.Logger.Info("Server thread exit");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Engine.Logger.Error(e, "Top level exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
36
src/Jackett.Console/Properties/AssemblyInfo.cs
Normal file
36
src/Jackett.Console/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Jackett.Console")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Jackett.Console")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4e2a81da-e235-4a88-ad20-38aabbfbf33c")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
27
src/Jackett.Console/packages.config
Normal file
27
src/Jackett.Console/packages.config
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net45" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.3.0" targetFramework="net45" />
|
||||
<package id="AutoMapper" version="4.1.1" targetFramework="net45" />
|
||||
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Tracing" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
<package id="NLog" version="4.2.0" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
</packages>
|
6
src/Jackett.Distribution/App.config
Normal file
6
src/Jackett.Distribution/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
||||
</startup>
|
||||
</configuration>
|
67
src/Jackett.Distribution/Jackett.Distribution.csproj
Normal file
67
src/Jackett.Distribution/Jackett.Distribution.csproj
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jackett.Distribution</RootNamespace>
|
||||
<AssemblyName>JackettDistribution</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Octokit, Version=0.16.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Octokit.0.16.0\lib\net45\Octokit.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
127
src/Jackett.Distribution/Program.cs
Normal file
127
src/Jackett.Distribution/Program.cs
Normal file
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO.Compression;
|
||||
using Octokit;
|
||||
using Octokit.Internal;
|
||||
|
||||
namespace Jackett.Distribution
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static readonly string repoOwner = "zone117x";
|
||||
static readonly string repoName = "Jackett";
|
||||
static readonly string jackettLibPath = Path.Combine("build.windows", "Jackett.dll");
|
||||
static readonly string buildZipFileWindows = "JackettBuildWindows.zip";
|
||||
static readonly string buildZipFileMono = "JackettBuildMono.zip";
|
||||
static readonly string installFile = Path.Combine("Output", "setup.exe");
|
||||
|
||||
static GitHubClient github;
|
||||
static Version localVersion;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
throw new Exception("Missing github API token argument");
|
||||
}
|
||||
var token = args[0];
|
||||
github = new GitHubClient(new ProductHeaderValue("Jackett"));
|
||||
github.Credentials = new Credentials(token);
|
||||
|
||||
localVersion = GetJackettVersion();
|
||||
/*var latestReleaseVersion = LatestGithubRelease().Result;
|
||||
if (localVersion <= latestReleaseVersion)
|
||||
{
|
||||
Console.WriteLine("Latest Github release is {0}, will not upload local version {1}", latestReleaseVersion, localVersion);
|
||||
return;
|
||||
}*/
|
||||
|
||||
Console.WriteLine("Zipping release build for Windows " + localVersion);
|
||||
ZippingReleaseBuildWindows();
|
||||
|
||||
Console.WriteLine("Zipping release build for Mono " + localVersion);
|
||||
ZippingReleaseBuildMono();
|
||||
|
||||
UploadRelease().Wait();
|
||||
}
|
||||
|
||||
static Version GetJackettVersion()
|
||||
{
|
||||
var assemblyVersion = AssemblyName.GetAssemblyName(jackettLibPath).Version;
|
||||
return new Version(assemblyVersion.Major, assemblyVersion.Minor, assemblyVersion.Build);
|
||||
}
|
||||
|
||||
static async Task<Version> LatestGithubRelease()
|
||||
{
|
||||
var releases = await github.Release.GetAll(repoOwner, repoName);
|
||||
var latest = releases.Where(t => t.PublishedAt != null).OrderByDescending(t => t.TagName).FirstOrDefault();
|
||||
var version = Version.Parse(latest.TagName.Replace("v", ""));
|
||||
return version;
|
||||
}
|
||||
|
||||
static void ZippingReleaseBuildWindows()
|
||||
{
|
||||
if (File.Exists(buildZipFileWindows))
|
||||
File.Delete(buildZipFileWindows);
|
||||
ZipFile.CreateFromDirectory("build.windows", buildZipFileWindows);
|
||||
}
|
||||
|
||||
static void ZippingReleaseBuildMono()
|
||||
{
|
||||
if (File.Exists(buildZipFileMono))
|
||||
File.Delete(buildZipFileMono);
|
||||
ZipFile.CreateFromDirectory("build.mono", buildZipFileMono);
|
||||
}
|
||||
|
||||
static async Task UploadRelease()
|
||||
{
|
||||
// get last master commit to tag
|
||||
/*var masterBranch = await github.Repository.GetBranch(repoOwner, repoName, "master");
|
||||
var lastCommit = masterBranch.Commit.Sha;
|
||||
|
||||
// create tag
|
||||
var tagName = "v" + localVersion.ToString();
|
||||
var tag = new NewTag
|
||||
{
|
||||
Message = "Tagging a new release of Jackett",
|
||||
Tag = tagName,
|
||||
Object = lastCommit,
|
||||
Type = TaggedType.Commit,
|
||||
Tagger = new SignatureResponse("DistributionBot", "zone117x@gmail.com", DateTime.UtcNow)
|
||||
};
|
||||
var tagResult = await github.GitDatabase.Tag.Create(repoOwner, repoName, tag);*/
|
||||
|
||||
// create release entry
|
||||
var newRelease = new NewRelease("v" + localVersion.ToString());
|
||||
newRelease.Name = "Beta Release";
|
||||
newRelease.Body = "";
|
||||
newRelease.Draft = true;
|
||||
newRelease.Prerelease = false;
|
||||
|
||||
var releaseResult = await github.Release.Create(repoOwner, repoName, newRelease);
|
||||
|
||||
Console.WriteLine("Uploading Windows build");
|
||||
await UploadFileToGithub(releaseResult, buildZipFileWindows, string.Format("Jackett.Windows.v{0}.zip", localVersion), "application/zip");
|
||||
Console.WriteLine("Uploading Mono build");
|
||||
await UploadFileToGithub(releaseResult, buildZipFileMono, string.Format("Jackett.Mono.v{0}.zip", localVersion), "application/zip");
|
||||
Console.WriteLine("Uploading Windows installer");
|
||||
await UploadFileToGithub(releaseResult, installFile, string.Format("Jackett.v{0}.Windows.Installer.exe", localVersion), "application/octet-stream");
|
||||
}
|
||||
|
||||
static Task UploadFileToGithub(Release githubRelease, string filePath, string filePublishName, string contentType)
|
||||
{
|
||||
var buildZipAssetWindows = new ReleaseAssetUpload()
|
||||
{
|
||||
FileName = filePublishName,
|
||||
ContentType = contentType,
|
||||
RawData = File.OpenRead(filePath)
|
||||
};
|
||||
return github.Release.UploadAsset(githubRelease, buildZipAssetWindows);
|
||||
}
|
||||
}
|
||||
}
|
36
src/Jackett.Distribution/Properties/AssemblyInfo.cs
Normal file
36
src/Jackett.Distribution/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("JackettDistribution")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("JackettDistribution")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("99d893ec-1a8a-42a9-ac6b-fe047afc32f0")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
4
src/Jackett.Distribution/packages.config
Normal file
4
src/Jackett.Distribution/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Octokit" version="0.16.0" targetFramework="net45" />
|
||||
</packages>
|
30
src/Jackett.Service/App.config
Normal file
30
src/Jackett.Service/App.config
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
167
src/Jackett.Service/Jackett.Service.csproj
Normal file
167
src/Jackett.Service/Jackett.Service.csproj
Normal file
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jackett.Service</RootNamespace>
|
||||
<AssemblyName>JackettService</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>jackett.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi.Owin, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.Owin.3.3.0\lib\net45\Autofac.Integration.WebApi.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.FileSystems, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.StaticFiles, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.StaticFiles.3.0.1\lib\net45\Microsoft.Owin.StaticFiles.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.2.0\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Tracing, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Tracing.5.2.3\lib\net45\System.Web.Http.Tracing.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Service.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Service.Designer.cs">
|
||||
<DependentUpon>Service.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="jackett.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CurlSharp\CurlSharp.csproj">
|
||||
<Project>{74420a79-cc16-442c-8b1e-7c1b913844f0}</Project>
|
||||
<Name>CurlSharp</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
||||
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
||||
<Name>Jackett</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
25
src/Jackett.Service/Program.cs
Normal file
25
src/Jackett.Service/Program.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.ServiceProcess;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett.Service
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
static void Main()
|
||||
{
|
||||
ServiceBase[] ServicesToRun;
|
||||
ServicesToRun = new ServiceBase[]
|
||||
{
|
||||
new Service()
|
||||
};
|
||||
ServiceBase.Run(ServicesToRun);
|
||||
}
|
||||
}
|
||||
}
|
36
src/Jackett.Service/Properties/AssemblyInfo.cs
Normal file
36
src/Jackett.Service/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Jackett.Service")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Jackett.Service")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("bf611f7b-4658-4cb8-aa9e-0736fadaa3ba")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
37
src/Jackett.Service/Service.Designer.cs
generated
Normal file
37
src/Jackett.Service/Service.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace Jackett.Service
|
||||
{
|
||||
partial class Service
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.ServiceName = "Jackett";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
34
src/Jackett.Service/Service.cs
Normal file
34
src/Jackett.Service/Service.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.ServiceProcess;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett.Service
|
||||
{
|
||||
public partial class Service : ServiceBase
|
||||
{
|
||||
public Service()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnStart(string[] args)
|
||||
{
|
||||
Engine.Logger.Info("Service starting");
|
||||
Engine.Server.Initalize();
|
||||
Engine.Server.Start();
|
||||
Engine.Logger.Info("Service started");
|
||||
}
|
||||
|
||||
protected override void OnStop()
|
||||
{
|
||||
Engine.Logger.Info("Service stopping");
|
||||
Engine.Server.Stop();
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
23
src/Jackett.Service/packages.config
Normal file
23
src/Jackett.Service/packages.config
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net45" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.3.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Tracing" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
<package id="NLog" version="4.2.0" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
</packages>
|
218
src/Jackett.Test/Jackett.Test.csproj
Normal file
218
src/Jackett.Test/Jackett.Test.csproj
Normal file
@@ -0,0 +1,218 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>JackettTest</RootNamespace>
|
||||
<AssemblyName>JackettTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi.Owin, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.Owin.3.3.0\lib\net45\Autofac.Integration.WebApi.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="AutoMapper, Version=4.1.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.4.1.1\lib\net45\AutoMapper.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CsQuery, Version=1.3.3.249, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="FluentAssertions, Version=4.0.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FluentAssertions.4.0.1\lib\net45\FluentAssertions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="FluentAssertions.Core, Version=4.0.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FluentAssertions.4.0.1\lib\net45\FluentAssertions.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.2.0\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.core, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.core.interfaces, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.util, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.VisualStudio.TestAdapter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\ProtectionServiceTests.cs" />
|
||||
<Compile Include="TestBase.cs" />
|
||||
<Compile Include="TestIIndexerManagerServiceHelper.cs" />
|
||||
<Compile Include="TestUtil.cs" />
|
||||
<Compile Include="TestWebClient.cs" />
|
||||
<Compile Include="Util\ServerUtilTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
||||
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
||||
<Name>Jackett</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Indexers\" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
src/Jackett.Test/Properties/AssemblyInfo.cs
Normal file
36
src/Jackett.Test/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Jackett.Test")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Jackett.Test")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e75d4f15-5da3-4332-adb1-28fb673dae56")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
30
src/Jackett.Test/Services/ProtectionServiceTests.cs
Normal file
30
src/Jackett.Test/Services/ProtectionServiceTests.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Jackett.Services;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Autofac;
|
||||
|
||||
namespace JackettTest.Services
|
||||
{
|
||||
[TestFixture]
|
||||
class ProtectionServiceTests : TestBase
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Should_be_able_to_encrypt_and_decrypt()
|
||||
{
|
||||
var ss = TestUtil.Container.Resolve<IServerService>();
|
||||
ss.Config.InstanceId = "12345678";
|
||||
var ps = TestUtil.Container.Resolve<IProtectionService>();
|
||||
var input = "test123";
|
||||
var protectedInput = ps.Protect(input);
|
||||
var output = ps.UnProtect(protectedInput);
|
||||
|
||||
Assert.AreEqual(output, input);
|
||||
Assert.AreNotEqual(input, protectedInput);
|
||||
}
|
||||
}
|
||||
}
|
18
src/Jackett.Test/TestBase.cs
Normal file
18
src/Jackett.Test/TestBase.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JackettTest
|
||||
{
|
||||
abstract class TestBase
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
TestUtil.SetupContainer();
|
||||
}
|
||||
}
|
||||
}
|
46
src/Jackett.Test/TestIIndexerManagerServiceHelper.cs
Normal file
46
src/Jackett.Test/TestIIndexerManagerServiceHelper.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Jackett.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Jackett.Indexers;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace JackettTest
|
||||
{
|
||||
class TestIndexerManagerServiceHelper : IIndexerManagerService
|
||||
{
|
||||
public JToken LastSavedConfig { get; set; }
|
||||
|
||||
public void DeleteIndexer(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<IIndexer> GetAllIndexers()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IIndexer GetIndexer(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void InitIndexers()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveConfig(IIndexer indexer, JToken obj)
|
||||
{
|
||||
LastSavedConfig = obj;
|
||||
}
|
||||
|
||||
public Task TestIndexer(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
74
src/Jackett.Test/TestUtil.cs
Normal file
74
src/Jackett.Test/TestUtil.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using Autofac;
|
||||
using Jackett;
|
||||
using Jackett.Services;
|
||||
using Jackett.Utils.Clients;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JackettTest
|
||||
{
|
||||
class TestUtil
|
||||
{
|
||||
private static IContainer testContainer = null;
|
||||
|
||||
public static void SetupContainer()
|
||||
{
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterModule<JackettModule>();
|
||||
builder.RegisterType<TestWebClient>().As<IWebClient>().SingleInstance();
|
||||
builder.RegisterInstance<Logger>(LogManager.GetCurrentClassLogger()).SingleInstance();
|
||||
builder.RegisterType<TestIndexerManagerServiceHelper>().As<IIndexerManagerService>().SingleInstance();
|
||||
testContainer = builder.Build();
|
||||
|
||||
// Register the container in itself to allow for late resolves
|
||||
var secondaryBuilder = new ContainerBuilder();
|
||||
secondaryBuilder.RegisterInstance<IContainer>(testContainer).SingleInstance();
|
||||
secondaryBuilder.Update(testContainer);
|
||||
}
|
||||
|
||||
public static TestIndexerManagerServiceHelper IndexManager
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContainer.Resolve<IIndexerManagerService>() as TestIndexerManagerServiceHelper;
|
||||
}
|
||||
}
|
||||
|
||||
public static IContainer Container
|
||||
{
|
||||
get { return testContainer; }
|
||||
}
|
||||
|
||||
public static void RegisterByteCall(WebRequest r, Func<WebRequest, WebClientByteResult> f)
|
||||
{
|
||||
var client = testContainer.Resolve<IWebClient>() as TestWebClient;
|
||||
client.RegisterByteCall(r, f);
|
||||
}
|
||||
|
||||
public static void RegisterStringCall(WebRequest r, Func<WebRequest, WebClientStringResult> f)
|
||||
{
|
||||
var client = testContainer.Resolve<IWebClient>() as TestWebClient;
|
||||
client.RegisterStringCall(r, f);
|
||||
}
|
||||
|
||||
public static string GetResource(string item)
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var resourceName = "JackettTest." + item.Replace('/','.');
|
||||
|
||||
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
40
src/Jackett.Test/TestWebClient.cs
Normal file
40
src/Jackett.Test/TestWebClient.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Jackett.Utils.Clients;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JackettTest
|
||||
{
|
||||
public class TestWebClient : IWebClient
|
||||
{
|
||||
private Dictionary<WebRequest, Func<WebRequest, WebClientByteResult>> byteCallbacks = new Dictionary<WebRequest, Func<WebRequest, WebClientByteResult>>();
|
||||
private Dictionary<WebRequest, Func<WebRequest, WebClientStringResult>> stringCallbacks = new Dictionary<WebRequest, Func<WebRequest, WebClientStringResult>>();
|
||||
|
||||
public void RegisterByteCall(WebRequest req, Func<WebRequest, WebClientByteResult> f)
|
||||
{
|
||||
byteCallbacks.Add(req, f);
|
||||
}
|
||||
|
||||
public void RegisterStringCall(WebRequest req, Func<WebRequest, WebClientStringResult> f)
|
||||
{
|
||||
stringCallbacks.Add(req, f);
|
||||
}
|
||||
|
||||
public Task<WebClientByteResult> GetBytes(WebRequest request)
|
||||
{
|
||||
return Task.FromResult< WebClientByteResult>(byteCallbacks.Where(r => r.Key.Equals(request)).First().Value.Invoke(request));
|
||||
}
|
||||
|
||||
public Task<WebClientStringResult> GetString(WebRequest request)
|
||||
{
|
||||
return Task.FromResult<WebClientStringResult>(stringCallbacks.Where(r => r.Key.Equals(request)).First().Value.Invoke(request));
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
50
src/Jackett.Test/Util/ServerUtilTests.cs
Normal file
50
src/Jackett.Test/Util/ServerUtilTests.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Jackett.Utils.Clients;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Autofac;
|
||||
using Jackett.Indexers;
|
||||
using FluentAssertions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Jackett;
|
||||
using Newtonsoft.Json;
|
||||
using Jackett.Utils;
|
||||
|
||||
namespace JackettTest.Indexers
|
||||
{
|
||||
[TestFixture]
|
||||
class ServerUtilTests : TestBase
|
||||
{
|
||||
[Test]
|
||||
public void ResureRedirectIsFullyQualified_makes_redicts_fully_qualified()
|
||||
{
|
||||
var res = new WebClientByteResult()
|
||||
{
|
||||
RedirectingTo = "list?p=1"
|
||||
};
|
||||
|
||||
var req = new WebRequest()
|
||||
{
|
||||
Url = "http://my.domain.com/page.php"
|
||||
};
|
||||
|
||||
// Not fully qualified requiring redirect
|
||||
ServerUtil.ResureRedirectIsFullyQualified(req, res);
|
||||
Assert.AreEqual(res.RedirectingTo, "http://my.domain.com/list?p=1");
|
||||
|
||||
// Fully qualified not needing modified
|
||||
res.RedirectingTo = "http://a.domain/page.htm";
|
||||
ServerUtil.ResureRedirectIsFullyQualified(req, res);
|
||||
Assert.AreEqual(res.RedirectingTo, "http://a.domain/page.htm");
|
||||
|
||||
// Relative requiring redirect
|
||||
req.Url = "http://my.domain.com/dir/page.php";
|
||||
res.RedirectingTo = "a/dir/page.html";
|
||||
ServerUtil.ResureRedirectIsFullyQualified(req, res);
|
||||
Assert.AreEqual(res.RedirectingTo, "http://my.domain.com/dir/a/dir/page.html");
|
||||
}
|
||||
}
|
||||
}
|
31
src/Jackett.Test/app.config
Normal file
31
src/Jackett.Test/app.config
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>
|
26
src/Jackett.Test/packages.config
Normal file
26
src/Jackett.Test/packages.config
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net45" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.3.0" targetFramework="net45" />
|
||||
<package id="AutoMapper" version="4.1.1" targetFramework="net45" />
|
||||
<package id="CsQuery" version="1.3.4" targetFramework="net45" />
|
||||
<package id="FluentAssertions" version="4.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
<package id="NLog" version="4.2.0" targetFramework="net45" />
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
||||
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
</packages>
|
34
src/Jackett.Tray/App.config
Normal file
34
src/Jackett.Tray/App.config
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
204
src/Jackett.Tray/Jackett.Tray.csproj
Normal file
204
src/Jackett.Tray/Jackett.Tray.csproj
Normal file
@@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jackett.Tray</RootNamespace>
|
||||
<AssemblyName>JackettTray</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>jackett.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi.Owin, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.Owin.3.3.0\lib\net45\Autofac.Integration.WebApi.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="AutoMapper, Version=4.1.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.4.1.1\lib\net45\AutoMapper.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.FileSystems, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.StaticFiles, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.StaticFiles.3.0.1\lib\net45\Microsoft.Owin.StaticFiles.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.2.0\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Tracing, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Tracing.5.2.3\lib\net45\System.Web.Http.Tracing.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Main.Designer.cs">
|
||||
<DependentUpon>Main.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Main.resx">
|
||||
<DependentUpon>Main.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="jackett.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
||||
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
||||
<Name>Jackett</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="IWshRuntimeLibrary">
|
||||
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
@@ -1,4 +1,4 @@
|
||||
namespace Jackett
|
||||
namespace JackettTray
|
||||
{
|
||||
partial class Main
|
||||
{
|
||||
@@ -32,8 +32,12 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
|
||||
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.toolStripMenuItemAutoStart = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemWebUI = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.backgroundMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.serviceControlMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItemAutoStart = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemShutdown = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -48,29 +52,59 @@
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItemAutoStart,
|
||||
this.toolStripMenuItemWebUI,
|
||||
this.toolStripSeparator1,
|
||||
this.backgroundMenuItem,
|
||||
this.serviceControlMenuItem,
|
||||
this.toolStripSeparator2,
|
||||
this.toolStripMenuItemAutoStart,
|
||||
this.toolStripMenuItemShutdown});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(174, 92);
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(292, 148);
|
||||
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||
//
|
||||
// toolStripMenuItemWebUI
|
||||
//
|
||||
this.toolStripMenuItemWebUI.Name = "toolStripMenuItemWebUI";
|
||||
this.toolStripMenuItemWebUI.Size = new System.Drawing.Size(291, 22);
|
||||
this.toolStripMenuItemWebUI.Text = "Open Web UI";
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(288, 6);
|
||||
//
|
||||
// backgroundMenuItem
|
||||
//
|
||||
this.backgroundMenuItem.Enabled = false;
|
||||
this.backgroundMenuItem.Name = "backgroundMenuItem";
|
||||
this.backgroundMenuItem.Size = new System.Drawing.Size(291, 22);
|
||||
this.backgroundMenuItem.Text = "Jacket is running as a background service";
|
||||
//
|
||||
// serviceControlMenuItem
|
||||
//
|
||||
this.serviceControlMenuItem.Name = "serviceControlMenuItem";
|
||||
this.serviceControlMenuItem.Size = new System.Drawing.Size(291, 22);
|
||||
this.serviceControlMenuItem.Text = "Start Service";
|
||||
this.serviceControlMenuItem.Click += new System.EventHandler(this.serviceControlMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(288, 6);
|
||||
//
|
||||
// toolStripMenuItemAutoStart
|
||||
//
|
||||
this.toolStripMenuItemAutoStart.CheckOnClick = true;
|
||||
this.toolStripMenuItemAutoStart.Name = "toolStripMenuItemAutoStart";
|
||||
this.toolStripMenuItemAutoStart.Size = new System.Drawing.Size(173, 22);
|
||||
this.toolStripMenuItemAutoStart.Size = new System.Drawing.Size(291, 22);
|
||||
this.toolStripMenuItemAutoStart.Text = "Auto-start on boot";
|
||||
//
|
||||
// toolStripMenuItemWebUI
|
||||
//
|
||||
this.toolStripMenuItemWebUI.Name = "toolStripMenuItemWebUI";
|
||||
this.toolStripMenuItemWebUI.Size = new System.Drawing.Size(173, 22);
|
||||
this.toolStripMenuItemWebUI.Text = "Open Web UI";
|
||||
this.toolStripMenuItemAutoStart.Visible = false;
|
||||
//
|
||||
// toolStripMenuItemShutdown
|
||||
//
|
||||
this.toolStripMenuItemShutdown.Name = "toolStripMenuItemShutdown";
|
||||
this.toolStripMenuItemShutdown.Size = new System.Drawing.Size(173, 22);
|
||||
this.toolStripMenuItemShutdown.Size = new System.Drawing.Size(291, 22);
|
||||
this.toolStripMenuItemShutdown.Text = "Shutdown";
|
||||
//
|
||||
// Main
|
||||
@@ -95,6 +129,9 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemAutoStart;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemWebUI;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemShutdown;
|
||||
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem backgroundMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem serviceControlMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||
}
|
||||
}
|
188
src/Jackett.Tray/Main.cs
Normal file
188
src/Jackett.Tray/Main.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
using Jackett;
|
||||
using Jackett.Utils;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JackettTray
|
||||
{
|
||||
public partial class Main : Form
|
||||
{
|
||||
public Main()
|
||||
{
|
||||
Hide();
|
||||
InitializeComponent();
|
||||
|
||||
toolStripMenuItemAutoStart.Checked = AutoStart;
|
||||
toolStripMenuItemAutoStart.CheckedChanged += toolStripMenuItemAutoStart_CheckedChanged;
|
||||
|
||||
toolStripMenuItemWebUI.Click += toolStripMenuItemWebUI_Click;
|
||||
toolStripMenuItemShutdown.Click += toolStripMenuItemShutdown_Click;
|
||||
#if __MonoCS__
|
||||
// No shortcuts on linux
|
||||
#else
|
||||
toolStripMenuItemAutoStart.Visible = true;
|
||||
#endif
|
||||
|
||||
Engine.Server.Initalize();
|
||||
|
||||
if (!Engine.ServiceConfig.ServiceExists())
|
||||
{
|
||||
// We are not installed as a service so just the web server too and run from the tray.
|
||||
Engine.Logger.Info("Starting server from tray");
|
||||
Engine.Server.Start();
|
||||
}
|
||||
|
||||
Task.Factory.StartNew(WaitForEvent);
|
||||
}
|
||||
|
||||
private void WaitForEvent()
|
||||
{
|
||||
Engine.LockService.WaitForSignal();
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
void toolStripMenuItemWebUI_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("http://127.0.0.1:" + Engine.Server.Config.Port);
|
||||
}
|
||||
|
||||
void toolStripMenuItemShutdown_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.GetCurrentProcess().Kill();
|
||||
}
|
||||
|
||||
void toolStripMenuItemAutoStart_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
AutoStart = toolStripMenuItemAutoStart.Checked;
|
||||
}
|
||||
|
||||
string ProgramTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return Assembly.GetExecutingAssembly().GetName().Name;
|
||||
}
|
||||
}
|
||||
|
||||
bool AutoStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return File.Exists(ShortcutPath);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value && !AutoStart)
|
||||
{
|
||||
CreateShortcut();
|
||||
}
|
||||
else if (!value && AutoStart)
|
||||
{
|
||||
File.Delete(ShortcutPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ShortcutPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Jackett.lnk");
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateShortcut()
|
||||
{
|
||||
#if __MonoCS__
|
||||
// No shortcuts on linux
|
||||
#else
|
||||
var appPath = Assembly.GetExecutingAssembly().Location;
|
||||
var shell = new IWshRuntimeLibrary.WshShell();
|
||||
var shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(ShortcutPath);
|
||||
shortcut.Description = Assembly.GetExecutingAssembly().GetName().Name;
|
||||
shortcut.TargetPath = appPath;
|
||||
shortcut.Save();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (Engine.ServiceConfig.ServiceExists())
|
||||
{
|
||||
backgroundMenuItem.Visible = true;
|
||||
serviceControlMenuItem.Visible = true;
|
||||
toolStripSeparator1.Visible = true;
|
||||
toolStripSeparator2.Visible = true;
|
||||
if (Engine.ServiceConfig.ServiceRunning())
|
||||
{
|
||||
serviceControlMenuItem.Text = "Stop background service";
|
||||
} else
|
||||
{
|
||||
serviceControlMenuItem.Text = "Start background service";
|
||||
}
|
||||
|
||||
toolStripMenuItemShutdown.Text = "Close tray icon";
|
||||
} else
|
||||
{
|
||||
backgroundMenuItem.Visible = false;
|
||||
serviceControlMenuItem.Visible = false;
|
||||
toolStripSeparator1.Visible = false;
|
||||
toolStripSeparator2.Visible = false;
|
||||
toolStripMenuItemShutdown.Text = "Shutdown";
|
||||
}
|
||||
}
|
||||
|
||||
private void serviceControlMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var consolePath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "JackettConsole.exe");
|
||||
|
||||
if (Engine.ServiceConfig.ServiceRunning())
|
||||
{
|
||||
if (ServerUtil.IsUserAdministrator())
|
||||
{
|
||||
Engine.ServiceConfig.Stop();
|
||||
|
||||
} else
|
||||
{
|
||||
try
|
||||
{
|
||||
Engine.ProcessService.StartProcessAndLog(consolePath, "--Stop", true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Failed to get admin rights to stop the service.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ServerUtil.IsUserAdministrator())
|
||||
{
|
||||
Engine.ServiceConfig.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Engine.ProcessService.StartProcessAndLog(consolePath, "--Start", true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Failed to get admin rights to start the service.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
src/Jackett.Tray/Program.cs
Normal file
22
src/Jackett.Tray/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JackettTray
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Main());
|
||||
}
|
||||
}
|
||||
}
|
36
src/Jackett.Tray/Properties/AssemblyInfo.cs
Normal file
36
src/Jackett.Tray/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Jackett.Tray")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Jackett.Tray")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("ff9025b1-ec14-4aa9-8081-9f69c5e35b63")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
63
src/Jackett.Tray/Properties/Resources.Designer.cs
generated
Normal file
63
src/Jackett.Tray/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Jackett.Tray.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Jackett.Tray.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
src/Jackett.Tray/Properties/Resources.resx
Normal file
117
src/Jackett.Tray/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
26
src/Jackett.Tray/Properties/Settings.Designer.cs
generated
Normal file
26
src/Jackett.Tray/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Jackett.Tray.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
src/Jackett.Tray/Properties/Settings.settings
Normal file
7
src/Jackett.Tray/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
BIN
src/Jackett.Tray/jackett.ico
Normal file
BIN
src/Jackett.Tray/jackett.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
24
src/Jackett.Tray/packages.config
Normal file
24
src/Jackett.Tray/packages.config
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net45" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net45" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.3.0" targetFramework="net45" />
|
||||
<package id="AutoMapper" version="4.1.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Tracing" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
<package id="NLog" version="4.2.0" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
</packages>
|
30
src/Jackett.Updater/App.config
Normal file
30
src/Jackett.Updater/App.config
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
83
src/Jackett.Updater/Jackett.Updater.csproj
Normal file
83
src/Jackett.Updater/Jackett.Updater.csproj
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A61E311A-6F8B-4497-B5E4-2EA8994C7BD8}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Jackett.Updater</RootNamespace>
|
||||
<AssemblyName>JackettUpdater</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>jackett.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.2.0\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UpdaterConsoleOptions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
||||
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
||||
<Name>Jackett</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="jackett.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
149
src/Jackett.Updater/Program.cs
Normal file
149
src/Jackett.Updater/Program.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using CommandLine;
|
||||
using Jackett.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett.Updater
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
new Program().Run(args);
|
||||
}
|
||||
|
||||
private void Run(string[] args)
|
||||
{
|
||||
Engine.Logger.Info("Jackett Updater v" + GetCurrentVersion());
|
||||
|
||||
try {
|
||||
var options = new UpdaterConsoleOptions();
|
||||
if (Parser.Default.ParseArguments(args, options))
|
||||
{
|
||||
ProcessUpdate(options);
|
||||
}
|
||||
else
|
||||
{
|
||||
Engine.Logger.Error("Failed to process update arguments!: " + string.Join(" ", args));
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Engine.Logger.Error(e, "Exception applying update!");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetCurrentVersion()
|
||||
{
|
||||
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
return fvi.FileVersion;
|
||||
}
|
||||
|
||||
private void ProcessUpdate(UpdaterConsoleOptions options)
|
||||
{
|
||||
var updateLocation = GetUpdateLocation();
|
||||
if(!(updateLocation.EndsWith("\\") || updateLocation.EndsWith("/")))
|
||||
{
|
||||
updateLocation += Path.DirectorySeparatorChar;
|
||||
}
|
||||
|
||||
var isWindows = System.Environment.OSVersion.Platform != PlatformID.Unix;
|
||||
var trayRunning = false;
|
||||
var trayProcesses = Process.GetProcessesByName("JackettTray");
|
||||
if (isWindows)
|
||||
{
|
||||
if (trayProcesses.Count() > 0)
|
||||
{
|
||||
foreach (var proc in trayProcesses)
|
||||
{
|
||||
try
|
||||
{
|
||||
Engine.Logger.Info("Killing tray process " + proc.Id);
|
||||
proc.Kill();
|
||||
trayRunning = true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Engine.Logger.Info("Waiting for Jackett to close..");
|
||||
Thread.Sleep(2000);
|
||||
|
||||
var files = Directory.GetFiles(updateLocation, "*.*", SearchOption.AllDirectories);
|
||||
foreach(var file in files)
|
||||
{
|
||||
var fileName = Path.GetFileName(file).ToLowerInvariant();
|
||||
|
||||
if (fileName.EndsWith(".zip") ||
|
||||
fileName.EndsWith(".tar") ||
|
||||
fileName.EndsWith(".gz"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
Engine.Logger.Info("Copying " + fileName);
|
||||
var dest = Path.Combine(options.Path, file.Substring(updateLocation.Length));
|
||||
File.Copy(file, dest, true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Engine.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (trayRunning)
|
||||
{
|
||||
var startInfo = new ProcessStartInfo()
|
||||
{
|
||||
Arguments = options.Args,
|
||||
FileName = Path.Combine(options.Path, "JackettTray.exe"),
|
||||
UseShellExecute = true
|
||||
};
|
||||
|
||||
Process.Start(startInfo);
|
||||
}
|
||||
|
||||
if(string.Equals(options.Type, "JackettService.exe", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var serviceHelper = new ServiceConfigService(null, null);
|
||||
if (serviceHelper.ServiceExists())
|
||||
{
|
||||
serviceHelper.Start();
|
||||
}
|
||||
} else
|
||||
{
|
||||
var startInfo = new ProcessStartInfo()
|
||||
{
|
||||
Arguments = options.Args,
|
||||
FileName = Path.Combine(options.Path, "JackettConsole.exe"),
|
||||
UseShellExecute = true
|
||||
};
|
||||
|
||||
if (!isWindows)
|
||||
{
|
||||
startInfo.Arguments = startInfo.FileName + " " + startInfo.Arguments;
|
||||
startInfo.FileName = "mono";
|
||||
}
|
||||
|
||||
Engine.Logger.Info("Starting Jackett: " + startInfo.FileName + " " + startInfo.Arguments);
|
||||
Process.Start(startInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private string GetUpdateLocation()
|
||||
{
|
||||
var location = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase);
|
||||
return new FileInfo(location.AbsolutePath).DirectoryName;
|
||||
}
|
||||
}
|
||||
}
|
36
src/Jackett.Updater/Properties/AssemblyInfo.cs
Normal file
36
src/Jackett.Updater/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Jackett.Updater")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Jackett.Updater")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("a61e311a-6f8b-4497-b5e4-2ea8994c7bd8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
21
src/Jackett.Updater/UpdaterConsoleOptions.cs
Normal file
21
src/Jackett.Updater/UpdaterConsoleOptions.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using CommandLine;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett.Updater
|
||||
{
|
||||
public class UpdaterConsoleOptions
|
||||
{
|
||||
[Option('p', "Path", HelpText = "Install location")]
|
||||
public string Path { get; set; }
|
||||
|
||||
[Option('t', "Type", HelpText = "Install type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[Option('a', "Args", HelpText = "Launch arguments")]
|
||||
public string Args { get; set; }
|
||||
}
|
||||
}
|
BIN
src/Jackett.Updater/jackett.ico
Normal file
BIN
src/Jackett.Updater/jackett.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
5
src/Jackett.Updater/packages.config
Normal file
5
src/Jackett.Updater/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
|
||||
<package id="NLog" version="4.2.0" targetFramework="net45" />
|
||||
</packages>
|
@@ -1,10 +1,34 @@
|
||||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett", "Jackett\Jackett.csproj", "{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CurlSharp", "CurlSharp\CurlSharp.csproj", "{74420A79-CC16-442C-8B1E-7C1B913844F0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BE7B0C8A-6144-47CD-821E-B09BA1B7BADE}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\Build.bat = ..\Build.bat
|
||||
..\Installer.iss = ..\Installer.iss
|
||||
..\LICENSE = ..\LICENSE
|
||||
..\README.md = ..\README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Console", "Jackett.Console\Jackett.Console.csproj", "{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Service", "Jackett.Service\Jackett.Service.csproj", "{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Tray", "Jackett.Tray\Jackett.Tray.csproj", "{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Test", "Jackett.Test\Jackett.Test.csproj", "{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Distribution", "Jackett.Distribution\Jackett.Distribution.csproj", "{99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Website", "Website\Website.csproj", "{6B6AB1B0-5ABD-4696-A3D2-70E991174625}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Updater", "Jackett.Updater\Jackett.Updater.csproj", "{A61E311A-6F8B-4497-B5E4-2EA8994C7BD8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -15,8 +39,75 @@ Global
|
||||
{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{99D893EC-1A8A-42A9-AC6B-FE047AFC32F0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6B6AB1B0-5ABD-4696-A3D2-70E991174625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6B6AB1B0-5ABD-4696-A3D2-70E991174625}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6B6AB1B0-5ABD-4696-A3D2-70E991174625}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6B6AB1B0-5ABD-4696-A3D2-70E991174625}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A61E311A-6F8B-4497-B5E4-2EA8994C7BD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A61E311A-6F8B-4497-B5E4-2EA8994C7BD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A61E311A-6F8B-4497-B5E4-2EA8994C7BD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A61E311A-6F8B-4497-B5E4-2EA8994C7BD8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
$0.TextStylePolicy = $1
|
||||
$1.inheritsSet = VisualStudio
|
||||
$1.inheritsScope = text/plain
|
||||
$1.scope = text/x-csharp
|
||||
$0.CSharpFormattingPolicy = $2
|
||||
$2.IndentSwitchBody = True
|
||||
$2.IndentBlocksInsideExpressions = True
|
||||
$2.AnonymousMethodBraceStyle = NextLine
|
||||
$2.PropertyBraceStyle = NextLine
|
||||
$2.PropertyGetBraceStyle = NextLine
|
||||
$2.PropertySetBraceStyle = NextLine
|
||||
$2.EventBraceStyle = NextLine
|
||||
$2.EventAddBraceStyle = NextLine
|
||||
$2.EventRemoveBraceStyle = NextLine
|
||||
$2.StatementBraceStyle = NextLine
|
||||
$2.ElseNewLinePlacement = NewLine
|
||||
$2.CatchNewLinePlacement = NewLine
|
||||
$2.FinallyNewLinePlacement = NewLine
|
||||
$2.WhileNewLinePlacement = DoNotCare
|
||||
$2.ArrayInitializerWrapping = DoNotChange
|
||||
$2.ArrayInitializerBraceStyle = NextLine
|
||||
$2.BeforeMethodDeclarationParentheses = False
|
||||
$2.BeforeMethodCallParentheses = False
|
||||
$2.BeforeConstructorDeclarationParentheses = False
|
||||
$2.NewLineBeforeConstructorInitializerColon = NewLine
|
||||
$2.NewLineAfterConstructorInitializerColon = SameLine
|
||||
$2.BeforeDelegateDeclarationParentheses = False
|
||||
$2.NewParentheses = False
|
||||
$2.SpacesBeforeBrackets = False
|
||||
$2.inheritsSet = Mono
|
||||
$2.inheritsScope = text/x-csharp
|
||||
$2.scope = text/x-csharp
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett
|
||||
{
|
||||
public class ApiKey
|
||||
{
|
||||
|
||||
public static string CurrentKey;
|
||||
|
||||
const string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
public static string Generate()
|
||||
{
|
||||
var randBytes = new byte[32];
|
||||
var rngCsp = new RNGCryptoServiceProvider();
|
||||
rngCsp.GetBytes(randBytes);
|
||||
var key = "";
|
||||
foreach (var b in randBytes)
|
||||
{
|
||||
key += chars[b % chars.Length];
|
||||
}
|
||||
return key;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,14 +2,34 @@
|
||||
<configuration>
|
||||
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user