@@ -54,7 +54,8 @@ interface
5454 XSuperObject,
5555
5656 Optix.Protocol.Client.Handler, Optix.Protocol.Packet, Optix.Protocol.Preflight, Optix.Protocol.Worker.FileTransfer,
57- Optix.Func.Commands, Optix.Func.Commands.Base, Optix.Actions.ProcessHandler;
57+ Optix.Func.Commands, Optix.Func.Commands.Base, Optix.Actions.ProcessHandler, Optix.Func.Commands.FileSystem,
58+ Optix.Func.Commands.Shell;
5859// ---------------------------------------------------------------------------------------------------------------------
5960
6061type
@@ -125,8 +126,7 @@ implementation
125126
126127 Winapi.Windows,
127128
128- Optix.Func.SessionInformation, Optix.Func.Enum.Process, Optix.Func.LogNotifier, Optix.Func.Enum.FileSystem,
129- Optix.Thread, Optix.Task.ProcessDump, Optix.Func.Shell, Optix.ClassesRegistry;
129+ Optix.Func.SessionInformation, Optix.Func.LogNotifier, Optix.Thread, Optix.Func.Shell, Optix.ClassesRegistry;
130130// ---------------------------------------------------------------------------------------------------------------------
131131
132132{ TOptixSessionHandlerThread.Initialize }
@@ -400,119 +400,56 @@ procedure TOptixSessionHandlerThread.PacketReceived(const ASerializedPacket : IS
400400 if ASerializedPacket.Contains(' WindowGUID' ) then
401401 AWindowGUID := TGUID.Create(ASerializedPacket.S[' WindowGUID' ]);
402402
403- var AOptixPacket : TOptixPacket := nil ;
404- var AHandleMemory : Boolean := False; // TODO: Remove that when migration (Generic) finished
403+ var AOptixPacket : TOptixPacket := nil ;
404+ var AHandleMemory : Boolean := True;
405405 try
406406 try
407- AOptixPacket := TOptixPacket(TClassesRegistry.CreateInstance(AClassName, [TValue.From<ISuperObject>(ASerializedPacket)]));
408- if Assigned(AOptixPacket) then begin
409- // Optix Action Command (& Response)
410- if AOptixPacket is TOptixCommandAction then begin
411- TOptixCommandActionResponse(AOptixPacket).DoAction();
412-
413- // For Action & Response
414- if AOptixPacket is TOptixCommandActionResponse then begin
415- AHandleMemory := True;
416-
417- // /
418- AddPacket(AOptixPacket);
419- end ;
420- // Optix Task Command
421- end else if AOptixPacket is TOptixCommandTask then begin
422- AHandleMemory := True;
423-
424- var ATask := TOptixCommandTask(AOptixPacket).CreateTask(TOptixCommand(AOptixPacket));
425-
426- RegisterAndStartNewTask(ATask);
427- end ;
428- end ;
429-
430- Continuer l' implémentation "générique", y compris à l' intérieur des tasks, afin de rendre l' ensemble le plus
431- générique possible, y compris coté serveur + l' implémenter sur le client GUI.
432-
433- // ---------------------------------------------------------------------------------------------------------------
434- if AClassName = TOptixCommandTerminate.ClassName then
435- Terminate
436- // ---------------------------------------------------------------------------------------------------------------
437- else if AClassName = TOptixCommandRefreshProcess.ClassName then
438- AddPacket(TProcessList.Create(AWindowGUID))
439- // ---------------------------------------------------------------------------------------------------------------
440- else if AClassName = TOptixCommandRefreshDrives.ClassName then
441- AddPacket(TDriveList.Create(AWindowGUID))
442- // ---------------------------------------------------------------------------------------------------------------
443- else if AClassName = TOptixCommandRefreshFiles.ClassName then begin
444- AOptixPacket := TOptixCommandRefreshFiles.Create(ASerializedPacket);
445-
446- AddPacket(TFileList.Create(AWindowGUID, TOptixCommandRefreshFiles(AOptixPacket).Path));
447- end
448- // ---------------------------------------------------------------------------------------------------------------
449- else if AClassName = TOptixCommandDownloadFile.ClassName then
450- RegisterNewFileTransfer(TOptixCommandDownloadFile.Create(ASerializedPacket))
451- // ---------------------------------------------------------------------------------------------------------------
452- else if AClassName = TOptixCommandUploadFile.ClassName then
453- RegisterNewFileTransfer(TOptixCommandUploadFile.Create(ASerializedPacket))
454- // ---------------------------------------------------------------------------------------------------------------
455- else if AClassName = TOptixStartShellInstance.ClassName then begin
456- AOptixPacket := TOptixStartShellInstance.Create(ASerializedPacket);
457-
458- RegisterAndStartNewShellInstance(TOptixStartShellInstance(AOptixPacket));
459- end
460- // ---------------------------------------------------------------------------------------------------------------
461- else if AClassName = TOptixTerminateShellInstance.ClassName then begin
462- AOptixPacket := TOptixTerminateShellInstance.Create(ASerializedPacket);
463-
464- TerminateShellInstance(TOptixTerminateShellInstance(AOptixPacket));
465- end
466- // ---------------------------------------------------------------------------------------------------------------
467- else if AClassName = TOptixBreakShellInstance.ClassName then begin
468- AOptixPacket := TOptixBreakShellInstance.Create(ASerializedPacket);
469-
470- BreakShellInstance(TOptixBreakShellInstance(AOptixPacket));
471- end
472- // ---------------------------------------------------------------------------------------------------------------
473- else if AClassName = TOptixStdinShellInstance.ClassName then begin
474- AOptixPacket := TOptixStdinShellInstance.Create(ASerializedPacket);
475-
476- StdinToShellInstance(TOptixStdinShellInstance(AOptixPacket));
477- end
478- // ---------------------------------------------------------------------------------------------------------------
479-
480- // ---------------------------------------------------------------------------------------------------------------
481-
482- // ---------------------------------------------------------------------------------------------------------------
483-
484- // ---------------------------------------------------------------------------------------------------------------
485-
486- // ---------------------------------------------------------------------------------------------------------------
487-
488- // ---------------------------------------------------------------------------------------------------------------
489-
490- // ---------------------------------------------------------------------------------------------------------------
491-
492- // ---------------------------------------------------------------------------------------------------------------
493-
494- // ---------------------------------------------------------------------------------------------------------------
495-
496- // ---------------------------------------------------------------------------------------------------------------
497-
498- // ---------------------------------------------------------------------------------------------------------------
499-
500- // ---------------------------------------------------------------------------------------------------------------
501-
502- // ---------------------------------------------------------------------------------------------------------------
503-
504- // ---------------------------------------------------------------------------------------------------------------
407+ AOptixPacket := TOptixPacket(TClassesRegistry.CreateInstance(AClassName, [
408+ TValue.From<ISuperObject>(ASerializedPacket)
409+ ]));
410+ if not Assigned(AOptixPacket) then
411+ Exit();
412+ // /
505413
506- // ---------------------------------------------------------------------------------------------------------------
414+ // Optix Action Command (& Response)
415+ if AOptixPacket is TOptixCommandAction then begin
416+ TOptixCommandActionResponse(AOptixPacket).DoAction();
507417
508- // ---------------------------------------------------------------------------------------------------------------
418+ // For Action & Response
419+ if AOptixPacket is TOptixCommandActionResponse then begin
509420
510- // ---------------------------------------------------------------------------------------------------------------
421+ // /
422+ AddPacket(AOptixPacket);
423+ end ;
424+ // Optix Task Command
425+ end else if AOptixPacket is TOptixCommandTask then begin
426+ var ATask := TOptixCommandTask(AOptixPacket).CreateTask(TOptixCommand(AOptixPacket));
511427
512- // ---------------------------------------------------------------------------------------------------------------
428+ // /
429+ RegisterAndStartNewTask(ATask);
430+ // Optix Transfers (Download & Upload)
431+ end else if AOptixPacket is TOptixCommandTransfer then
432+ RegisterNewFileTransfer(TOptixCommandTransfer(AOptixPacket))
433+ // Shell Coammdns
434+ else if AOptixPacket is TOptixCommandShell then begin
435+ if AOptixPacket is TOptixStartShellInstance then
436+ RegisterAndStartNewShellInstance(TOptixStartShellInstance(AOptixPacket))
437+ else if AOptixPacket is TOptixTerminateShellInstance then
438+ TerminateShellInstance(TOptixTerminateShellInstance(AOptixPacket))
439+ else if AOptixPacket is TOptixBreakShellInstance then
440+ BreakShellInstance(TOptixBreakShellInstance(AOptixPacket))
441+ else if AOptixPacket is TOptixStdinShellInstance then
442+ StdinToShellInstance(TOptixStdinShellInstance(AOptixPacket));
443+ // Simple Commands
444+ end else if AOptixPacket is TOptixSimpleCommand then begin
445+ AHandleMemory := False;
446+ // /
513447
514- // ---------------------------------------------------------------------------------------------------------------
515- // ... //
448+ // -------------------------------------------------------------------------------------------------------------
449+ if AOptixPacket is TOptixCommandTerminate then
450+ Terminate;
451+ // -------------------------------------------------------------------------------------------------------------
452+ end ;
516453 except
517454 on E : Exception do
518455 AddPacket(TLogNotifier.Create(E.Message, AClassName, lkException));
0 commit comments