コード例 #1
0
        public void runWinPhoneDecompile()
        {
            WinPhoneApp wpApp = new WinPhoneApp(Config);

            wpApp.OutputDataReceived += logText;

            outputDirName       = buildOutputDir();
            wpApp.OutputDirName = outputDirName;
            Directory.CreateDirectory(wpApp.getOutputPath(""));
            logText("build " + outputDirName + " finished!");
            wpApp.FileBackupName = "temp.bak";
            wpApp.loadFile(SourceFile);
            logText("copy to " + wpApp.FileBackupName + " finished!");
            wpApp.runDecompile();
            logText("decompile finished!");
            wpApp.readVersion(out VersionName, out VersionCode);
        }
コード例 #2
0
        public void runWinPhoneCommand()
        {
            WinPhoneApp resourceApp = null;
            WinPhoneApp wpApp       = new WinPhoneApp(Config);

            wpApp.OutputDataReceived += logText;

            outputDirName       = buildOutputDir();
            wpApp.OutputDirName = outputDirName;
            Directory.CreateDirectory(wpApp.getOutputPath(""));
            logText("build " + outputDirName + " finished!");
            wpApp.FileBackupName = "temp.bak";
            wpApp.loadFile(SourceFile);
            logText("copy to " + wpApp.FileBackupName + " finished!");
            wpApp.runDecompile();
            logText("decompile " + wpApp.FileBackupName + " finished!");

            wpApp.deleteFileAndDir(DeletePath.ToArray());

            if (DeleteGameResDir)
            {
                wpApp.deleteGameResDir();
            }

            if (!String.IsNullOrEmpty(ResourceApkPath))
            {
                resourceApp = new WinPhoneApp(Config);
                resourceApp.OutputDataReceived += logText;

                resourceApp.OutputDirName  = outputDirName;
                resourceApp.FileBackupName = "resource.bak";
                resourceApp.loadFile(ResourceApkPath);
                logText("copy to " + resourceApp.FileBackupName + " finished!");
                resourceApp.runDecompile();
                logText("decompile " + resourceApp.FileBackupName + " finished!");

                logText("start copy...");

                JObject funJson  = resourceApp.readFunctionTxt();
                string  gameDir  = funJson["GamePath"].ToObject <string>();
                bool    resEncry = funJson["EncryptResource"].ToObject <bool>();

                foreach (string itemName in Config.ResourceFileList)
                {
                    string pathName  = itemName;
                    bool   needEncry = false;
                    if (itemName.Contains("%gamedir%"))
                    {
                        pathName  = itemName.Replace("%gamedir%", gameDir);
                        needEncry = !resEncry;
                    }

                    if (Directory.Exists(resourceApp.getTempPath(pathName)))
                    {
                        resourceApp.DirectoryCopy(resourceApp.getTempPath(pathName), wpApp.getTempPath(pathName), needEncry);
                    }
                    else if (File.Exists(resourceApp.getTempPath(pathName)))
                    {
                        resourceApp.FileCopy(resourceApp.getTempPath(pathName), wpApp.getTempPath(pathName), needEncry);
                    }
                }

                logText("copy from " + resourceApp.FileBackupName + " finished!");
            }

            foreach (string strPath in EncryptOverwrite)
            {
                if (Directory.Exists(strPath))
                {
                    wpApp.DirectoryCopy(strPath, wpApp.getAssetPath(""), true);
                    logText("copy " + strPath + " finished!");
                }
            }

            foreach (string strPath in NormalOverwrite)
            {
                if (Directory.Exists(strPath))
                {
                    wpApp.DirectoryCopy(strPath, wpApp.getTempPath(""), false);
                    logText("copy " + strPath + " finished!");
                }
            }

            {
                JObject funJson = wpApp.readFunctionTxt();
                string  gameDir = funJson["GamePath"].ToObject <string>();
                foreach (string strPath in OtherJsonFile)
                {
                    string fileName = Path.GetFileName(strPath);
                    wpApp.FileCopy(strPath, wpApp.getJsonPath(gameDir, fileName), true);
                }
            }

            //修改AppName

            foreach (ChannelItem channel in ChannelList)
            {
                logText("pack " + channel.ChannelId);

                int    appVerCode = 0;
                string appVerName = "";
                wpApp.readVersion(out appVerName, out appVerCode);

                if (String.IsNullOrEmpty(VersionName))
                {
                    VersionName = appVerName;
                }
                if (VersionCode <= 0)
                {
                    VersionCode = appVerCode;
                }
                //修改Manifest文件
                wpApp.editManifest(channel, Package, VersionName);
                logText("editManifest finished!");

                wpApp.editFunctionTxt(channel.ChannelId, true, Package.PackageName);
                logText("editFunctionTxt finished!");

                wpApp.packXap(channel.ChannelId, Package.PackageName, VersionName);
            }

            if (Config.DeleteTemp)
            {
                wpApp.deleteTempDir();
                if (resourceApp != null)
                {
                    resourceApp.deleteTempDir();
                }
            }
            logText("all finished!");
        }