no message

This commit is contained in:
2024-05-18 23:31:45 +03:00
parent d29c2ba93c
commit fb53a4133a
10 changed files with 129 additions and 21 deletions

View File

@@ -0,0 +1,46 @@
package Visual_DVM_2021.Passes.All;
import Common.UI.Windows.Dialog.Text.ReadOnlyMultilineTextForm;
import Common.Utils.Utils;
import GlobalData.RemoteFile.RemoteFile;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import Visual_DVM_2021.Passes.PassException;
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.util.List;
import java.util.Vector;
public class ShowTestingServerFile extends TestingSystemPass<RemoteFile> {
String title;
File localFile;
@Override
protected boolean canStart(Object... args) throws Exception {
title = (String) args[0];
target = (RemoteFile) args[1];
return true;
}
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveFile, target.full_name));
localFile = Utils.getTempFileName(target.name);
if (response.object != null)
response.Unpack(localFile);
else throw new PassException("Файл не найден");
}
@Override
protected boolean validate() {
return localFile.exists();
}
@Override
protected void showDone() throws Exception {
ReadOnlyMultilineTextForm ff = new ReadOnlyMultilineTextForm();
List<String> lines = FileUtils.readLines(localFile);
Vector<String> res = new Vector<>();
for (int i = lines.size() - 1; i >= 0; i--)
res.add(lines.get(i));
ff.ShowDialog(title,
String.join("\n", res)
);
}
}