/// <summary> /// Use to Download all folders, files from server /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Download_Btn_Click(object sender, RoutedEventArgs e) { try { Ethernet.Ip = IP.Text; Ethernet.Port = Port.Text; Ethernet.Connect(); } catch (Exception ex) { Global.mw.appendReportText("Failed to connect to Server {0}:{1}", IP.Text, Port.Text); } FileObject downloadObj = new FileObject(); downloadObj.filename = "FileTable.json"; downloadObj.mode = "SYNCBACK"; downloadObj.status = "PROCESSING"; download.drive = FolderName.Text.Substring(0, FolderName.Text.IndexOf(":") + 2); string json = JsonConvert.SerializeObject(downloadObj); Ethernet.SendData(json); }
private void Sync_Btn_Click(object sender, RoutedEventArgs e) { appendReportText("== Saving Setting =="); SaveSetting(); try { Ethernet.Ip = IP.Text; Ethernet.Port = Port.Text; Ethernet.Connect(); } catch (Exception ex) { Global.mw.appendReportText("Failed to connect to Server {0}:{1}", IP.Text, Port.Text); } /////////// Send Folder To Sync /////////// /// FileObject folderInfo = new FileObject(); string dirName = System.IO.Path.GetFileName(FolderName.Text); folderInfo.filename = dirName; folderInfo.mode = "LOCATION"; folderInfo.status = ""; string json = JsonConvert.SerializeObject(folderInfo); Ethernet.SendData(json); Global.location = dirName; //string current_path = FolderName.Text.Substring(FolderName.Text.IndexOf(":") + 2, // FolderName.Text.Length - 3); // Remove *:/ Console.WriteLine(FolderName.Text); upload.isDone = 1; Global.watcher.location = dirName; Global.watcher.start(); //Watcher.drive = FolderName.Text.Substring(0, FolderName.Text.IndexOf(":") + 2); //Global._upload.FileName.filename = "plate0638718.jpg"; //Global._upload.FileName.mode = "UPLOAD"; //Global._upload.FileName.status = "PROCESSING"; //Console.WriteLine(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); //Global._upload.Do_Upload(); //Global._download.FileName.filename = "0000_02187_b.jpg"; //Global._download.FileName.mode = "DOWNLOAD"; //Global._download.FileName.status = "PROCESSING"; //Global._download.DoDownload(); }