├── .gitignore
├── .gitattributes
├── ftc
├── README.md
├── jx-upload
│ ├── jx_64.ico
│ ├── Resources
│ │ └── Newtonsoft.Json.dll
│ ├── App.config
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Program.cs
│ ├── LoginForm.cs
│ ├── LoginForm.Designer.cs
│ ├── jx-upload.csproj
│ ├── ftc.cs
│ ├── Form1.cs
│ ├── Form1.Designer.cs
│ ├── LoginForm.resx
│ ├── Form1.resx
│ └── Functions.cs
├── jx-upload.sln
├── .gitattributes
└── .gitignore
├── Makefile
├── README.md
├── fts.h
├── main.c
├── mysql.h
├── mysql.cpp
└── fts.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | main
3 | *.h.gch
4 | /tmp/*.*
5 |
6 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.cs linguist-language=cpp
2 | #我觉得C++更装逼,hhhh
3 |
--------------------------------------------------------------------------------
/ftc/README.md:
--------------------------------------------------------------------------------
1 | # file transfer client
2 |
3 | ## C#实现的文件传输客户端
4 |
5 |
--------------------------------------------------------------------------------
/ftc/jx-upload/jx_64.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodFrm/fts/master/ftc/jx-upload/jx_64.ico
--------------------------------------------------------------------------------
/ftc/jx-upload/Resources/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodFrm/fts/master/ftc/jx-upload/Resources/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/ftc/jx-upload/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ftc/jx-upload/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | g=g++ -Wall
2 |
3 | obj=mysql.o main.o fts.o
4 | param=-lpthread -lmysqlclient
5 |
6 | all:main
7 |
8 | main:$(obj)
9 | $(g) -o main $(obj) $(param)
10 |
11 | main.o:main.c
12 | $(g) -c main.c
13 |
14 | fts.o:fts.h fts.cpp
15 | $(g) -c fts.cpp fts.h
16 |
17 | mysql.o:mysql.h mysql.cpp
18 | $(g) -c mysql.cpp mysql.h
19 |
20 | clean:
21 | @rm *.o main *.h.gch
22 |
23 | run:clean all
24 | ./main
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # file transfer server
2 |
3 | ## C实现的文件传输服务端
4 |
5 | 支持断点续传(主要在客户端实现记录)
6 |
7 | [C#客户端](ftc)
8 |
9 | [学校协会的下载站](https://github.com/CodFrm/jx)
10 |
11 | ## Build
12 |
13 | ```
14 |
15 | apt-get install libmysqlclient-dev #Ubuntu
16 |
17 | //yum install mysql-devel-i386 #Centos
18 |
19 | Centos中Makefile中要修改
20 |
21 | param=-lpthread -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient
22 |
23 | make
24 |
25 | ./main
26 |
27 | ```
28 |
29 |
--------------------------------------------------------------------------------
/ftc/jx-upload/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace jx_upload
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// 应用程序的主入口点。
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new LoginForm());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/fts.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "mysql.h"
9 | std::string randStr(int len);
10 | class fts{
11 | public:
12 | static void* acceptThread(void*);
13 |
14 | static void* dealThread(void*);
15 | int init(int port);
16 |
17 | static bool createFileCache(const char*,int64_t);
18 | private:
19 | int m_sSocket;
20 | pthread_t m_phAccept;
21 |
22 | protected:
23 |
24 | };
--------------------------------------------------------------------------------
/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include "fts.h"
3 | // #include "mysql.h"
4 |
5 | int main(){
6 | // use mysql demo
7 | // mysql* tmp=new mysql();
8 | // record* tmpRec;
9 | // if(tmpRec=tmp->query("select * from jx_user;")){
10 | // printf("success\n",tmp);
11 | // void** res=tmpRec->fetch();
12 | // printf("uid:%d,user:%s,pwd:%s\n",*(int*)res[0],res[1],res[2]);
13 | // }else{
14 | // printf("error %s\n",tmp->error());
15 | // }
16 | fts* server=new fts();
17 | printf("------file transfer server start-----\n");
18 | server->init(5209);
19 | return 0;
20 | }
21 |
--------------------------------------------------------------------------------
/mysql.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #define db_host "10.127.133.247"
6 | #define db_user "root"
7 | #define db_pwd ""
8 | #define db_db "jx"
9 |
10 | class record;
11 |
12 | class mysql{
13 | private:
14 | MYSQL* m_con;
15 | public:
16 | mysql();
17 | ~mysql();
18 |
19 | record* query(const char* sql);
20 | record* query(const char* sql,MYSQL_BIND*);
21 |
22 | bool exec(const char* sql);
23 | bool exec(const char* sql,MYSQL_BIND*);
24 |
25 | const char* error();
26 | };
27 |
28 | class record{
29 | private:
30 | MYSQL_STMT* m_pSTMT=NULL;
31 | MYSQL_BIND* m_Bind=NULL;
32 | void** m_Result=NULL;
33 | int count=0;
34 | public:
35 | record(MYSQL_STMT*);
36 | ~record();
37 |
38 | void** fetch();
39 | };
--------------------------------------------------------------------------------
/ftc/jx-upload/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace jx_upload.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ftc/jx-upload/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("jx-upload")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("jx-upload")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("b9fa43d1-bf21-4f4d-a7ba-99919e3bf5bc")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ftc/jx-upload.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27004.2002
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jx-upload", "jx-upload\jx-upload.csproj", "{B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x86 = Debug|x86
12 | Release|Any CPU = Release|Any CPU
13 | Release|x86 = Release|x86
14 | x86|Any CPU = x86|Any CPU
15 | x86|x86 = x86|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.Debug|x86.ActiveCfg = Debug|x86
21 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.Debug|x86.Build.0 = Debug|x86
22 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.Release|x86.ActiveCfg = Release|x86
25 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.Release|x86.Build.0 = Release|x86
26 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.x86|Any CPU.ActiveCfg = x86|Any CPU
27 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.x86|Any CPU.Build.0 = x86|Any CPU
28 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.x86|x86.ActiveCfg = x86|x86
29 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}.x86|x86.Build.0 = x86|x86
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {33EF8214-9155-4FF2-8754-F735AC290224}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/ftc/jx-upload/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace jx_upload.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("jx_upload.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ftc/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/ftc/jx-upload/LoginForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Linq;
5 | using System.IO;
6 | using System.Reflection;
7 |
8 | namespace jx_upload
9 | {
10 | public partial class LoginForm : Form
11 | {
12 | public LoginForm()
13 | {
14 | InitializeComponent();
15 | }
16 | private Form1 mainForm;
17 | private void button1_Click(object sender, EventArgs e)
18 | {
19 | string retData = Functions.HttpGet(Functions.URL + "/index/index/login", "user=" + textBox1.Text + "&pwd=" + textBox2.Text);
20 | if (retData == "")
21 | {
22 | MessageBox.Show("登录超时,需要在校园网内使用");
23 | return;
24 | }
25 | JObject jo = (JObject)JsonConvert.DeserializeObject(retData);
26 | string zone = jo["code"].ToString();
27 | string zone_en = jo["msg"].ToString();
28 | MessageBox.Show(zone_en, "提示");
29 | if (zone == "0")
30 | {
31 | Functions.WriteIni("data", "user", textBox1.Text);
32 | Functions.WriteIni("check", "savep", "true");
33 | Functions.WriteIni("data", "pwd", textBox2.Text);
34 | Functions.User = textBox1.Text;
35 | Functions.Pwd = textBox2.Text;
36 | mainForm = new Form1();
37 | mainForm.Show();
38 | //Application.Current.MainWindow = mwin;
39 | //mwin.Show();
40 | //this.Close();
41 | Hide();
42 | }
43 | }
44 |
45 | private void LoginForm_Load(object sender, EventArgs e)
46 | {
47 | textBox1.Text = Functions.ReadIni("data", "user");
48 | textBox2.Text = Functions.ReadIni("data", "pwd");
49 | string filePath = Application.StartupPath + @"\Newtonsoft.Json.dll";
50 | if (!File.Exists(filePath))
51 | {
52 | Type type = MethodBase.GetCurrentMethod().DeclaringType;
53 |
54 | string _namespace = type.Namespace;
55 | Assembly _assembly = Assembly.GetExecutingAssembly();
56 | string resourceName = _namespace + ".Resources.Newtonsoft.Json.dll";
57 | Stream stream = _assembly.GetManifestResourceStream(resourceName);
58 |
59 | using (FileStream fs = new FileStream(filePath, FileMode.Create))
60 | {
61 | int fsLen = (int)stream.Length;
62 | byte[] heByte = new byte[fsLen];
63 | int r = stream.Read(heByte, 0, heByte.Length);
64 | string myStr = System.Text.Encoding.UTF8.GetString(heByte);
65 | fs.Write(heByte, 0, fsLen);
66 | }
67 | }
68 | }
69 |
70 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
71 | {
72 | try
73 | {
74 | System.Diagnostics.Process.Start("explorer.exe", Functions.URL);
75 | }
76 | catch (Exception)
77 | {
78 | System.Diagnostics.Process.Start("iexplore.exe", Functions.URL);
79 | }
80 |
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/mysql.cpp:
--------------------------------------------------------------------------------
1 | #include "mysql.h"
2 | //debug
3 | #define _DEBUG
4 | #ifdef _DEBUG
5 | #include
6 | #define prt(s,p) printf(s,p)
7 | #else
8 | #define prt(s,p)
9 | #endif
10 |
11 |
12 | mysql::mysql(){
13 | m_con=mysql_init(NULL);
14 | if(!mysql_real_connect(m_con,db_host,db_user,db_pwd,db_db,3306,NULL,0)){
15 | prt("error db connect\n",m_con);
16 | }
17 | exec("set names utf8;");
18 | prt("db connect..\n",m_con);
19 | }
20 |
21 | mysql::~mysql(){
22 | printf("db close\n");
23 | mysql_close(m_con);
24 | }
25 | bool mysql::exec(const char* sql){
26 | return exec(sql,NULL);
27 | }
28 | bool mysql::exec(const char* sql,MYSQL_BIND* param){
29 | MYSQL_STMT *stmt;
30 | stmt=mysql_stmt_init(m_con);
31 | if(mysql_stmt_prepare(stmt,sql,strlen(sql))){
32 | mysql_stmt_close(stmt);
33 | return false;
34 | }
35 | if(mysql_stmt_bind_param(stmt,param)){
36 | mysql_stmt_close(stmt);
37 | return false;
38 | }
39 | if(mysql_stmt_execute(stmt)){
40 | mysql_stmt_close(stmt);
41 | return false;
42 | }
43 | mysql_stmt_close(stmt);
44 | return true;
45 | }
46 |
47 | record* mysql::query(const char* sql){
48 | return query(sql,NULL);
49 | }
50 | record* mysql::query(const char* sql,MYSQL_BIND* param){
51 | MYSQL_STMT *stmt;
52 | stmt=mysql_stmt_init(m_con);
53 | record* tmpRec=new record(stmt);
54 | if(mysql_stmt_prepare(stmt,sql,strlen(sql))){
55 | mysql_stmt_close(stmt);
56 | return NULL;
57 | }
58 | if(mysql_stmt_bind_param(stmt,param)){
59 | mysql_stmt_close(stmt);
60 | return NULL;
61 | }
62 | if(mysql_stmt_execute(stmt)){
63 | mysql_stmt_close(stmt);
64 | return NULL;
65 | }
66 |
67 | return tmpRec;
68 | }
69 |
70 | const char* mysql::error(){
71 | return mysql_error(m_con);
72 | }
73 |
74 | record::record(MYSQL_STMT* stmt){
75 | m_pSTMT=stmt;
76 | m_Bind=NULL;
77 | }
78 |
79 | record::~record(){
80 | mysql_stmt_close(m_pSTMT);
81 | if(m_Bind){
82 | for(int i=0;itype==FIELD_TYPE_LONG){
103 | m_Result[pos]=malloc(sizeof(int));
104 | m_Bind[pos].buffer=(char*)m_Result[pos];
105 | m_Bind[pos].buffer_type=MYSQL_TYPE_LONG;
106 | }else if(field->type==253){
107 | m_Result[pos]=malloc(255);
108 | memset(m_Result[pos],0,255);
109 | m_Bind[pos].buffer=(char*)m_Result[pos];
110 | m_Bind[pos].buffer_type=MYSQL_TYPE_STRING;
111 | m_Bind[pos].buffer_length=255;
112 | len=255;
113 | m_Bind[pos].length=&len;
114 | }else if(field->type==FIELD_TYPE_DOUBLE){
115 | m_Result[pos]=malloc(sizeof(double));
116 | m_Bind[pos].buffer=(char*)m_Result[pos];
117 | m_Bind[pos].buffer_type=MYSQL_TYPE_DOUBLE;
118 | }else if(field->type==FIELD_TYPE_LONGLONG){
119 | m_Result[pos]=malloc(sizeof(int64_t));
120 | m_Bind[pos].buffer=(char*)m_Result[pos];
121 | m_Bind[pos].buffer_type=MYSQL_TYPE_LONGLONG;
122 | }
123 | pos++;
124 | }
125 | mysql_free_result(meta_result);
126 | }
127 | }
128 | if(mysql_stmt_bind_result(m_pSTMT,m_Bind)){
129 | return NULL;
130 | }
131 | printf("fetch\n");
132 | try{
133 | int r=0;
134 | if(r=mysql_stmt_fetch(m_pSTMT)){
135 | printf("r:%d,%d,%d\n",r,MYSQL_NO_DATA,MYSQL_DATA_TRUNCATED);
136 | return NULL;
137 | }
138 | }catch(...){
139 | printf("fetch error\n");
140 | return NULL;
141 | }
142 | return m_Result;
143 | }
--------------------------------------------------------------------------------
/ftc/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/ftc/jx-upload/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ftc/jx-upload/LoginForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace jx_upload
2 | {
3 | partial class LoginForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginForm));
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.textBox1 = new System.Windows.Forms.TextBox();
34 | this.label1 = new System.Windows.Forms.Label();
35 | this.textBox2 = new System.Windows.Forms.TextBox();
36 | this.label2 = new System.Windows.Forms.Label();
37 | this.linkLabel1 = new System.Windows.Forms.LinkLabel();
38 | this.SuspendLayout();
39 | //
40 | // button1
41 | //
42 | this.button1.Location = new System.Drawing.Point(203, 97);
43 | this.button1.Name = "button1";
44 | this.button1.Size = new System.Drawing.Size(85, 29);
45 | this.button1.TabIndex = 0;
46 | this.button1.Text = "登录";
47 | this.button1.UseVisualStyleBackColor = true;
48 | this.button1.Click += new System.EventHandler(this.button1_Click);
49 | //
50 | // textBox1
51 | //
52 | this.textBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
53 | this.textBox1.Location = new System.Drawing.Point(61, 12);
54 | this.textBox1.Name = "textBox1";
55 | this.textBox1.Size = new System.Drawing.Size(227, 26);
56 | this.textBox1.TabIndex = 1;
57 | //
58 | // label1
59 | //
60 | this.label1.AutoSize = true;
61 | this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
62 | this.label1.Location = new System.Drawing.Point(14, 17);
63 | this.label1.Name = "label1";
64 | this.label1.Size = new System.Drawing.Size(48, 16);
65 | this.label1.TabIndex = 2;
66 | this.label1.Text = "账号:";
67 | //
68 | // textBox2
69 | //
70 | this.textBox2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
71 | this.textBox2.Location = new System.Drawing.Point(61, 53);
72 | this.textBox2.Name = "textBox2";
73 | this.textBox2.PasswordChar = '●';
74 | this.textBox2.Size = new System.Drawing.Size(227, 26);
75 | this.textBox2.TabIndex = 3;
76 | //
77 | // label2
78 | //
79 | this.label2.AutoSize = true;
80 | this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
81 | this.label2.Location = new System.Drawing.Point(14, 58);
82 | this.label2.Name = "label2";
83 | this.label2.Size = new System.Drawing.Size(48, 16);
84 | this.label2.TabIndex = 4;
85 | this.label2.Text = "密码:";
86 | //
87 | // linkLabel1
88 | //
89 | this.linkLabel1.AutoSize = true;
90 | this.linkLabel1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
91 | this.linkLabel1.Location = new System.Drawing.Point(15, 105);
92 | this.linkLabel1.Name = "linkLabel1";
93 | this.linkLabel1.Size = new System.Drawing.Size(88, 16);
94 | this.linkLabel1.TabIndex = 5;
95 | this.linkLabel1.TabStop = true;
96 | this.linkLabel1.Text = "信院下载站";
97 | this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
98 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
99 | //
100 | // LoginForm
101 | //
102 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
103 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
104 | this.ClientSize = new System.Drawing.Size(302, 141);
105 | this.Controls.Add(this.linkLabel1);
106 | this.Controls.Add(this.textBox2);
107 | this.Controls.Add(this.label2);
108 | this.Controls.Add(this.textBox1);
109 | this.Controls.Add(this.label1);
110 | this.Controls.Add(this.button1);
111 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
112 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
113 | this.MaximizeBox = false;
114 | this.Name = "LoginForm";
115 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
116 | this.Text = "信院下载站 - Login";
117 | this.Load += new System.EventHandler(this.LoginForm_Load);
118 | this.ResumeLayout(false);
119 | this.PerformLayout();
120 |
121 | }
122 |
123 | #endregion
124 |
125 | private System.Windows.Forms.Button button1;
126 | private System.Windows.Forms.TextBox textBox1;
127 | private System.Windows.Forms.Label label1;
128 | private System.Windows.Forms.TextBox textBox2;
129 | private System.Windows.Forms.Label label2;
130 | private System.Windows.Forms.LinkLabel linkLabel1;
131 | }
132 | }
--------------------------------------------------------------------------------
/ftc/jx-upload/jx-upload.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {B9FA43D1-BF21-4F4D-A7BA-99919E3BF5BC}
8 | WinExe
9 | jx_upload
10 | jx-upload
11 | v4.0
12 | 512
13 | true
14 |
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 | AnyCPU
33 | true
34 | full
35 | false
36 | bin\Debug\
37 | DEBUG;TRACE
38 | prompt
39 | 4
40 | false
41 |
42 |
43 | AnyCPU
44 | pdbonly
45 | true
46 | bin\Release\
47 | TRACE
48 | prompt
49 | 4
50 | false
51 |
52 |
53 | jx_64.ico
54 |
55 |
56 | bin\x86\
57 | TRACE
58 | true
59 | pdbonly
60 | AnyCPU
61 | prompt
62 | MinimumRecommendedRules.ruleset
63 | false
64 |
65 |
66 | true
67 | bin\x86\Debug\
68 | DEBUG;TRACE
69 | full
70 | x86
71 | prompt
72 | MinimumRecommendedRules.ruleset
73 | false
74 |
75 |
76 | bin\x86\Release\
77 | TRACE
78 | true
79 | pdbonly
80 | x86
81 | prompt
82 | MinimumRecommendedRules.ruleset
83 | false
84 |
85 |
86 | bin\x86\
87 | TRACE
88 | true
89 | pdbonly
90 | x86
91 | prompt
92 | MinimumRecommendedRules.ruleset
93 | false
94 |
95 |
96 |
97 | Resources\Newtonsoft.Json.dll
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 | Form
115 |
116 |
117 | Form1.cs
118 |
119 |
120 |
121 |
122 | Form
123 |
124 |
125 | LoginForm.cs
126 |
127 |
128 |
129 |
130 | Form1.cs
131 |
132 |
133 | LoginForm.cs
134 |
135 |
136 | ResXFileCodeGenerator
137 | Resources.Designer.cs
138 | Designer
139 |
140 |
141 | True
142 | Resources.resx
143 | True
144 |
145 |
146 | SettingsSingleFileGenerator
147 | Settings.Designer.cs
148 |
149 |
150 | True
151 | Settings.settings
152 | True
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 | False
168 | .NET Framework 3.5 SP1
169 | true
170 |
171 |
172 |
173 |
--------------------------------------------------------------------------------
/fts.cpp:
--------------------------------------------------------------------------------
1 | #include "fts.h"
2 |
3 | //debug
4 | #define _DEBUG
5 | #ifdef _DEBUG
6 | #include
7 | #define prt(s,p) printf(s,p)
8 | #else
9 | #define prt(s,p)
10 | #endif
11 |
12 | #define dir "tmp/"
13 |
14 | int fts::init(int port)
15 | {
16 | this->m_sSocket = socket(AF_INET, SOCK_STREAM, 0);
17 | struct sockaddr_in server_sockaddr;
18 | server_sockaddr.sin_family = AF_INET;
19 | server_sockaddr.sin_port = htons(port);
20 | server_sockaddr.sin_addr.s_addr = htonl(INADDR_ANY);
21 | ///bind,成功返回0,出错返回-1
22 | if (bind(this->m_sSocket, (struct sockaddr *)&server_sockaddr, sizeof(server_sockaddr)) == -1)
23 | {
24 | return -1;
25 | }
26 | ///listen,成功返回0,出错返回-1
27 | if (listen(this->m_sSocket, 5) == -1)
28 | {
29 | return -1;
30 | }
31 | int ret=pthread_create(&this->m_phAccept,NULL,fts::acceptThread,(void*)&this->m_sSocket);
32 | if(ret!=0)return ret;
33 | pthread_join(this->m_phAccept,NULL);
34 | return 0;
35 | }
36 |
37 | void* fts::acceptThread(void* p){
38 | int sServer=*(int*)p;
39 | int sClient=0;
40 | while((sClient = accept(sServer,(struct sockaddr*)NULL,NULL))>0){
41 | prt("client connect:%d\n",sClient);
42 | pthread_t id;
43 | pthread_create(&id,NULL,fts::dealThread,(void*)&sClient);
44 | }
45 | return 0;
46 | }
47 |
48 | std::string randStr(int len){
49 | srand((unsigned)time(NULL));
50 | char str[]="zxcvbnmasdfghjklqwertyuiop1234567890QWERTYUIOPASDFGHJKLZXCVBNM";
51 | std::string ret;
52 | for(int i=0;i=max){
70 | char tmp[]=" file size is too large(0~4GB)";
71 | tmp[0]=1;
72 | send(sClient,tmp,sizeof(tmp),0);
73 | prt("file size error:%ld\n",fileSize);
74 | return 0;
75 | }
76 | prt("code:%d,",code);
77 | prt("soft_id:%d,",soft_id);
78 | prt("file size:%ld\n",fileSize);
79 | mysql db;
80 | record* tmpRec;
81 | MYSQL_BIND* param;
82 | param=(MYSQL_BIND*)malloc(sizeof(MYSQL_BIND)*1);
83 | unsigned long len=8;
84 | memset(param,0,sizeof(param));
85 | param[0].buffer_type=MYSQL_TYPE_LONGLONG;
86 | param[0].buffer=(char*)&soft_id;
87 | param[0].length=&len;
88 | FILE* pFile;
89 | std::string tmpPath=dir;
90 | printf("soft_id:%d ------\n",soft_id);
91 | std::string sql="select `soft_uid`,`soft_filename`,`soft_type` from jx_soft_list where sid=";
92 | char tmp[32];
93 | sprintf(tmp,"%ld",soft_id);
94 | sql+=tmp;
95 | if(tmpRec=db.query(sql.c_str())){
96 | free(param);
97 | void** res=tmpRec->fetch();
98 | if(!res){
99 | printf("error:%s\n",db.error());
100 | delete tmpRec;
101 | char tmp[]=" could not find sid";
102 | tmp[0]=2;
103 | send(sClient,tmp,sizeof(tmp),0);
104 | prt("could not find sid:%ld\n",soft_id);
105 | return 0;
106 | }
107 | printf("uid:%ld,filename:%s\n",*(int64_t*)res[0],res[1]);
108 | if((*(int*)res[2])!=3){
109 | delete tmpRec;
110 | char tmp[]=" could not find sid";
111 | tmp[0]=2;
112 | send(sClient,tmp,sizeof(tmp),0);
113 | prt("could not find sid:%ld\n",soft_id);
114 | return 0;
115 | }
116 | //create file
117 | delete tmpRec;
118 | std::string filename="";
119 | if(code==1){
120 | filename=randStr(16)+".tmp";
121 | tmpPath+=filename;
122 | if(!fts::createFileCache(tmpPath.c_str(),fileSize)){
123 | char tmp[]=" server disk error";
124 | tmp[0]=4;
125 | send(sClient,tmp,sizeof(tmp),0);
126 | return 0;
127 | }
128 | }else if(code==2){
129 | //code=2 continue send
130 | fileRecvLen=*(int64_t*)&headRecvBuff[17];
131 | filename=&headRecvBuff[25];
132 | tmpPath+=filename;
133 | }
134 | printf("file:%s len:%ld\n",tmpPath.c_str(),fileRecvLen);
135 | if(!(pFile=fopen(tmpPath.c_str(),"rx+"))){
136 | char tmp[]=" server system error";
137 | tmp[0]=5;
138 | send(sClient,tmp,sizeof(tmp),0);
139 | return 0;
140 | }
141 | if(fseek(pFile,fileRecvLen,0)){
142 | char tmp[]=" continue param error";
143 | tmp[0]=6;
144 | send(sClient,tmp,sizeof(tmp),0);
145 | return 0;
146 | }
147 | std::string strSend=" ";
148 | strSend+=filename;
149 | char tmp[32]={0};
150 | strcpy(tmp,strSend.c_str());
151 | printf("send:%s\n",strSend.c_str());
152 | tmp[0]=10;
153 | send(sClient,tmp,strSend.length(),0);
154 | }else{
155 | printf("sql error");
156 | free(param);
157 | char tmp[]=" could not find sid";
158 | tmp[0]=2;
159 | send(sClient,tmp,sizeof(tmp),0);
160 | prt("could not find sid:%ld\n",soft_id);
161 | return 0;
162 | }
163 | int64_t recvTotalLen=fileRecvLen;
164 | int64_t recvLen=0;
165 | printf("start recv file temp file:%s\n",tmpPath.c_str());
166 | while(true){
167 | char recvBuff[4096]={0};//cache
168 | if((recvLen=recv(sClient,recvBuff,4096,0))<=0)break;
169 | recvTotalLen+=recvLen;
170 | fwrite(recvBuff,recvLen,1,pFile);
171 | if(recvTotalLen>=fileSize){
172 | char tmp[]=" success";
173 | tmp[0]=0;
174 | send(sClient,tmp,sizeof(tmp),0);
175 | printf("%ld,%ld\n",recvTotalLen,fileSize);
176 | fclose(pFile);
177 | //update db
178 | param=(MYSQL_BIND*)malloc(sizeof(MYSQL_BIND)*2);
179 | memset(param,0,sizeof(MYSQL_BIND)*2);
180 | char pchr[32]={0};
181 | unsigned long strLen=tmpPath.length();
182 | strcpy(pchr,tmpPath.c_str());
183 | param[0].buffer_type=MYSQL_TYPE_STRING;
184 | param[0].buffer=(char*)pchr;
185 | param[0].buffer_length=tmpPath.length();
186 | param[0].length=&strLen;
187 | printf("%s %d\n",pchr,tmpPath.length());
188 | param[1].buffer_type=MYSQL_TYPE_LONGLONG;
189 | param[1].buffer=(char*)&soft_id;
190 | param[1].length=0;
191 | if(!db.exec("update jx_soft_list set `soft_path`=?,`soft_type`=0 where sid=?",param)){
192 | printf("update error,path:%s sid:%ld\n",pchr,soft_id);
193 | }
194 | free(param);
195 | shutdown(sClient,2);
196 | break;
197 | }
198 | }
199 | printf("close connect:%d\n",sClient);
200 | return 0;
201 | }
202 |
203 |
204 | bool fts::createFileCache(const char* file,int64_t size){
205 | FILE* pFile;
206 | if(!(pFile=fopen(file,"wx"))){
207 | return false;
208 | }
209 | int64_t total=size;
210 | int w=4194304;
211 | char* buffer=new char[4194304];
212 | memset(buffer,0,4194304);
213 | while(total>0){
214 | total-=4194304;
215 | if(total<0){
216 | w=total+4194304;
217 | }
218 | if(fwrite(buffer,w,1,pFile)<=0){
219 | delete[] buffer;
220 | fclose(pFile);
221 | remove(file);
222 | return false;
223 | }
224 | }
225 | delete[] buffer;
226 | fclose(pFile);
227 | return true;
228 | }
--------------------------------------------------------------------------------
/ftc/jx-upload/ftc.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Net;
5 | using System.Net.Sockets;
6 | using System.Text;
7 | using System.Threading;
8 |
9 | namespace jx_upload
10 | {
11 | class ftc
12 | {
13 | protected Socket client;
14 | public ftc(string sIp, CallBackFun fun) : this(sIp, 5209, fun)
15 | {
16 |
17 | }
18 | public ftc(string sIp, int port = 5209, CallBackFun fun = null)
19 | {
20 | if (fun != null)
21 | {
22 | SetCallBack(fun);
23 | }
24 | try
25 | {
26 | IPAddress ip = IPAddress.Parse(sIp);
27 | IPEndPoint ipe = new IPEndPoint(ip, port);
28 | client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
29 | client.Connect(ipe);
30 | }
31 | catch (Exception)
32 | {
33 | backFun(-1, "连接失败");
34 | return;
35 | }
36 | Thread thread = new Thread(new ThreadStart(RecvThread));
37 | thread.Start();
38 | }
39 | ~ftc()
40 | {
41 | client.Close();
42 | }
43 |
44 | public delegate void CallBackFun(int code, string msg);
45 | CallBackFun backFun = null;
46 | public void SetCallBack(CallBackFun fun)
47 | {
48 | this.backFun = fun;
49 | }
50 |
51 | public void RecvThread()
52 | {
53 | try
54 | {
55 | while (client.Connected)
56 | {
57 | byte[] buff = new byte[1024];
58 | int length=0;
59 | try
60 | {
61 | length = client.Receive(buff, buff.Length, 0);
62 | }
63 | catch (Exception)
64 | {
65 | break;
66 | }
67 | if (length > 0)
68 | {
69 | int code = buff[0];
70 | buff = buff.Skip(1).ToArray();
71 | string data = Encoding.UTF8.GetString(buff).TrimEnd('\0');
72 | backFun(code, data);
73 | if (code != 10 && code != 0)
74 | {
75 | client.Close();
76 | }
77 | else if (code == 10)
78 | {
79 | //开始发送文件数据
80 | long sendTotalLen = 0;
81 | string tmpStrSendLen = Functions.ReadIni("sid_" + id.ToString(), "send");
82 | if (tmpStrSendLen != "")
83 | {
84 | sendTotalLen = long.Parse(tmpStrSendLen)-8192;
85 | if (sendTotalLen<0)
86 | {
87 | sendTotalLen = 0;
88 | }
89 | }
90 | FileStream file = File.Open(filePath, FileMode.Open, FileAccess.Read);
91 | file.Seek(sendTotalLen,SeekOrigin.Begin);
92 | Functions.WriteIni("sid_" + id.ToString(), "tmp", data);
93 | while (sendTotalLen < fileSize)
94 | {
95 | int sendLen = 0;
96 | if (sendTotalLen + 524288 > fileSize)
97 | {
98 | sendLen = (int)(fileSize - sendTotalLen);
99 | }
100 | else
101 | {
102 | sendLen = 524288;
103 | }
104 | byte[] buffer = new byte[sendLen];
105 | sendLen = file.Read(buffer, 0, sendLen);
106 | sendLen = Send(buffer, sendLen);
107 | sendTotalLen += sendLen;
108 | backFun(1000, ((int)(((double)sendTotalLen / (double)fileSize) * 100)).ToString());
109 | Functions.WriteIni("sid_"+id.ToString(),"send", sendTotalLen.ToString());
110 | }
111 | file.Close();
112 | }
113 | }
114 | else
115 | {
116 | break;
117 | }
118 | }
119 | }
120 | catch (IOException ex)
121 | {
122 | var tmp = ex.Message;
123 | }
124 |
125 |
126 | }
127 |
128 | internal void SendToSid()
129 | {
130 | this.filePath = Functions.ReadIni("sid_"+ id.ToString(),"filename" );
131 | FileInfo fileInfo = new FileInfo(filePath);
132 | fileSize = (long)fileInfo.Length;
133 | var sizeByte = BitConverter.GetBytes(fileSize);
134 | sizeByte = BitConverter.GetBytes(fileSize);
135 | sizeByte = sizeByte.Concat(BitConverter.GetBytes(id)).ToArray();
136 | string sLen = Functions.ReadIni("sid_" + id.ToString(), "send");
137 | long tmpSend=0;
138 | if (sLen != "")
139 | {
140 | tmpSend = long.Parse(sLen) - 8192;
141 | if (tmpSend < 0)
142 | {
143 | tmpSend = 0;
144 | }
145 | }
146 | Byte[] tmpBuff = BitConverter.GetBytes(tmpSend);
147 | tmpBuff = sizeByte.Concat(tmpBuff).ToArray();
148 | sizeByte=Encoding.UTF8.GetBytes(Functions.ReadIni("sid_" + id.ToString(), "tmp"));
149 | tmpBuff = tmpBuff.Concat(sizeByte).ToArray();
150 | Byte[] code = { 2 };
151 | tmpBuff = code.Concat(tmpBuff).ToArray();
152 | if (Send(tmpBuff, tmpBuff.Length) <= 0)
153 | {
154 | backFun(-1, "发送失败");
155 | }
156 | }
157 |
158 | private long id;
159 | public void SetFileId(long id)
160 | {
161 | this.id = id;
162 | }
163 | private string filePath;
164 | private long fileSize;
165 | public void SendFileMsg(string filePath)
166 | {
167 | this.filePath = filePath;
168 | string fileName = Path2name(filePath);
169 | FileInfo fileInfo = new FileInfo(filePath);
170 | fileSize = (long)fileInfo.Length;
171 | var sizeByte = BitConverter.GetBytes(fileSize);
172 | sizeByte = BitConverter.GetBytes(fileSize);
173 | sizeByte = sizeByte.Concat(BitConverter.GetBytes(id)).ToArray();
174 | Byte[] tmpBuff = Encoding.UTF8.GetBytes(fileName);
175 | tmpBuff = sizeByte.Concat(tmpBuff).ToArray();
176 | Byte[] code = { 1 };
177 | tmpBuff = code.Concat(tmpBuff).ToArray();
178 | if (Send(tmpBuff, tmpBuff.Length) <= 0)
179 | {
180 | backFun(-1, "发送失败");
181 | }
182 | else
183 | {
184 | Functions.WriteIni("sid_"+id.ToString(),"filename",filePath);
185 | }
186 | }
187 |
188 |
189 | private string Path2name(string filePath)
190 | {
191 | string name = "";
192 | int pos = filePath.LastIndexOf("\\");
193 | if (pos < 0)
194 | {
195 | return "";
196 | }
197 | name = filePath.Substring(pos + 1);
198 | return name;
199 | }
200 |
201 | private int Send(byte[] buff, int sendLen)
202 | {
203 | int len;
204 | try
205 | {
206 | len = client.Send(buff, sendLen, 0);
207 | }
208 | catch (Exception)
209 | {
210 | return 0;
211 | }
212 | return len;
213 | }
214 |
215 | }
216 | }
217 |
--------------------------------------------------------------------------------
/ftc/jx-upload/Form1.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 | using System;
4 | using System.IO;
5 | using System.Net;
6 | using System.Threading;
7 | using System.Windows.Forms;
8 |
9 | namespace jx_upload
10 | {
11 | public partial class Form1 : Form
12 | {
13 | public Form1()
14 | {
15 | InitializeComponent();
16 | }
17 | private ftc m_ftc;
18 | private string m_image;
19 | private bool isupload = false;
20 | private void button1_Click(object sender, EventArgs e)
21 | {
22 | if (isupload)
23 | {
24 | MessageBox.Show("正在上传,请等待");
25 | return;
26 | }
27 | OpenFileDialog openFileDialog = new OpenFileDialog();
28 | openFileDialog.Filter = "所有文件|*.*";
29 | openFileDialog.RestoreDirectory = true;
30 | openFileDialog.FilterIndex = 1;
31 | if (openFileDialog.ShowDialog() == DialogResult.OK)
32 | {
33 | string fName = openFileDialog.FileName;
34 | //先获取id
35 | if (listBox1.SelectedIndex < 0)
36 | {
37 | MessageBox.Show("未选择上传分区");
38 | return;
39 | }
40 | sortItem tmpItem = (sortItem)listBox1.Items[listBox1.SelectedIndex];
41 | string retData = Functions.HttpPost(Functions.URL + "/index/api/isUpload", "name=" + Functions.URLEncode(textBox1.Text) + "&filename=" + Functions.URLEncode(Path.GetFileName(fName))
42 | + "&exp=" + Functions.URLEncode(textBox2.Text) + "&sort_id=" + tmpItem.ID + "&price=" + textBox3.Text + "&logo=" + Functions.URLEncode(m_image));
43 | JObject jo = (JObject)JsonConvert.DeserializeObject(retData);
44 | string msg = jo["msg"].ToString();
45 | string code = jo["code"].ToString();
46 | if (code == "0")
47 | {
48 | retData = Functions.HttpPost(Functions.URL + "/index/api/applyUpload", "name=" + Functions.URLEncode(textBox1.Text) + "&filename=" + Functions.URLEncode(Path.GetFileName(fName))
49 | + "&exp=" + Functions.URLEncode(textBox2.Text) + "&sort_id=" + tmpItem.ID + "&price=" + textBox3.Text + "&logo=" + Functions.URLEncode(m_image));
50 | jo = (JObject)JsonConvert.DeserializeObject(retData);
51 | uploadFile(fName, jo["id"].ToString());
52 | }
53 | else if (code == "-2")
54 | {
55 | DialogResult dr = MessageBox.Show("你有一个未完成的任务,是否先将未完成的任务上传?\n点击是将先上传之前的文件,否将上一个任务删除,直接进行新任务的上传", "提示", MessageBoxButtons.YesNo);
56 | if (dr == DialogResult.Yes)
57 | {
58 | string filePath = Functions.ReadIni("sid_" + jo["sid"].ToString(), "filename");
59 | if (!File.Exists(filePath))
60 | {
61 | if (MessageBox.Show("在这台电脑上没有找到相应的上传记录,是否删除记录?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
62 | {
63 | Functions.HttpPost(Functions.URL + "/index/user/remove_upload?sid=" + jo["sid"].ToString());
64 | }
65 | return;
66 | }
67 | isupload = true;
68 | label4.Text = "准备上传...";
69 | IPHostEntry host = Dns.GetHostByName("d.icodef.com");
70 | IPAddress ip = host.AddressList[0];
71 | m_ftc = new ftc(ip.ToString(), FtcCallBack);//10.127.134.51
72 | m_ftc.SetFileId(long.Parse(jo["sid"].ToString()));
73 | m_ftc.SendToSid();
74 | }
75 | else
76 | {
77 | Functions.HttpPost(Functions.URL + "/index/user/remove_upload?sid=" + jo["sid"].ToString());
78 | retData = Functions.HttpPost(Functions.URL + "/index/api/applyUpload", "name=" + Functions.URLEncode(textBox1.Text) + "&filename=" + Functions.URLEncode(Path.GetFileName(fName))
79 | + "&exp=" + Functions.URLEncode(textBox2.Text) + "&sort_id=" + tmpItem.ID + "&price=" + textBox3.Text + "&logo=" + Functions.URLEncode(m_image));
80 | jo = (JObject)JsonConvert.DeserializeObject(retData);
81 | uploadFile(fName, jo["id"].ToString());
82 | }
83 | }
84 | else
85 | {
86 | MessageBox.Show(msg);
87 | }
88 | }
89 | }
90 |
91 | private void uploadFile(string filename, string sid)
92 | {
93 | isupload = true;
94 | label4.Text = "开始上传...";
95 | IPHostEntry host = Dns.GetHostByName("d.icodef.com");
96 | IPAddress ip = host.AddressList[0];
97 | m_ftc = new ftc(ip.ToString(), FtcCallBack);//10.127.134.51
98 | m_ftc.SetFileId(long.Parse(sid));
99 | m_ftc.SendFileMsg(filename);
100 | }
101 |
102 | private void FtcCallBack(int code, string msg)
103 | {
104 | Action act = () =>
105 | {
106 |
107 | if (code == 0)
108 | {
109 | MessageBox.Show("上传成功!");
110 | isupload = false;
111 | }
112 | else if (code == 1000)
113 | {
114 | progressBar1.Value = int.Parse(msg);
115 | label4.Text = "上传进度:" + msg + "%";
116 | }
117 | else
118 | {
119 | label4.Text = msg;
120 | isupload = false;
121 | }
122 | };
123 | label4.Invoke(act);
124 | }
125 | private void Form1_FormClosing(object sender, FormClosingEventArgs e)
126 | {
127 | System.Environment.Exit(0);
128 | }
129 |
130 | private void pictureBox1_Click(object sender, EventArgs e)
131 | {
132 | OpenFileDialog openFileDialog = new OpenFileDialog();
133 | openFileDialog.Filter = "图片|*.jpg;*.jpge;*.bmp;*.png";
134 | openFileDialog.RestoreDirectory = true;
135 | openFileDialog.FilterIndex = 1;
136 | if (openFileDialog.ShowDialog() == DialogResult.OK)
137 | {
138 | try
139 | {
140 | string retData = Functions.HttpPostFile(Functions.URL + "/index/api/upload_image", openFileDialog.FileName);
141 | JObject jo = (JObject)JsonConvert.DeserializeObject(retData);
142 | string msg = jo["msg"].ToString();
143 | string code = jo["code"].ToString();
144 | MessageBox.Show(this, msg, "提示");
145 | if (code == "0")
146 | {
147 | m_image = jo["url"].ToString();
148 | pictureBox1.Image = System.Drawing.Image.FromStream(Functions.HttpFile(Functions.URL + "/static/res/images/" + jo["url"].ToString()).BaseStream);
149 | }
150 | }
151 | catch (Exception)
152 | {
153 | MessageBox.Show("网络错误");
154 | }
155 |
156 | }
157 | }
158 | class sortItem
159 | {
160 | private string name;
161 | private string sid;
162 | public sortItem(string sid, string name)
163 | {
164 | this.name = name;
165 | this.sid = sid;
166 | }
167 | public string Name
168 | {
169 | get
170 | {
171 | return this.name;
172 | }
173 | set
174 | {
175 | this.name = value;
176 | }
177 | }
178 | public override string ToString()
179 | {
180 | return this.name;
181 | }
182 | public string ID
183 | {
184 | get
185 | {
186 | return this.sid;
187 | }
188 | set
189 | {
190 | this.sid = value;
191 | }
192 | }
193 | }
194 | private void Form1_Load(object sender, EventArgs e)
195 | {
196 | Thread thread = new Thread(init);
197 | thread.Start();
198 | }
199 | private void init()
200 | {
201 | try
202 | {
203 | string retData = Functions.HttpGet(Functions.URL + "/api/getSortList");
204 | JObject jo = (JObject)JsonConvert.DeserializeObject(retData);
205 | Action act = () =>
206 | {
207 | label4.Text = "获取分区列表....";
208 | listBox1.Items.Clear();
209 | string msg = jo["msg"].ToString();
210 | string code = jo["code"].ToString();
211 | foreach (var item in jo["rows"])
212 | {
213 | sortItem sort = new sortItem(item["sid"].ToString(), item["name"].ToString());
214 | listBox1.Items.Add(sort);
215 | }
216 | label4.Text = "分区列表获取完成";
217 | };
218 | listBox1.Invoke(act);
219 |
220 | }
221 | catch (Exception e)
222 | {
223 | MessageBox.Show(e.Message);
224 | }
225 | }
226 | }
227 | }
228 |
--------------------------------------------------------------------------------
/ftc/jx-upload/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace jx_upload
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows 窗体设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.textBox1 = new System.Windows.Forms.TextBox();
34 | this.label1 = new System.Windows.Forms.Label();
35 | this.textBox2 = new System.Windows.Forms.TextBox();
36 | this.label2 = new System.Windows.Forms.Label();
37 | this.textBox3 = new System.Windows.Forms.TextBox();
38 | this.label3 = new System.Windows.Forms.Label();
39 | this.listBox1 = new System.Windows.Forms.ListBox();
40 | this.progressBar1 = new System.Windows.Forms.ProgressBar();
41 | this.label4 = new System.Windows.Forms.Label();
42 | this.button2 = new System.Windows.Forms.Button();
43 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
44 | this.label5 = new System.Windows.Forms.Label();
45 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
46 | this.SuspendLayout();
47 | //
48 | // button1
49 | //
50 | this.button1.Location = new System.Drawing.Point(318, 277);
51 | this.button1.Name = "button1";
52 | this.button1.Size = new System.Drawing.Size(65, 44);
53 | this.button1.TabIndex = 0;
54 | this.button1.Text = "上传";
55 | this.button1.UseVisualStyleBackColor = true;
56 | this.button1.Click += new System.EventHandler(this.button1_Click);
57 | //
58 | // textBox1
59 | //
60 | this.textBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
61 | this.textBox1.Location = new System.Drawing.Point(71, 12);
62 | this.textBox1.Name = "textBox1";
63 | this.textBox1.Size = new System.Drawing.Size(242, 26);
64 | this.textBox1.TabIndex = 1;
65 | //
66 | // label1
67 | //
68 | this.label1.AutoSize = true;
69 | this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
70 | this.label1.Location = new System.Drawing.Point(25, 17);
71 | this.label1.Name = "label1";
72 | this.label1.Size = new System.Drawing.Size(48, 16);
73 | this.label1.TabIndex = 2;
74 | this.label1.Text = "名称:";
75 | //
76 | // textBox2
77 | //
78 | this.textBox2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
79 | this.textBox2.Location = new System.Drawing.Point(71, 44);
80 | this.textBox2.Multiline = true;
81 | this.textBox2.Name = "textBox2";
82 | this.textBox2.Size = new System.Drawing.Size(242, 152);
83 | this.textBox2.TabIndex = 3;
84 | //
85 | // label2
86 | //
87 | this.label2.AutoSize = true;
88 | this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
89 | this.label2.Location = new System.Drawing.Point(25, 49);
90 | this.label2.Name = "label2";
91 | this.label2.Size = new System.Drawing.Size(48, 16);
92 | this.label2.TabIndex = 4;
93 | this.label2.Text = "说明:";
94 | //
95 | // textBox3
96 | //
97 | this.textBox3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
98 | this.textBox3.Location = new System.Drawing.Point(71, 202);
99 | this.textBox3.Name = "textBox3";
100 | this.textBox3.Size = new System.Drawing.Size(69, 26);
101 | this.textBox3.TabIndex = 5;
102 | //
103 | // label3
104 | //
105 | this.label3.AutoSize = true;
106 | this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
107 | this.label3.Location = new System.Drawing.Point(25, 207);
108 | this.label3.Name = "label3";
109 | this.label3.Size = new System.Drawing.Size(48, 16);
110 | this.label3.TabIndex = 6;
111 | this.label3.Text = "积分:";
112 | //
113 | // listBox1
114 | //
115 | this.listBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
116 | this.listBox1.FormattingEnabled = true;
117 | this.listBox1.IntegralHeight = false;
118 | this.listBox1.ItemHeight = 16;
119 | this.listBox1.Location = new System.Drawing.Point(319, 12);
120 | this.listBox1.Name = "listBox1";
121 | this.listBox1.Size = new System.Drawing.Size(133, 259);
122 | this.listBox1.TabIndex = 7;
123 | //
124 | // progressBar1
125 | //
126 | this.progressBar1.Location = new System.Drawing.Point(27, 277);
127 | this.progressBar1.Name = "progressBar1";
128 | this.progressBar1.Size = new System.Drawing.Size(285, 24);
129 | this.progressBar1.TabIndex = 8;
130 | //
131 | // label4
132 | //
133 | this.label4.AutoSize = true;
134 | this.label4.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
135 | this.label4.ForeColor = System.Drawing.Color.Red;
136 | this.label4.Location = new System.Drawing.Point(24, 304);
137 | this.label4.Name = "label4";
138 | this.label4.Size = new System.Drawing.Size(89, 19);
139 | this.label4.TabIndex = 9;
140 | this.label4.Text = "上传状态";
141 | //
142 | // button2
143 | //
144 | this.button2.Location = new System.Drawing.Point(389, 277);
145 | this.button2.Name = "button2";
146 | this.button2.Size = new System.Drawing.Size(63, 44);
147 | this.button2.TabIndex = 10;
148 | this.button2.Text = "取消";
149 | this.button2.UseVisualStyleBackColor = true;
150 | //
151 | // pictureBox1
152 | //
153 | this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
154 | this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
155 | this.pictureBox1.Location = new System.Drawing.Point(201, 202);
156 | this.pictureBox1.Name = "pictureBox1";
157 | this.pictureBox1.Size = new System.Drawing.Size(74, 69);
158 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
159 | this.pictureBox1.TabIndex = 11;
160 | this.pictureBox1.TabStop = false;
161 | this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
162 | //
163 | // label5
164 | //
165 | this.label5.AutoSize = true;
166 | this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
167 | this.label5.Location = new System.Drawing.Point(147, 205);
168 | this.label5.Name = "label5";
169 | this.label5.Size = new System.Drawing.Size(48, 16);
170 | this.label5.TabIndex = 12;
171 | this.label5.Text = "图标:";
172 | //
173 | // Form1
174 | //
175 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
176 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
177 | this.ClientSize = new System.Drawing.Size(471, 329);
178 | this.Controls.Add(this.label5);
179 | this.Controls.Add(this.pictureBox1);
180 | this.Controls.Add(this.button2);
181 | this.Controls.Add(this.label4);
182 | this.Controls.Add(this.progressBar1);
183 | this.Controls.Add(this.listBox1);
184 | this.Controls.Add(this.textBox3);
185 | this.Controls.Add(this.label3);
186 | this.Controls.Add(this.textBox2);
187 | this.Controls.Add(this.label2);
188 | this.Controls.Add(this.textBox1);
189 | this.Controls.Add(this.label1);
190 | this.Controls.Add(this.button1);
191 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
192 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
193 | this.Name = "Form1";
194 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
195 | this.Text = "信院下载站 -Home";
196 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
197 | this.Load += new System.EventHandler(this.Form1_Load);
198 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
199 | this.ResumeLayout(false);
200 | this.PerformLayout();
201 |
202 | }
203 |
204 | #endregion
205 |
206 | private System.Windows.Forms.Button button1;
207 | private System.Windows.Forms.TextBox textBox1;
208 | private System.Windows.Forms.Label label1;
209 | private System.Windows.Forms.TextBox textBox2;
210 | private System.Windows.Forms.Label label2;
211 | private System.Windows.Forms.TextBox textBox3;
212 | private System.Windows.Forms.Label label3;
213 | private System.Windows.Forms.ListBox listBox1;
214 | private System.Windows.Forms.ProgressBar progressBar1;
215 | private System.Windows.Forms.Label label4;
216 | private System.Windows.Forms.Button button2;
217 | private System.Windows.Forms.PictureBox pictureBox1;
218 | private System.Windows.Forms.Label label5;
219 | }
220 | }
221 |
222 |
--------------------------------------------------------------------------------
/ftc/jx-upload/LoginForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 |
123 | AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAAAAAAAAAAAAAAAAAAAAA
124 | AACqbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxH/6lr
125 | SP+pa0j/qWtI/6lrSP+pa0j/qWtI/6lrSP+pa0f/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
126 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
127 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
128 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
129 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
130 | SP+qbEj/qmx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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
194 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
195 |
196 |
197 |
--------------------------------------------------------------------------------
/ftc/jx-upload/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 |
123 | iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
124 | wwAADsMBx2+oZAAAAR5JREFUeF7t0DuOwzAMQMHc/9JeF0xh5IO8agl4phMFAdR7HPxMrECsQKxArECs
125 | QKxArGBjrMfTnNfYt9DVTHcQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQ
126 | KxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxAr+LbN7Hs/8/8Xny/ubSpcifXeVLgS672pcPUx
127 | 1mne3c/8/8W3WP9i9n2a6Q5iBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgVi
128 | BWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIF62KdptOyUqeNsdYSKxArECsQKxArEOtnx/EH
129 | HZk3qbEd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bEj/qmxI/6psSP+qbEj/qmxI/6ps
197 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
198 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
199 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
200 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
201 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
202 | SP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6psSP+qbEj/qmxI/6ps
203 | SP+qbEj/qmxI/6psSP+qbEj/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
204 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
205 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
206 |
207 |
208 |
--------------------------------------------------------------------------------
/ftc/jx-upload/Functions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Net;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 | using System.Windows.Forms;
8 |
9 | namespace jx_upload
10 | {
11 | class Functions
12 | {
13 | public static float Version = 1.0F;
14 | internal static string version = "v1.0";
15 | ///
16 | /// 写操作
17 | ///
18 | /// 节
19 | /// 键
20 | /// 值
21 | /// 文件路径
22 | ///
23 | [DllImport("kernel32")]
24 | private static extern long WritePrivateProfileString(string section, string key, string value, string filePath);
25 |
26 | ///
27 | /// 读操作
28 | ///
29 | /// 节
30 | /// 键
31 | /// 未读取到的默认值
32 | /// 读取到的值
33 | /// 大小
34 | /// 路径
35 | ///
36 | [DllImport("kernel32")]
37 | private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
38 |
39 | ///
40 | /// 写入ini文件
41 | ///
42 | /// 节
43 | /// 键
44 | /// 值
45 | /// 文件路径
46 | ///
47 | public static void WriteIni(string section, string key, string value)
48 | {
49 | try
50 | {
51 | string IniFilePath = Application.StartupPath + @"\config.ini";
52 | WritePrivateProfileString(section, key, value, IniFilePath);
53 | }
54 | catch (Exception)
55 | {
56 | return;
57 | }
58 | }
59 |
60 | ///
61 | /// 读ini文件
62 | ///
63 | /// 节
64 | /// 键
65 | /// 未读取到值时的默认值
66 | /// 文件路径
67 | ///
68 | public static string ReadIni(string section, string key)
69 | {
70 | try
71 | {
72 | string IniFilePath = Application.StartupPath + @"\config.ini";
73 | StringBuilder temp = new StringBuilder(255);
74 | int i = GetPrivateProfileString(section, key, "", temp, 255, IniFilePath);
75 | return temp.ToString();
76 | }
77 | catch (Exception)
78 | {
79 | return "";
80 | }
81 |
82 | }
83 | public static string URL = "http://d.icodef.com";//http://127.0.0.1/jx
84 |
85 | private static CookieContainer cookie = new CookieContainer();
86 |
87 | public static string User { get; internal set; }
88 | public static string Pwd { get; internal set; }
89 | ///
90 | /// 关闭进程
91 | ///
92 | /// 进程名
93 | public static void KillProcess(string processName)
94 | {
95 | Process[] myproc = Process.GetProcesses();
96 | foreach (Process item in myproc)
97 | {
98 | if (item.ProcessName == processName)
99 | {
100 | item.Kill();
101 | }
102 | }
103 | }
104 | //强制关闭最近打开的某个进程
105 |
106 | public static void KillRecentProcess(string processName)
107 | {
108 | System.Diagnostics.Process[] Proc = System.Diagnostics.Process.GetProcessesByName(processName);
109 | System.DateTime startTime = new DateTime();
110 | int m, killId = 0;
111 | for (m = 0; m < Proc.Length; m++)
112 | {
113 | if (startTime < Proc[m].StartTime)
114 | {
115 | startTime = Proc[m].StartTime;
116 | killId = m;
117 | }
118 | }
119 | if (Proc[killId].HasExited == false)
120 | {
121 | Proc[killId].Kill();
122 | }
123 |
124 | }
125 | ///
126 | /// Http发送Get请求方法
127 | ///
128 | ///
129 | ///
130 | ///
131 | public static string HttpGet(string Url, string postDataStr = "")
132 | {
133 | try
134 | {
135 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr);
136 | if (cookie.Count == 0)
137 | {
138 | request.CookieContainer = new CookieContainer();
139 | cookie = request.CookieContainer;
140 | }
141 | else
142 | {
143 | request.CookieContainer = cookie;
144 | }
145 | request.Timeout = 2000;
146 | request.Method = "GET";
147 | request.ContentType = "text/html;charset=UTF-8";
148 |
149 | HttpWebResponse response = (HttpWebResponse)request.GetResponse();
150 | Stream myResponseStream = response.GetResponseStream();
151 | StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
152 | string retString = myStreamReader.ReadToEnd();
153 | myStreamReader.Close();
154 | myResponseStream.Close();
155 |
156 | return retString;
157 | }
158 | catch (Exception)
159 | {
160 | return "";
161 | }
162 |
163 |
164 | }
165 | ///
166 | /// Http读文件
167 | ///
168 | ///
169 | ///
170 | public static StreamReader HttpFile(string Url)
171 | {
172 | try
173 | {
174 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
175 | if (cookie.Count == 0)
176 | {
177 | request.CookieContainer = new CookieContainer();
178 | cookie = request.CookieContainer;
179 | }
180 | else
181 | {
182 | request.CookieContainer = cookie;
183 | }
184 | request.Timeout = 2000;
185 | request.Method = "GET";
186 | request.ContentType = "text/html;charset=UTF-8";
187 |
188 | HttpWebResponse response = (HttpWebResponse)request.GetResponse();
189 | Stream myResponseStream = response.GetResponseStream();
190 | StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
191 |
192 | return myStreamReader;
193 | }
194 | catch (Exception)
195 | {
196 | return null;
197 | }
198 |
199 | }
200 | ///
201 | /// Http发送Post请求方法
202 | ///
203 | ///
204 | ///
205 | ///
206 | public static string HttpPost(string Url, string postDataStr = "")
207 | {
208 | try
209 | {
210 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
211 | if (cookie.Count == 0)
212 | {
213 | request.CookieContainer = new CookieContainer();
214 | cookie = request.CookieContainer;
215 | }
216 | else
217 | {
218 | request.CookieContainer = cookie;
219 | }
220 | request.Timeout = 2000;
221 | request.Method = "POST";
222 | request.ContentType = "application/x-www-form-urlencoded";
223 | request.ContentLength = postDataStr.Length;
224 | StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII);
225 | writer.Write(postDataStr);
226 | writer.Flush();
227 | HttpWebResponse response = (HttpWebResponse)request.GetResponse();
228 | string encoding = response.ContentEncoding;
229 | if (encoding == null || encoding.Length < 1)
230 | {
231 | encoding = "UTF-8"; //默认编码
232 | }
233 | StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
234 | string retString = reader.ReadToEnd();
235 | return retString;
236 | }
237 | catch (Exception)
238 | {
239 |
240 | return "";
241 | }
242 |
243 | }
244 |
245 | ///
246 | /// Http上传文件
247 | ///
248 | ///
249 | ///
250 | ///
251 | public static string HttpPostFile(string Url, string filePath)
252 | {
253 | try
254 | {
255 | string retString = "";
256 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
257 | if (cookie.Count == 0)
258 | {
259 | request.CookieContainer = new CookieContainer();
260 | cookie = request.CookieContainer;
261 | }
262 | else
263 | {
264 | request.CookieContainer = cookie;
265 | }
266 | FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
267 | BinaryReader binaryReader = new BinaryReader(fileStream);
268 | string boundary = "------WebKitFormBoundarykaeaJ5vBkUl6AzYd";
269 | string dataFormat = boundary + "\r\nContent-Disposition: form-data; name=\"{0}\";filename=\"{1}\"\r\nContent-Type:application/octet-stream\r\n\r\n";
270 | string header = string.Format(dataFormat, "upfile", Path.GetFileName(filePath));
271 | byte[] postHeaderBytes = Encoding.UTF8.GetBytes(header);
272 | byte[] boundaryBytes = Encoding.ASCII.GetBytes("\r\n------WebKitFormBoundarykaeaJ5vBkUl6AzYd--\r\n");
273 | long length = fileStream.Length + postHeaderBytes.Length + boundaryBytes.Length;
274 | request.ContentLength = length;
275 | request.AllowWriteStreamBuffering = false;
276 | request.Timeout = 15000;
277 | request.Method = "POST";
278 | request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarykaeaJ5vBkUl6AzYd";
279 | try
280 | {
281 | int bufferLength = 4096;
282 | byte[] buffer = new byte[bufferLength];
283 | long offset = 0;
284 | int size = binaryReader.Read(buffer, 0, bufferLength);
285 | Stream postStream = request.GetRequestStream();
286 | postStream.Write(postHeaderBytes, 0, postHeaderBytes.Length);
287 | while (size > 0)
288 | {
289 | postStream.Write(buffer, 0, size);
290 | offset += size;
291 | size = binaryReader.Read(buffer, 0, bufferLength);
292 | }
293 | postStream.Write(boundaryBytes, 0, boundaryBytes.Length);
294 | postStream.Close();
295 |
296 | HttpWebResponse response = (HttpWebResponse)request.GetResponse();
297 | string encoding = response.ContentEncoding;
298 | if (encoding == null || encoding.Length < 1)
299 | {
300 | encoding = "UTF-8"; //默认编码
301 | }
302 | StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
303 | retString = reader.ReadToEnd();
304 | }
305 | catch (Exception ex)
306 | {
307 | Debug.WriteLine("文件传输异常: " + ex.Message);
308 | }
309 | finally
310 | {
311 | fileStream.Close();
312 | binaryReader.Close();
313 | }
314 | return retString;
315 | }
316 | catch (Exception)
317 | {
318 |
319 | return "";
320 | }
321 |
322 | }
323 |
324 | ///
325 | /// 写文件
326 | ///
327 | ///
328 | ///
329 | public static void WriteFile(string path, string content)
330 | {
331 | FileStream fs = new FileStream(path, FileMode.Create);
332 | //获得字节数组
333 | byte[] data = System.Text.Encoding.Default.GetBytes(content);
334 | //开始写入
335 | fs.Write(data, 0, data.Length);
336 | //清空缓冲区、关闭流
337 | fs.Flush();
338 | fs.Close();
339 | }
340 |
341 | ///
342 | /// 删除文件
343 | ///
344 | ///
345 | public static void DeleteFile(string path)
346 | {
347 | File.Delete(path);
348 | }
349 |
350 | public static void RunExe(string path, string parame = "")
351 | {
352 | try
353 | {
354 | Process process = new Process();
355 | process.StartInfo.FileName = path;
356 | process.StartInfo.Arguments = parame;
357 | process.StartInfo.Verb = "runas";
358 | process.StartInfo.UseShellExecute = false;
359 | process.StartInfo.RedirectStandardOutput = true;
360 | process.StartInfo.RedirectStandardInput = true;
361 | process.StartInfo.CreateNoWindow = true;
362 | process.Start();
363 | process.WaitForExit();
364 | process.Close();
365 | }
366 | catch (Exception)
367 | {
368 | throw;
369 | }
370 |
371 | }
372 | public static string URLEncode(string str)
373 | {
374 | return System.Web.HttpUtility.UrlEncode(str);
375 | }
376 | }
377 | }
378 |
--------------------------------------------------------------------------------