def Kernel(crashed, Crash_Information, running): Hotkey.SystemHotkeys() Hotkey.CheckHotkey() if not running: Shutdown() if Do_Input: Read_Keyboard()
def Command_Executer(command): global running, Do_Input disable = False Len_Command = len(command) if command == "shutdown": disable = True if input("Do you want to shutdown?(y/n)") == "y": print("shutting down the os") Shutdown() if command == "reload": if input("Do you want to reload?(y/n)") == "y": print("Reloading the os\n" "Do not press any key\n" "Continuing in 2 seconds\n") time.sleep(2) running = False disable = True Reload() if command == "restart": if input("Do you want to restart?(y/n)") == "y": print("Restarting the os\n" "Do not press any key\n" "Continuing in 2 seconds\n") time.sleep(2) disable = True Reboot() if command == "clear": Clear() disable = True if command == "hotkey": disable = True count = 0 while count != 500: CheckForHotkey() count += 1 time.sleep(0.0000001) if command == "exit": Do_Input = False disable = True Hotkey.Toggle() if command == "crash": disable = True CrashHandler.CrashHandler("User_Started_Screen_Of_Death", True) if command[0:3] == "run": command = command[4:Len_Command] output = "" Register.Find_In_Register(command, output) disable = True else: if not disable: print("invalid syntax")
def Boot(): DoBoot = open("Cos/Cos64/Settings/Boot.ini", "r") DoBootContents = DoBoot.read() DoBoot.close() if DoBootContents == "Boot=True": DoBootFormat = True else: DoBootFormat = False if DoBootFormat: print("Press ] to open boot-settings") count = 0 while count != 500: Hotkey.While_Boot() count += 1 time.sleep(0.00000001) Kernel.Setup() Kernel.startup() if not DoBootFormat: CrashHandler.CrashHandler()
def Command_Executer(command): global running, Do_Input, Path disable = False Len_Command = len(command) if command == "shutdown": disable = True if input("Do you want to shutdown?(y/n)") == "y": print("shutting down the os") Shutdown() if command == "reload": if input("Do you want to reload?(y/n)") == "y": print("Reloading the os\n" "Do not press any key\n" "Continuing in 2 seconds\n") time.sleep(2) running = False disable = True Reload() if command == "restart": if input("Do you want to restart?(y/n)") == "y": print("Restarting the os\n" "Do not press any key\n" "Continuing in 2 seconds\n") time.sleep(2) disable = True Reboot() if command == "clear": Clear() disable = True if command == "hotkey": disable = True count = 0 while count != 500: CheckForHotkey() count += 1 time.sleep(0.0000001) if command == "exit": Do_Input = False disable = True Hotkey.Toggle() if command == "crash": disable = True CrashHandler.CrashHandler("User_Started_Screen_Of_Death", True) if command[0:3] == "run": from Cos.Cos64 import Register command = command[4:Len_Command] output = "" Register.Find_In_Register(command, output) disable = True # if command[0:2] == "cd": # Path = command[3:Len_Command] # try: # os.listdir("." + Path) # except (NotADirectoryError, FileNotFoundError, FileExistsError): # print(colored("could not change directory", "red")) # if Path == "": # Path = "/" # disable = True # if command[0:2] == "ls": # ls = "" # if command[0:2] == command: # Path = str("/" + Path) # print(Path) # else: # Path = command[3:Len_Command] # if Path == "./": # Path = "" # try: # ls = os.listdir("." + Path) # except NotADirectoryError: # print(colored("The givin path doesn't lead to a file", "red")) # except (FileExistsError, FileNotFoundError): # print(colored("Could not find folder", "red")) # Ls_Len = len(ls) # Ls_Index = "" # countls = 0 # while countls != Ls_Len: # Ls_Index = Ls_Index + str(ls[countls] + "\n") # countls += 1 # print(Ls_Index) # disable = True # # if command[0:5] == "mkdir": # Mkdir_Name = command[6:Len_Command] # try: # os.mkdir(str(Path + Mkdir_Name)) # print("Successfully made " + str(Mkdir_Name) + " at " + Path + "!") # except FileNotFoundError: # print("Ilegal path") if command == "help" or command == "?": try: Doc = open("Cos/doc.txt", "r") Doc_Contents = Doc.read() print(Doc_Contents) disable = True Doc.close() except FileExistsError: print("Could not find file") if command[0:13] == "addtoregister": Name = command[14:Len_Command] Location = input("File location ") File = input("File to run ") print("After adding the os needs to be restarted manual before use") addToRegister(Name, Location, File) else: if not disable: print("invalid syntax")
def CheckForHotkey(): Hotkey.CheckHotkey()