1212import psutil
1313from prettytable import PrettyTable
1414
15- from logicytics import Log , Execute , Check , Get , FileManagement , Flag , DEBUG , DELETE_LOGS , config
15+ from logicytics import Log , execute , check , get , file_management , flag , DEBUG , DELETE_LOGS , config
1616
1717# Initialization
1818log = Log ({"log_level" : DEBUG , "delete_log" : DELETE_LOGS })
@@ -66,7 +66,7 @@ def __generate_execution_list(self) -> list[str]:
6666 - Logs the final execution list for debugging purposes
6767 - Warns users about potential long execution times for certain actions
6868 """
69- execution_list = Get .list_of_files ("." , only_extensions = (".py" , ".exe" , ".ps1" , ".bat" ),
69+ execution_list = get .list_of_files ("." , only_extensions = (".py" , ".exe" , ".ps1" , ".bat" ),
7070 exclude_files = ["Logicytics.py" ],
7171 exclude_dirs = ["logicytics" , "SysInternal_Suite" ])
7272 files_to_remove = {
@@ -101,7 +101,7 @@ def __generate_execution_list(self) -> list[str]:
101101
102102 elif ACTION == "modded" :
103103 # Add all files in MODS to execution list
104- execution_list = Get .list_of_files ("../MODS" , only_extensions = (".py" , ".exe" , ".ps1" , ".bat" ),
104+ execution_list = get .list_of_files ("../MODS" , only_extensions = (".py" , ".exe" , ".ps1" , ".bat" ),
105105 append_file_list = execution_list , exclude_files = ["Logicytics.py" ],
106106 exclude_dirs = ["logicytics" , "SysInternal_Suite" ])
107107
@@ -144,7 +144,7 @@ def __script_handler(script: str) -> tuple[str, Exception | None]:
144144 """
145145 log .debug (f"Executing { script } " )
146146 try :
147- log .execution (Execute .script (script ))
147+ log .execution (execute .script (script ))
148148 log .info (f"{ script } executed successfully" )
149149 return script , None
150150 except Exception as err :
@@ -207,7 +207,7 @@ def __performance(self):
207207 gc .collect ()
208208 start_time = datetime .now ()
209209 start_memory = process .memory_full_info ().uss / 1024 / 1024 # MB
210- log .execution (Execute .script (self .execution_list [file ]))
210+ log .execution (execute .script (self .execution_list [file ]))
211211 end_time = datetime .now ()
212212 end_memory = process .memory_full_info ().uss / 1024 / 1024 # MB
213213 elapsed_time = end_time - start_time
@@ -352,7 +352,7 @@ def get_flags():
352352 """
353353 global ACTION , SUB_ACTION
354354 # Get flags_list
355- ACTION , SUB_ACTION = Flag .data ()
355+ ACTION , SUB_ACTION = flag .data ()
356356 log .debug (f"Action: { ACTION } " )
357357 log .debug (f"Sub-Action: { SUB_ACTION } " )
358358
@@ -382,7 +382,7 @@ def handle_special_actions():
382382 log .info ("Opening debug menu..." )
383383 SpecialAction .execute_new_window ("_debug.py" )
384384
385- messages = Check .sys_internal_zip ()
385+ messages = check .sys_internal_zip ()
386386 if messages :
387387 # If there are messages, log them with debug
388388 log .debug (messages )
@@ -407,7 +407,7 @@ def handle_special_actions():
407407 "Sorry, this feature is yet to be implemented. You can manually Restore your backups, We will open "
408408 "the location for you"
409409 )
410- FileManagement .open_file ("../ACCESS/BACKUP/" )
410+ file_management .open_file ("../ACCESS/BACKUP/" )
411411 input ("Press Enter to exit..." )
412412 exit (1 )
413413
@@ -438,7 +438,7 @@ def check_privileges():
438438 - Depends on global `DEBUG` configuration variable
439439 - Logs warnings or critical messages based on privilege and UAC status
440440 """
441- if not Check .admin ():
441+ if not check .admin ():
442442 if DEBUG == "DEBUG" :
443443 log .warning ("Running in debug mode, continuing without admin privileges - This may cause issues" )
444444 else :
@@ -447,7 +447,7 @@ def check_privileges():
447447 input ("Press Enter to exit..." )
448448 exit (1 )
449449
450- if Check .uac ():
450+ if check .uac ():
451451 log .warning ("UAC is enabled, this may cause issues - Please disable UAC if possible" )
452452
453453
@@ -462,7 +462,7 @@ def files(cls):
462462 @staticmethod
463463 def __and_log (directory : str , name : str ):
464464 log .debug (f"Zipping directory '{ directory } ' with name '{ name } ' under action '{ ACTION } '" )
465- zip_values = FileManagement .Zip .and_hash (
465+ zip_values = file_management .Zip .and_hash (
466466 directory ,
467467 name ,
468468 ACTION if ACTION is not None else f"ERROR_NO_ACTION_SPECIFIED_{ datetime .now ().isoformat ()} "
@@ -530,9 +530,10 @@ def Logicytics():
530530 try :
531531 Logicytics ()
532532 except KeyboardInterrupt :
533- log .warning ("⚠️ Force shutdown detected! Some temporary files might be left behind." )
534- log .warning ("💡 Pro tip: Next time, let the program finish naturally." )
535- # TODO v3.4.2 -> Cleanup function
533+ log .warning ("Force shutdown detected! Some temporary files might be left behind." )
534+ log .warning ("Next time, let the program finish naturally for complete cleanup." )
535+ # Emergency cleanup - zip generated files
536+ ZIP .files ()
536537 exit (0 )
537538else :
538539 log .error ("This script cannot be imported!" )
0 commit comments