Example #1
0
def GetAppDataFromAppName(AppName):
    Path = "{1}{0}".format(AppName, TaiyouPath_AppDataFolder)

    # Check if path exists
    if not CoreUtils.Directory_Exists(Path):
        CoreUtils.Directory_MakeDir(Path)

    return Path
Example #2
0
    def LoadImage(self, ImagePath, Transparency=False):
        """
        Load the Specified Image
        :param ImagePath:Path to the Specified Image
        :param Transparency:Bool Value to import with transparency or not
        :return:
        """
        if UTILS.Directory_Exists(ImagePath):
            self.Images_Name.append(Core.TaiyouPath_CorrectSlash +
                                    os.path.basename(ImagePath))

            if Transparency:
                self.Images_Data.append(
                    pygame.image.load(ImagePath).convert_alpha())

            else:
                self.Images_Data.append(pygame.image.load(ImagePath).convert())
Example #3
0
    def ApplicationInstallingUpdateProgress(self):
        print("Instalation Progress Update\nStep: {0}".format(str(self.PackpageInstalationStep)))
        PackpagePath = CorePaths.TaiyouPath_UserPackpagesPath + self.SelectedPackpage + self.ContentManager.Get_RegKey("/packpage_file_format")

        # Check if File exists
        if self.PackpageInstalationStep == 1:
            if self.SelectedPackpage == "" or not CoreUtils.File_Exists(PackpagePath):
                self.FinishInstalation()

        elif self.PackpageInstalationStep == 2:  # Check if Extract Path exists and clean it
            print("Packpage : {0}".format(self.SelectedPackpage))
            self.ExtractPath = CorePaths.TaiyouPath_UserTempFolder + self.SelectedPackpage
            print("ExtractPath : " + self.ExtractPath)

            # Check if Extract Path Exists
            if CoreUtils.Directory_Exists(self.ExtractPath):
                print("Extraction Path Exists, Directory Removed and Re-Created")
                CoreUtils.Directory_Remove(self.ExtractPath)
                CoreUtils.Directory_MakeDir(self.ExtractPath)

        elif self.PackpageInstalationStep == 3:  # Extract the Packpage
            # Extract the Zip File
            print("Un-Zipping packpage....")
            CoreUtils.Unzip_File(PackpagePath, self.ExtractPath)

        elif self.PackpageInstalationStep == 4:  # Check if Packpage is Valid
            print("Check for app and data folder on extracted path")
            self.AppFolderPath = self.ExtractPath + CorePaths.TaiyouPath_CorrectSlash + "app" + CorePaths.TaiyouPath_CorrectSlash
            self.DataFolderPath = self.ExtractPath + CorePaths.TaiyouPath_CorrectSlash + "data" + CorePaths.TaiyouPath_CorrectSlash
            AppFolderExists = CoreUtils.Directory_Exists(self.AppFolderPath)
            DataFolderExists = CoreUtils.Directory_Exists(self.DataFolderPath)

            if not AppFolderExists or not DataFolderExists:
                self.FinishInstalation(True)
                self.SetStatusText(self.ContentManager.Get_RegKey("/strings/invalid_taiyou_packpage"))

        elif self.PackpageInstalationStep == 5:  # Check if Application Already Exists
            AppFolderInsideIt = os.listdir(self.AppFolderPath)[0]
            CheckPath = CorePaths.TaiyouPath_ApplicationsFolder + AppFolderInsideIt
            if CoreUtils.Directory_Exists(CheckPath) and not self.IgnorePackpageReplace:
                self.PackpageReplaceWarning = True
                return

            if self.IgnorePackpageReplace:
                print("Package will replace, check for conflicting directories...")
                FolderInAppPath = os.listdir(self.AppFolderPath)
                for folder in FolderInAppPath:
                    # Check if folder exists
                    CheckPath = ''.join((CorePaths.TaiyouPath_ApplicationsFolder, folder))
                    if CheckPath == CorePaths.TaiyouPath_ApplicationsFolder:
                        print("WARNING : This function almost deleted all of your installed applications.\nWe have an protection to prevent this.")
                        continue

                    print("CheckPath : " + CheckPath)
                    if CoreUtils.Directory_Exists(CheckPath):
                        print("Detected conflict between installed application folder.\nDeleting current existing folder.")
                        CoreUtils.Directory_Remove(CheckPath)

                FolderInDataPath = os.listdir(self.DataFolderPath)
                for folder in FolderInDataPath:
                    # Check if folder exists
                    CheckPath = ''.join((CorePaths.TaiyouPath_ApplicationsDataPath, folder))
                    if CheckPath == CorePaths.TaiyouPath_ApplicationsDataPath:
                        print("WARNING : This function almost deleted all of your installed applications data.\nWe have an protection to prevent this.")
                        continue

                    print("CheckPath : " + CheckPath)
                    if CoreUtils.Directory_Exists(CheckPath):
                        print("Detected conflict between installed application data folder.\nDeleting current existing folder.")
                        CoreUtils.Directory_Remove(CheckPath)

            print("Copy Application to Application Folder...")
            CoreUtils.Directory_Copy(self.AppFolderPath[:-1], CorePaths.TaiyouPath_ApplicationsFolder[:-1])

        elif self.PackpageInstalationStep == 6:  # Copy the Application Folder
            print("Copy Application to Application Folder...")
            CoreUtils.Directory_Copy(self.AppFolderPath, CorePaths.TaiyouPath_ApplicationsFolder[:-1])

        elif self.PackpageInstalationStep == 7:
            print("Copy Application Data to Application Data Folder...")
            CoreUtils.Directory_Copy(self.DataFolderPath, CorePaths.TaiyouPath_ApplicationsDataFolder)

        elif self.PackpageInstalationStep == 8:
            self.InstalationCompleteDeletePackpage = True