def MakeGooglePlayObbFile(self, isHD): print("MakeGooglePlayObbFile start") dir = mainResource.GameResApp() print("MakeGooglePlayObbFile GameRes=", dir) self.DeleAllObbFile(FileUtil.GetLastDirofDir(dir)) package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) versioncode = mainAppInfo.GetAppVersionCode(Source.ANDROID, isHD) dir = FileUtil.GetLastDirofDir(dir) print("MakeGooglePlayObbFile file_zip dir =", dir) file_zip = dir + "/main." + str(versioncode) + "." + package + ".obb" file_zip = dir + "/GameRes.zip" # main.13.com.itant.wuji.obb print("MakeGooglePlayObbFile obb file=", file_zip) # if os.path.exists(file_zip): # os.remove(file_zip) # os.system("git config --global credential.helper store") # jobb -d D:\contents\ main\assets\ -o D:\obb\output.obb -pn com.example.app -pv 25 # 压缩目录 ZipUtil.zipDir(dir, file_zip) # delete dir = mainResource.GetRootDirAndroidAsset() + "/GameRes" if os.path.exists(dir): shutil.rmtree(dir) print("MakeGooglePlayObbFile end")
def ScanPrefabFile(self, dir, filejson): if not os.path.exists(dir): return listFile = [] dirsave = FileUtil.GetLastDirofDir(filejson) FileUtil.CreateDir((dirsave)) FileUtil.GetFileList(dir, "prefab", listFile) dataRoot = json.loads("{}") # "BtnIconPlay" : { # "path" : "App/UI/Common/Button/BtnIconPlay.png" # }, for fileimage in listFile: # item= json.loads("{}") filepath = fileimage.replace( mainResource.GetRootUnityAssets() + "/", "") # item["path"]=filepath name = FileUtil.GetPathNameWithoutExt(fileimage) dataRoot[name] = filepath json_str = json.dumps(dataRoot, ensure_ascii=False, indent=4, sort_keys=True) FileUtil.SaveString2File(json_str, filejson)
def updateXiaoASOkeyword(self,jsonData,isHd): jsonfile = self.GetJsonFile(isHd) isOld = self.IsOldVersion(jsonData) if isOld: APPSTORE_KEYWORD = jsonData["APPSTORE_KEYWORD"] strStart = "XIAOMI_KEYWORD" else: APPSTORE_KEYWORD = jsonData["appstore"]["aso"] strStart = "aso_xiaomi" cn = APPSTORE_KEYWORD["cn"] en = APPSTORE_KEYWORD["en"] cn = cn.replace(","," ") en = en.replace(","," ") strEnd = "\"" strFile = FileUtil.GetFileString(jsonfile) strMid = "\"cn\": \"" strFile = self.replaceString2(strFile, strStart, strMid, strEnd, cn) strMid = "\"en\": \"" strFile = self.replaceString2(strFile, strStart, strMid, strEnd, en) FileUtil.SaveString2File(strFile, jsonfile)
def ScanImageFile(self, dir, filejson): # if not os.path.exists(dir): # return listFile = [] if os.path.exists(dir): FileUtil.GetFileList(dir, "png", listFile) FileUtil.GetFileList(dir, "jpg", listFile) print("listFile len=" + str(len(listFile))) dataRootOld = None if os.path.exists(filejson) == True: print("filejson = " + filejson) strfile = FileUtil.GetFileString(filejson) # print("strfile = "+strfile) dataRootOld = json.loads(strfile) if dataRootOld is None: print("dataRootOld is none") print("strfile = " + strfile) # remove os.remove(filejson) dataRoot = json.loads("{}") # "BtnIconPlay" : { # "path" : "App/UI/Common/Button/BtnIconPlay.png" # }, for fileimage in listFile: item = json.loads("{}") filepath = fileimage.replace( mainResource.GetRootUnityAssets() + "/", "") filepath = filepath.replace(self.dirCloudResHead, "") item["path"] = filepath name = FileUtil.GetPathNameWithoutExt(fileimage) # 从原来的json中恢复board if dataRootOld is not None: # print("dataRootOld is not none") if name in dataRootOld: # print("dataRootOld name="+name) dataitem = dataRootOld[name] key = "board" # key = "path" # if name =="BtnCommon": # # key = "board" # print("dataitem[key] = "+dataitem[key]+" name="+name) if key in dataitem: print("key = " + key + " name=" + name) item[key] = dataitem[key] dataRoot[name] = item json_str = json.dumps(dataRoot, ensure_ascii=False, indent=4, sort_keys=True) FileUtil.SaveString2File(json_str, filejson)
def UploadIAPInfo(self, isHd, stros): package = mainAppInfo.GetAppPackage(stros, isHd) rootJson = self.LoadJsonIAP(isHd, stros) rootConfig = mainResource.GetProjectConfigDefault() striap = FileUtil.GetFileString(rootConfig + "/appstore/KEY_IAP.xml") listIAP = [] for item in rootJson["items"]: if item["isSkip"]: continue name = item["key"] striap = striap.replace("_NAME_", name) product_id = package + "." + item["id"] striap = striap.replace("_ID_", product_id) # consumable non-consumable isConsume = item["isConsume"] product_type = "non-consumable" if isConsume: product_type = "consumable" striap = striap.replace("_TYPE_", product_type) title_cn = item["title"]["cn"] striap = striap.replace("_TITLE_CN_", title_cn) title_en = item["title"]["en"] striap = striap.replace("_TITLE_EN_", title_en) title_cn = item["detail"]["cn"] striap = striap.replace("_DETAIL_CN_", title_cn) title_en = item["detail"]["en"] striap = striap.replace("_DETAIL_EN_", title_en) price = item["price_tier"] striap = striap.replace("_PRICE_", price) listIAP.append(striap) str_metadata_xml = FileUtil.GetFileString(rootConfig + "/appstore/IAP_metadata.xml") str_metadata_xml = str_metadata_xml.replace( "_VENDOR_ID_", mainAppInfo.GetAppSKU(isHd)) strkeyiap = "" for strtmp in listIAP: strkeyiap += strtmp str_metadata_xml = str_metadata_xml.replace("_KEY_IAP_", strkeyiap) rootConfig = mainResource.GetProjectConfigApp() file_metadata_ios = rootConfig + "/appstore/ios/app.itmsp/metadata.xml" if isHd: file_metadata_ios = rootConfig + "/appstore/ios/app_pad.itmsp/metadata.xml" FileUtil.SaveString2File(str_metadata_xml, file_metadata_ios) mainAppstoreUploadiOS.Run(isHd)
def replaceScreenOrientation(self,filePath,isHd): strFile = FileUtil.GetFileString(filePath) str = "sensorPortrait" if isHd: str = "sensorLandscape" strFile = strFile.replace("_SCREENORIENTATION_", str) FileUtil.SaveString2File(strFile,filePath)
def UpLoadSignAndroid(self): webcmd = WebDriverCmd(self.driver) # E:\Users\moon\Downloads if Platform.isWindowsSystem(): downloadDir = "C:\\Users\\moon\\Downloads" if Platform.isMacSystem(): downloadDir = "/Users/moon/Downloads" self.DeleteAllDownloadFile(downloadDir, ".apk") # 下载空包 E:\Users\moon\Downloads\mssp-verify-b8920a35.apk key = "//button[@class='veui-button bottom20']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(3) apk_unsign = self.GetDownloadFile(downloadDir, ".apk") apk_sign = mainResource.GetProjectOutPut() + "/mssp_baidu/signed.apk" FileUtil.CreateDir(FileUtil.GetLastDirofDir(apk_sign)) jks = mainResource.GetDirProductCommon() + "/Ad/moonma.jks" if Platform.isWindowsSystem(): # sign apk: # jarsigner -verbose -keystore ~/sourcecode/mssp_baidu/moonma.jks -signedjar ~/sourcecode/mssp_baidu/signed.apk ~/sourcecode/mssp_baidu/empty.apk moonma -storepass qianlizhiwai cmd = "jarsigner -verbose -keystore " + jks + " -signedjar " + apk_sign + " " + apk_unsign + " moonma -storepass qianlizhiwai" if Platform.isMacSystem(): # sign apk: # jarsigner -verbose -keystore ~/sourcecode/mssp_baidu/moonma.jks -signedjar ~/sourcecode/mssp_baidu/signed.apk ~/sourcecode/mssp_baidu/empty.apk moonma -storepass qianlizhiwai cmd = "jarsigner -verbose -keystore " + jks + " -signedjar " + apk_sign + " " + apk_unsign + " moonma -storepass qianlizhiwai" print(cmd) os.system(cmd) time.sleep(1) # sign end # 滚动到浏览器顶部 js_top = "var q=document.documentElement.scrollTop=0" # 滚动到浏览器底部 js_bottom = "var q=document.documentElement.scrollTop=document.documentElement.scrollHeight" self.driver.execute_script(js_bottom) time.sleep(2) # 上传签名包 # key = "//input[@accept='.apk' and @name='file']" key = "//label[@class='veui-button veui-uploader-input-label']" item = webcmd.AddCmd(CmdType.CLICK_Action, key) # webcmd.SetItemVisible(item) webcmd.Run(True) self.OpenFileBrowser(apk_sign)
def ConfigiOSPluginsCode(self): dirRoot = mainResource.GetRootUnityAssets()+"/Plugins/iOS" dirCodeCommon = dirRoot+"/Common" dirCodeAdkit = dirRoot+"/Common/AdKit" # tongji FileUtil.RemoveDir(dirCodeCommon+"/Tongji") zipfile = dirCodeCommon+"/Tongji.zip" if self.IsNoIDFASDK(): zipfile = dirCodeCommon+"/Tongji_NoSDK.zip" flag = os.path.exists(zipfile) if flag: ZipUtil.un_zip(zipfile,dirCodeCommon) # share FileUtil.RemoveDir(dirCodeCommon+"/Share") zipfile = dirCodeCommon+"/Share.zip" if self.IsNoIDFASDK(): zipfile = dirCodeCommon+"/Share_NoSDK.zip" flag = os.path.exists(zipfile) if flag: ZipUtil.un_zip(zipfile,dirCodeCommon) # adconfig FileUtil.RemoveDir(dirCodeAdkit+"/AdConfig") zipfile = dirCodeAdkit+"/AdConfig.zip" if self.IsNoIDFASDK(): zipfile = dirCodeAdkit+"/AdConfig_NoSDK.zip" flag = os.path.exists(zipfile) if flag: ZipUtil.un_zip(zipfile,dirCodeAdkit) # adkit self.ConfigiOSLib(Source.GDT) self.ConfigiOSLib(Source.BAIDU) self.ConfigiOSLib(Source.ADMOB) self.ConfigiOSLib(Source.CHSJ) self.ConfigiOSLib(Source.UNITY) self.ConfigiOSLib(Source.UMENG) self.ConfigiOSAdkitCode(Source.GDT) self.ConfigiOSAdkitCode(Source.BAIDU) self.ConfigiOSAdkitCode(Source.ADMOB) self.ConfigiOSAdkitCode(Source.CHSJ) self.ConfigiOSAdkitCode(Source.UNITY)
def GenerateProject(self, isHD, channel): name = self.GetProjectName(channel) # cloudres # output dir = mainResource.GetRootCocosBuildOutput() + "/" + name FileUtil.RemoveDir(dir) # 0f6 2f1 UNITYPATH = "" if Platform.isWindowsSystem(): # UNITYPATH="E:/Unity/"+Source.UNITY_VERSION_WIN+"/Editor/Unity.exe" UNITYPATH = "CocosCreator.exe" else: # UNITYPATH="/Applications/Unity/Hub/Editor/"+Source.UNITY_VERSION_MAC+"/Unity.app/Contents/MacOS/Unity" UNITYPATH = "/Applications/CocosCreator/Creator/" + Source.Cocos_Version + "/CocosCreator.app/Contents/MacOS/CocosCreator" # --project projectPath--build "platform=web-desktop;debug=true" appid = mainAppInfo.GetAppId(isHD, channel) PROJECT_PATH = mainResource.GetRootProjectUnity() # cmd = UNITYPATH+" --project "+ PROJECT_PATH+" --build "+ "\"platform=wechatgame;debug=false\"" # package = "packages: { wechatgame: {appid: '*****',}}" package = "packages: { wechatgame: {appid: '" + appid + "',}}" # cmd = UNITYPATH+" --project "+ PROJECT_PATH+" --build "+ "\"platform="+name+";debug=false;packages="+package+"\"" cmd = UNITYPATH + " --project " + PROJECT_PATH + " --build " + "\"platform=" + name + ";debug=false" + "\"" print("BuildWeixin cmd=" + cmd) # ps = subprocess.Popen(cmd) # ps.wait()#让程序阻塞 os.system(cmd) print("BuildWeixin end")
def loadJson(self,isHd): # if self.rootJson!=None: # return self.rootJson jsonfile = self.GetJsonFile(isHd) strfile = FileUtil.GetFileString(jsonfile) self.rootJson = json.loads(strfile) return self.rootJson
def DeleAllObbFile(self, dir): for file in os.listdir(dir): path = os.path.join(dir, file) if os.path.isfile(path): ext = FileUtil.GetFileExt(path) if ext == "obb": os.remove(path)
def GetKEY_PRIVATE(self): dir = os.getcwd() filepath = dir + "/AppStore/AuthKey_" + self.API_KEY_ID + ".p8" filepath = os.path.normpath(filepath) # print(filepath) KEY_PRIVATE = FileUtil.GetFileString(filepath) return KEY_PRIVATE
def UploadFile(self, appId, upfile): filepath = os.path.normpath(upfile).replace("\\", "/") print("UploadFile filepath=" + filepath) suffix = FileUtil.GetFileExt(filepath) strurl = self.GetUploadUrl(appId, suffix) jsonRoot = json.loads(strurl) uploadUrl = jsonRoot["uploadUrl"] authCode = jsonRoot["authCode"] files = {'file': open(filepath, 'rb')} params = { 'authCode': authCode, # 'file':files, 'fileCount': 1 } fileName = FileUtil.GetPathNameWithExt(filepath) m = MultipartEncoder( fields={ 'authCode': authCode, 'fileCount': '1', 'parseType': '1', 'file': (fileName, open(filepath, 'rb'), 'multipart/form-data') # 'file': open(filepath, 'rb') }) print("m.content_type=" + m.content_type) header = { 'Content-Type': m.content_type, # 'Content-Type': 'multipart/form-data', # 'accept':'application/json', 'client_id': self.ClientId, 'Authorization': 'Bearer %s' % self.GetToken() } mdl_rqt = requests.post( uploadUrl, # json=paramges, data=m, # files=files, headers=header) strret = mdl_rqt.content.decode("utf-8") print(strret) jsonRoot = json.loads(strret) UploadFileRsp = jsonRoot["result"]["UploadFileRsp"] fileDestUrl = UploadFileRsp["fileInfoList"][0]["fileDestUlr"] print("fileDestUrl=" + fileDestUrl) return UploadFileRsp["fileInfoList"][0]
def SaveJson(self, filePath, dataRoot): # 保存json # json.dumps(dataRoot, f, ensure_ascii=False,indent=4,sort_keys = True).encode('utf8',"ignore") json_str = json.dumps(dataRoot, ensure_ascii=False, indent=4, sort_keys=True) FileUtil.SaveString2File(json_str, filePath)
def ConfigiOSAdkitCode(self,source_ad): dirRoot = mainResource.GetRootUnityAssets()+"/Plugins/iOS" dirCodeAdkitPlatform = dirRoot+"/Common/AdKit/Platform" FileUtil.RemoveDir(dirCodeAdkitPlatform+"/"+source_ad) if not self.IsNoIDFASDK(): zipfile = dirCodeAdkitPlatform+"/"+source_ad+".zip" ZipUtil.un_zip(zipfile,dirCodeAdkitPlatform)
def SaveCommonScript(self): listname = {"AppBase", "Common"} for name in listname: src = mainResource.GetRootUnityAssets()+"/Script/"+name dst = mainResource.GetDirProductCommon()+"/ProjectUnity/Assets/Script/"+name print(src) print(dst) FileUtil.CopyDir(src, dst)
def DeleteAllScreenshots(self, isHd): verison = mainAppInfo.GetAppVersion(Source.IOS, isHd) rootConfig = mainResource.GetProjectConfigDefault() str_metadata_xml = FileUtil.GetFileString( rootConfig + "/appstore/metadata_clear_screenshots.xml") str_metadata_xml = str_metadata_xml.replace( "_VENDOR_ID_", mainAppInfo.GetAppSKU(isHd)) str_metadata_xml = str_metadata_xml.replace("_VERSION_", verison) rootConfig = mainResource.GetProjectConfigApp() file_metadata_ios = rootConfig + "/appstore/ios/app.itmsp/metadata.xml" if isHd: file_metadata_ios = rootConfig + "/appstore/ios/app_pad.itmsp/metadata.xml" FileUtil.SaveString2File(str_metadata_xml, file_metadata_ios) mainAppstoreUploadiOS.Run(isHd)
def replaceStringOfFile2(self,filePath, strStart, strMid, strEnd, strReplace): strFile = FileUtil.GetFileString(filePath) # print strFile strOut = self.replaceString2(strFile, strStart, strMid, strEnd, strReplace) # print strOut # fp_name.seek(0) # fp_name.write(strOut) return strOut
def ConfigiOSLib(self,source_lib): dirRoot = mainResource.GetRootUnityAssets()+"/Plugins/iOS" dirLib = dirRoot+"/ThirdParty" FileUtil.RemoveDir(dirLib+"/"+source_lib) if not self.IsNoIDFASDK(): zipfile = dirLib+"/"+source_lib+".zip" ZipUtil.un_zip(zipfile,dirLib) self.DeleteMACOSX(dirLib)
def AddCookie(self,filepath): flag = os.path.exists(filepath) if flag ==False: return self.driver.delete_all_cookies() strfile = FileUtil.GetFileString(filepath) list_cookies=json.loads(strfile) # cookies=self.getPureDomainCookies(list_cookies) for i in list_cookies: self.driver.add_cookie(i)
def UploadScreenShot(self, webcmd, isHD, lan, applan): # screenshot for i in range(0, 1): # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器 # self.SelectLanguage(webcmd,lan) time.sleep(1) # 将 滚动条 底部对齐 # lan_shot = "chs-contents" # key = "//div[@id='"+lan_shot+"']" # div = self.driver.find_element(By.XPATH, key) # if div==None: # print("not find screenshot div") # return # 查找子元素 # 当您启动XPath表达式时//,它会从文档的根目录中搜索,忽略您的父元素。你应该在表达前加上. # element2 = driver.find_element_by_xpath("//div[@title='div2']") # element2.find_element_by_xpath(".//p[@class='test']").text # key = ".//input[@type='file' and @data-target='#screenshots']" # item = div.find_element(By.XPATH, key) item_root = self.GetItemOfScreenShot(lan) key = ".//div[@class='ant-upload-drag-container']" item_div = webcmd.FindChild(item_root, key) # item = self.driver.find_element(By.XPATH, key) # item_div = webcmd.AddCmd2(CmdType.CLICK_Action, key) self.SetItemVisible(item_div) webcmd.DoCmd(item_div, CmdType.CLICK) time.sleep(1) pic = mainResource.GetOutPutScreenshotPathWin32( mainResource.GetProjectOutPut(), Source.TAPTAP, isHD) + "\\" + applan + "\\1080p\\" + str(i + 1) + ".jpg" if Platform.isMacSystem(): # apk = FileUtil.GetLastDirofDir(apk) pic = pic.replace("\\", "/") pic = FileUtil.GetLastDirofDir(pic) test = 0 flag = os.path.exists(pic) if flag: print(pic) self.OpenFileBrowser(pic, True) time.sleep(2) # 等待上传完成 key = ".//span[@class='upload_img']" # print(key) item = webcmd.FindChild(item_root, key, True)
def UpLoadApk(self, isHD): webcmd = WebDriverCmd(self.driver) self.urlold = self.driver.current_url old_window = self.driver.current_window_handle print("urlold=", self.urlold) # key = "//span[contains(text(),上传APK)]" key = "//span[text()='上传APK']" item = webcmd.Find(key, True) webcmd.AddCmd(CmdType.CLICK_Action, key) webcmd.Run(True) key = "//span[text()='确 定']" webcmd.AddCmd(CmdType.CLICK_Action, key) webcmd.Run(True) # key = "//div[@class='container--form upload-apk-wrapper old-style']" # item = webcmd.Find(key) # key = ".//button[@class='btn--edit ant-btn ant-btn-primary']" # subitem = webcmd.FindChild(item,key) # webcmd.DoCmd(subitem,CmdType.CLICK) # # <a data-toggle="modal" data-target=".confirm-upload-apk" class="btn btn-primary">上传APK</a> # # item = self.driver.find_element( # # By.XPATH, "//a[@data-target='.confirm-upload-apk']") # # # item = self.driver.find_element(By.XPATH, "//a[@data-toggle='modal']") # # item.click() # time.sleep(2) # # <a id="selectfiles" href="javascript:void(0);" class="btn btn-primary" style="position: relative; z-index: 1;">开始上传APK</a> # item = self.driver.find_element(By.XPATH, "//a[@id='selectfiles']") # item.click() # time.sleep(2) # 手动点击上传 # webcmd.WaitKeyBoard("q") apk = mainResource.GetOutPutApkPathWin32( mainResource.GetProjectOutPut(), Source.TAPTAP, isHD) if not os.path.exists(apk): apk = mainResource.GetOutPutApkPathWin32( mainResource.GetProjectOutPut(), Source.HUAWEI, isHD) if Platform.isMacSystem(): apk = FileUtil.GetLastDirofDir(apk) # F:\\sourcecode\\unity\\product\\kidsgame\\ProjectOutPut\\xiehanzi\\hanziyuan\\screenshot\\shu\\cn\\480p\\1.jpg self.OpenFileBrowser(apk, True) time.sleep(1) # 等待文件長傳結束 key = "//a[@title='基础信息']" item = webcmd.Find(key, True)
def replaceStringOfFile(self,filePath, strStart, strEnd, strReplace): # f = open(filePath) # f = open(filePath,'r', encoding='UTF-8') strFile = FileUtil.GetFileString(filePath) # strFile.decode('utf-8') # print strFile strOut = self.replaceString(strFile, strStart, strEnd, strReplace) # print strOut # fp_name.seek(0) # fp_name.write(strOut) return strOut
def UpdateLanguageName(self,csvfile,name_cn,name_en,ishd): strContent = FileUtil.GetFileString(csvfile) key_name = self.GetCSVName(strContent,ishd) head = "APP_NAME" if ishd: head = "APP_NAME_HD" str_new = head+","+name_cn+"," +name_en # +"\n" self.replaceFile(csvfile,key_name,str_new)
def PreDownloadSigniOS(self, isHd): savepath = self.GetPathXcodePrifile(isHd) if os.path.exists(savepath): return downloadDir = "C:\\Users\\moon\\Downloads" self.DeleteAllDownloadFile(downloadDir, ".mobileprovision") self.DownloadAppleDeveloper(isHd) appsign = self.GetDownloadFile(downloadDir, ".mobileprovision") savepath = self.GetPathXcodePrifile(isHd) FileUtil.CopyFile(appsign, savepath)
def BuildProject(self, isHD, channel): name = self.GetProjectName(channel) dirproject = mainResource.GetRootCocosBuildOutput() + "/" + name appid = mainAppInfo.GetAppId(isHD, channel) if name == Source.ProjectNameMiniGameWeixin or name == Source.ProjectNameMiniGameByte: filepath = mainResource.GetProjectConfigDefault( ) + "/" + name + "/game.json" strfile = FileUtil.GetFileString(filepath) strfile = strfile.replace("_Orientation_", "portrait") filepath = dirproject + "/game.json" FileUtil.RemoveFile(filepath) FileUtil.SaveString2File(strfile, filepath) filepath = mainResource.GetProjectConfigDefault( ) + "/" + name + "/project.config.json" strfile = FileUtil.GetFileString(filepath) print("BuildWeixin appid=" + appid) # wx3e44af039aee1b96 strfile = strfile.replace("_APPID_", appid) # print("BuildWeixin strfile="+strfile) filepath = dirproject + "/project.config.json" FileUtil.RemoveFile(filepath) FileUtil.SaveString2File(strfile, filepath) # python 里无法直接执行cd目录,要用chdir改变当前的工作目录 if os.path.exists(dirproject): os.chdir(dirproject) print("dirproject:" + dirproject) if name == Source.ProjectNameMiniGameVivo: os.system("npm install") os.system("npm run build")
def MakeGuideDoc(self, isHd): title = mainAppInfo.GetAppName(Source.ANDROID, isHd, Source.LANGUAGE_CN) + "V1.0.0" detail = mainAppInfo.GetAppDetail(isHd, Source.LANGUAGE_CN) # detail +="/n" detail += mainAppInfo.GetAppDetail(isHd, Source.LANGUAGE_EN) outputdir = mainResource.GetProjectOutPutApp() FileUtil.CreateDir(outputdir) docoutput = outputdir + "/" + mainResource.getGameType( ) + "_guide.docx" dirscreenshot = mainResource.GetProjectOutPutApp( ) + "/screenshot/shu/cn/1080p" filedetail = mainResource.GetProjectConfigApp( ) + "/appinfo/app_description.xml" if isHd: dirscreenshot = mainResource.GetProjectOutPutApp( ) + "/screenshot/heng/cn/1080p" filedetail = mainResource.GetProjectConfigApp( ) + "/appinfo/app_description_hd.xml" docoutput = outputdir + "/" + mainResource.getGameType( ) + "_guide_hd.docx" filedst = dirscreenshot + "/detail.xml" FileUtil.SaveString2File(detail, filedst) # FileUtil.CopyFile(filedetail,filedst) cmd = "pyerz -e xml -i " + dirscreenshot + " -o " + docoutput + " -t " + title + " --font-size 16 --space-before 2 --space-after 10 --line-spacing 16 " # print("cmd=",cmd) for i in range(5): pic = dirscreenshot + "/" + str(i + 1) + ".jpg" if os.path.exists(pic): cmd += " -pic " + pic os.system(cmd) os.remove(filedst) self.WordToPdf(docoutput)
def Run(self): gameType = mainResource.getGameType() gameName = mainResource.getGameName() configDirUnity = mainResource.GetRootUnityAssetsResource( ) + "/ConfigData/config" configAppType = mainConfig.GetConfigAppType(configDirUnity) configAppName = mainConfig.GetConfigAppName(configDirUnity) print("unity:" + configAppType + " " + configAppName) if gameType != configAppType or gameName != configAppName: print("check app type and name fail") sys.exit(0) dir1 = mainResource.GetRootUnityAssetsResource() + "/App" dir2 = mainResource.GetResourceDataRoot( ) + "/" + gameType + "/" + gameName + "/" + Source.Dir_Name_Resources + "/App" flag = os.path.exists(dir2) if flag: shutil.rmtree(dir2) shutil.copytree(dir1, dir2) # AppCommon dir1 = mainResource.GetRootUnityAssetsResource() + "/AppCommon" dir2 = mainResource.GetResourceDataRoot( ) + "/" + gameType + "/" + "AppCommon/" + Source.Dir_Name_Resources flag = os.path.exists(dir2) FileUtil.CopyDir(dir1, dir2) # ConfigData dir1 = mainResource.GetRootUnityAssetsResource() + "/ConfigData" dir2 = mainResource.GetResourceDataRoot( ) + "/" + gameType + "/" + gameName + "/ConfigData" flag = os.path.exists(dir2) FileUtil.CopyDir(dir1, dir2) print("save_resource sucess")
def __init__(self): dir = self.DIR_private_key dir = os.path.normpath(dir) if os.path.exists(dir) == False: os.mkdir(dir) filename = "AuthKey_" + self.API_KEY_ID + ".p8" dir = os.getcwd() src = dir + "/AppStore/" + filename src = os.path.normpath(src) dst = self.DIR_private_key + "/" + filename dst = os.path.normpath(dst) FileUtil.CopyFile(src, dst)
def GetPackageAndroidFromXml(self): fileXml = self.GetRootDirAndroidStudio( ) + "/src/main/AndroidManifest.xml" strFile = FileUtil.GetFileString(fileXml) # package="com.moonma.shapecolor.pad" strHead = "package=\"" strEnd = "\"" idx = strFile.find(strHead) package = "" if idx >= 0: idx += len(strHead) strOther = strFile[idx:] idx = strOther.find(strEnd) package = strOther[0:idx] return package