package _VisualDVM.Passes.All;
import Common.Utils.Utils_;
import _VisualDVM.ComponentsServer.Component.Component;
import _VisualDVM.Global;
import _VisualDVM.Passes.Server.ComponentsServerPass;
import _VisualDVM.Repository.Server.ServerCode;
public class DownloadComponent extends ComponentsServerPass<Component> {
    @Override
    protected boolean isSafe() {
        return false;
    }
    @Override
    protected boolean canStart(Object... args) throws Exception {
        target = Global.components.getUI().getCurrent();
        String packed = target.getComponentType() + "\n" + target.getFileName();
        return SendRequest(ServerCode.ReceiveComponent, packed);
    }
    @Override
    protected void body() throws Exception {
        Utils_.bytesToFile((byte[]) request.server_response.object, target.getNewFile());
    }
}
