add: file_num offset
This commit is contained in:
parent
9dbd94daac
commit
a2bc2a21bb
@ -294,6 +294,7 @@ message FileTransferSendRequest {
|
|||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
string path = 2;
|
string path = 2;
|
||||||
bool include_hidden = 3;
|
bool include_hidden = 3;
|
||||||
|
int32 file_num = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message FileTransferSendConfirmRequest {
|
message FileTransferSendConfirmRequest {
|
||||||
@ -322,6 +323,7 @@ message FileTransferReceiveRequest {
|
|||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
string path = 2; // path written to
|
string path = 2; // path written to
|
||||||
repeated FileEntry files = 3;
|
repeated FileEntry files = 3;
|
||||||
|
int32 file_num = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message FileRemoveDir {
|
message FileRemoveDir {
|
||||||
|
@ -270,6 +270,7 @@ impl TransferJob {
|
|||||||
id: i32,
|
id: i32,
|
||||||
remote: String,
|
remote: String,
|
||||||
path: String,
|
path: String,
|
||||||
|
file_num: i32,
|
||||||
show_hidden: bool,
|
show_hidden: bool,
|
||||||
is_remote: bool,
|
is_remote: bool,
|
||||||
files: Vec<FileEntry>,
|
files: Vec<FileEntry>,
|
||||||
@ -281,6 +282,7 @@ impl TransferJob {
|
|||||||
id,
|
id,
|
||||||
remote,
|
remote,
|
||||||
path: get_path(&path),
|
path: get_path(&path),
|
||||||
|
file_num,
|
||||||
show_hidden,
|
show_hidden,
|
||||||
is_remote,
|
is_remote,
|
||||||
files,
|
files,
|
||||||
@ -294,6 +296,7 @@ impl TransferJob {
|
|||||||
id: i32,
|
id: i32,
|
||||||
remote: String,
|
remote: String,
|
||||||
path: String,
|
path: String,
|
||||||
|
file_num: i32,
|
||||||
show_hidden: bool,
|
show_hidden: bool,
|
||||||
is_remote: bool,
|
is_remote: bool,
|
||||||
include_hidden: bool,
|
include_hidden: bool,
|
||||||
@ -306,6 +309,7 @@ impl TransferJob {
|
|||||||
id,
|
id,
|
||||||
remote,
|
remote,
|
||||||
path: get_path(&path),
|
path: get_path(&path),
|
||||||
|
file_num,
|
||||||
show_hidden,
|
show_hidden,
|
||||||
is_remote,
|
is_remote,
|
||||||
files,
|
files,
|
||||||
@ -645,12 +649,13 @@ pub fn new_send_confirm(r: FileTransferSendConfirmRequest) -> Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_receive(id: i32, path: String, files: Vec<FileEntry>) -> Message {
|
pub fn new_receive(id: i32, path: String, file_num: i32, files: Vec<FileEntry>) -> Message {
|
||||||
let mut action = FileAction::new();
|
let mut action = FileAction::new();
|
||||||
action.set_receive(FileTransferReceiveRequest {
|
action.set_receive(FileTransferReceiveRequest {
|
||||||
id,
|
id,
|
||||||
path,
|
path,
|
||||||
files: files.into(),
|
files: files.into(),
|
||||||
|
file_num,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
let mut msg_out = Message::new();
|
let mut msg_out = Message::new();
|
||||||
@ -659,13 +664,14 @@ pub fn new_receive(id: i32, path: String, files: Vec<FileEntry>) -> Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_send(id: i32, path: String, include_hidden: bool) -> Message {
|
pub fn new_send(id: i32, path: String, file_num: i32, include_hidden: bool) -> Message {
|
||||||
log::info!("new send: {},id : {}", path, id);
|
log::info!("new send: {},id : {}", path, id);
|
||||||
let mut action = FileAction::new();
|
let mut action = FileAction::new();
|
||||||
action.set_send(FileTransferSendRequest {
|
action.set_send(FileTransferSendRequest {
|
||||||
id,
|
id,
|
||||||
path,
|
path,
|
||||||
include_hidden,
|
include_hidden,
|
||||||
|
file_num,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
let mut msg_out = Message::new();
|
let mut msg_out = Message::new();
|
||||||
|
@ -1313,7 +1313,7 @@ pub enum Data {
|
|||||||
Close,
|
Close,
|
||||||
Login((String, bool)),
|
Login((String, bool)),
|
||||||
Message(Message),
|
Message(Message),
|
||||||
SendFiles((i32, String, String, bool, bool)),
|
SendFiles((i32, String, String, i32, bool, bool)),
|
||||||
RemoveDirAll((i32, String, bool)),
|
RemoveDirAll((i32, String, bool)),
|
||||||
ConfirmDeleteFiles((i32, i32)),
|
ConfirmDeleteFiles((i32, i32)),
|
||||||
SetNoConfirm(i32),
|
SetNoConfirm(i32),
|
||||||
|
@ -44,6 +44,7 @@ pub enum FS {
|
|||||||
NewWrite {
|
NewWrite {
|
||||||
path: String,
|
path: String,
|
||||||
id: i32,
|
id: i32,
|
||||||
|
file_num: i32,
|
||||||
files: Vec<(String, u64)>,
|
files: Vec<(String, u64)>,
|
||||||
},
|
},
|
||||||
CancelWrite {
|
CancelWrite {
|
||||||
|
@ -974,7 +974,7 @@ impl Connection {
|
|||||||
let id = s.id;
|
let id = s.id;
|
||||||
let od =
|
let od =
|
||||||
can_enable_overwrite_detection(get_version_number(VERSION));
|
can_enable_overwrite_detection(get_version_number(VERSION));
|
||||||
match fs::TransferJob::new_read(id, s.path.clone(), s.include_hidden, od) {
|
match fs::TransferJob::new_read(id, s.path.clone(), s.file_num, s.include_hidden, od) {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
self.send(fs::new_error(id, err, 0)).await;
|
self.send(fs::new_error(id, err, 0)).await;
|
||||||
}
|
}
|
||||||
@ -990,6 +990,7 @@ impl Connection {
|
|||||||
self.send_fs(ipc::FS::NewWrite {
|
self.send_fs(ipc::FS::NewWrite {
|
||||||
path: r.path,
|
path: r.path,
|
||||||
id: r.id,
|
id: r.id,
|
||||||
|
file_num: r.file_num,
|
||||||
files: r
|
files: r
|
||||||
.files
|
.files
|
||||||
.to_vec()
|
.to_vec()
|
||||||
|
@ -158,14 +158,17 @@ impl ConnectionManager {
|
|||||||
ipc::FS::NewWrite {
|
ipc::FS::NewWrite {
|
||||||
path,
|
path,
|
||||||
id,
|
id,
|
||||||
|
file_num,
|
||||||
mut files,
|
mut files,
|
||||||
} => {
|
} => {
|
||||||
let od = can_enable_overwrite_detection(get_version_number(VERSION));
|
let od = can_enable_overwrite_detection(get_version_number(VERSION));
|
||||||
// cm has no show_hidden context
|
// cm has no show_hidden context
|
||||||
|
// dummy remote, show_hidden, is_remote
|
||||||
write_jobs.push(fs::TransferJob::new_write(
|
write_jobs.push(fs::TransferJob::new_write(
|
||||||
id,
|
id,
|
||||||
"".to_string(),
|
"".to_string(),
|
||||||
path,
|
path,
|
||||||
|
file_num,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
files
|
files
|
||||||
|
@ -125,7 +125,7 @@ class JobTable: Reactor.Component {
|
|||||||
include_hidden: show_hidden,
|
include_hidden: show_hidden,
|
||||||
is_remote: is_remote });
|
is_remote: is_remote });
|
||||||
this.job_map[id] = this.jobs[this.jobs.length - 1];
|
this.job_map[id] = this.jobs[this.jobs.length - 1];
|
||||||
handler.send_files(id, path, to, show_hidden, is_remote);
|
handler.send_files(id, path, to, 0, show_hidden, is_remote);
|
||||||
var self = this;
|
var self = this;
|
||||||
self.timer(30ms, function() { self.update(); });
|
self.timer(30ms, function() { self.update(); });
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ class JobTable: Reactor.Component {
|
|||||||
this.jobs.push(job);
|
this.jobs.push(job);
|
||||||
this.job_map[id] = this.jobs[this.jobs.length - 1];
|
this.job_map[id] = this.jobs[this.jobs.length - 1];
|
||||||
jobIdCounter = id + 1;
|
jobIdCounter = id + 1;
|
||||||
handler.send_files(id, path, to, show_hidden, is_remote);
|
handler.send_files(id, path, to, file_num, show_hidden, is_remote);
|
||||||
stdout.println(JSON.stringify(job));
|
stdout.println(JSON.stringify(job));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ impl sciter::EventHandler for Handler {
|
|||||||
fn confirm_delete_files(i32, i32);
|
fn confirm_delete_files(i32, i32);
|
||||||
fn set_no_confirm(i32);
|
fn set_no_confirm(i32);
|
||||||
fn cancel_job(i32);
|
fn cancel_job(i32);
|
||||||
fn send_files(i32, String, String, bool, bool);
|
fn send_files(i32, String, String, i32, bool, bool);
|
||||||
fn get_platform(bool);
|
fn get_platform(bool);
|
||||||
fn get_path_sep(bool);
|
fn get_path_sep(bool);
|
||||||
fn get_icon_path(i32, String);
|
fn get_icon_path(i32, String);
|
||||||
@ -1586,16 +1586,16 @@ impl Remote {
|
|||||||
Data::Message(msg) => {
|
Data::Message(msg) => {
|
||||||
allow_err!(peer.send(&msg).await);
|
allow_err!(peer.send(&msg).await);
|
||||||
}
|
}
|
||||||
Data::SendFiles((id, path, to, include_hidden, is_remote)) => {
|
Data::SendFiles((id, path, to,file_num, include_hidden, is_remote)) => {
|
||||||
log::info!("send files, is remote {}", is_remote);
|
log::info!("send files, is remote {}", is_remote);
|
||||||
let od = can_enable_overwrite_detection(self.handler.lc.read().unwrap().version);
|
let od = can_enable_overwrite_detection(self.handler.lc.read().unwrap().version);
|
||||||
if is_remote {
|
if is_remote {
|
||||||
log::debug!("New job {}, write to {} from remote {}", id, to, path);
|
log::debug!("New job {}, write to {} from remote {}", id, to, path);
|
||||||
self.write_jobs
|
self.write_jobs
|
||||||
.push(fs::TransferJob::new_write(id, path.clone(),to,include_hidden, is_remote, Vec::new(), od));
|
.push(fs::TransferJob::new_write(id, path.clone(),to,file_num, include_hidden, is_remote, Vec::new(), od));
|
||||||
allow_err!(peer.send(&fs::new_send(id, path, include_hidden)).await);
|
allow_err!(peer.send(&fs::new_send(id, path,file_num, include_hidden)).await);
|
||||||
} else {
|
} else {
|
||||||
match fs::TransferJob::new_read(id, path.clone(),to.clone(),include_hidden,is_remote, include_hidden, od) {
|
match fs::TransferJob::new_read(id, path.clone(),to.clone(), file_num,include_hidden,is_remote, include_hidden, od) {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
self.handle_job_status(id, -1, Some(err.to_string()));
|
self.handle_job_status(id, -1, Some(err.to_string()));
|
||||||
}
|
}
|
||||||
@ -1612,7 +1612,7 @@ impl Remote {
|
|||||||
let files = job.files().clone();
|
let files = job.files().clone();
|
||||||
self.read_jobs.push(job);
|
self.read_jobs.push(job);
|
||||||
self.timer = time::interval(MILLI1);
|
self.timer = time::interval(MILLI1);
|
||||||
allow_err!(peer.send(&fs::new_receive(id, to, files)).await);
|
allow_err!(peer.send(&fs::new_receive(id, to, file_num, files)).await);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user