Пример #1
0
        private void doWork_Load(object sender, EventArgs e)
        {
            Control.CheckForIllegalCrossThreadCalls = false;

            /*
             * foreach (KeyValuePair<string, string> channel in channels)
             * {
             *   string txt = channel.Key;
             *   string val = channel.Value;
             * }
             */
            lbGame.Text = game;
            lbName.Text = gameName;
            string lastGame = envConfig.currenPath + @"\lastGame" + envConfig.configExt;
            string lineStr  = "";

            lineStr = "game=" + game + "\r\n";
            FileUtil.writeContent(lastGame, lineStr);
            string   signCfg   = envConfig.gameConfig + game + @"\sign" + envConfig.configExt;
            PpHelper pptHelper = new PpHelper(signCfg);

            txtSignPwd.Text = pptHelper.GetPropertiesText("signPwd");
            txtAlias.Text   = pptHelper.GetPropertiesText("alias");
            txtKeyPwd.Text  = pptHelper.GetPropertiesText("keyPwd");
            if (!FileUtil.checkFile(envConfig.gameConfig + game + @"\" + game + ".keystore"))
            {
                MessageBox.Show("请重新选择签名文件");
            }
            else
            {
                lbPwdFile.Text = envConfig.gameConfig + game + @"\" + game + ".keystore";
            }
            getChannel();
        }
Пример #2
0
        /// <summary>
        /// 读取渠道property文件返回 游戏对象
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public gameItem getItem(string gid)
        {
            string fileName = envConfig.games + gid + @"\" + gid + envConfig.configExt;

            GC.Collect();
            gameItem item = new gameItem();

            if (FileUtil.checkFile(fileName))
            {
                // 读取游戏信息
                PpHelper helper = new PpHelper(fileName);
                item.name    = helper.GetPropertiesText("name");
                item.gid     = helper.GetPropertiesText("gid");
                item.package = helper.GetPropertiesText("package");
                item.version = helper.GetPropertiesText("version");
                item.icon    = helper.GetPropertiesText("icon");
                item.des     = helper.GetPropertiesText("des");
                //          item.apk = helper.GetPropertiesText("apk");
                item.key         = helper.GetPropertiesText("key");
                item.orientation = helper.GetPropertiesText("orientation");
                item.flag        = helper.GetPropertiesText("flag");
                item.alias       = helper.GetPropertiesText("alias");
                item.keyPwd      = helper.GetPropertiesText("keyPwd");
                item.keyPath     = helper.GetPropertiesText("keyPath");
                item.signPwd     = helper.GetPropertiesText("signPwd");
            }

            return(item);
        }
Пример #3
0
        private void txtGame_KeyUp(object sender, KeyEventArgs e)
        {
            cfgLb.BackColor = Color.Red;
            string game    = txtGame.Text.ToString().Trim();
            string signCfg = envConfig.gameConfig + game + @"\sign" + envConfig.configExt;

            if (!FileUtil.checkFile(signCfg))
            {
                txtSignPwd.Text = "lyhd2015";
                txtAlias.Text   = "lyhd";
                txtKeyPwd.Text  = "lyhd2015";
                lbPwdFile.Text  = "please chose sign file";
                cfgLb.Text      = "没有检测" + game + "的配置文件";
            }
            else
            {
                PpHelper pptHelper = new PpHelper(signCfg);
                txtSignPwd.Text = pptHelper.GetPropertiesText("signPwd");
                txtAlias.Text   = pptHelper.GetPropertiesText("alias");
                txtKeyPwd.Text  = pptHelper.GetPropertiesText("keyPwd");
                if (!FileUtil.checkFile(envConfig.gameConfig + game + @"\" + game + ".keystore"))
                {
                    txtKeyPwd.Text = "";
                }
                else
                {
                    lbPwdFile.Text = "sign.keystore";
                }
                cfgLb.BackColor = Color.Green;
                cfgLb.Text      = " 检测到" + game + "的配置文件";
            }
        }
Пример #4
0
        private void readPt()
        {
            PpHelper pptHelper = new PpHelper(propertiesFile);
            Dictionary <string, string> dic = pptHelper.getAllProperties();

            dicNum = dic.Count();
            int i = 1;

            foreach (KeyValuePair <string, string> p in dic)
            {
                this.allProperties.Add(p.Key, p.Value);
                TextBox txtBoxK = new TextBox();
                txtBoxK.Name = "K_" + i.ToString();
                txtBoxK.Text = p.Key;
                txtBoxK.Left = 0;
                txtBoxK.Top  = i * 50;
                Label l1 = new Label();
                l1.Text          = "=";
                txtBoxK.Location = new Point(pannelPts.Location.X - 20, i * 25);
                l1.Location      = new Point(120, i * 25);
                l1.Size          = new System.Drawing.Size(10, 23);
                txtBoxK.KeyUp   += new KeyEventHandler(this.txt_Change);
                pannelPts.Controls.Add(txtBoxK);
                pannelPts.Controls.Add(l1);
                TextBox txtBoxV = new TextBox();
                txtBoxV.Name     = "V_" + i.ToString();
                txtBoxV.Text     = p.Value;
                txtBoxV.Location = new Point(130, i * 25);
                txtBoxV.Size     = new System.Drawing.Size(230, 23);
                txtBoxV.Top      = i * 25;
                txtBoxV.KeyUp   += new KeyEventHandler(this.txt_Change);
                pannelPts.Controls.Add(txtBoxV);
                i++;
            }
        }
Пример #5
0
        public void updateChannelXml(string game, string channel, string gameXml, string properties)
        {
            Dictionary <string, string> meatas = new channelManager().getChannelMetas(channel);

            if (meatas == null)
            {
                return;
            }

            PpHelper pt         = new PpHelper(properties);
            string   tmpXml     = FileUtil.setXmlColon(FileUtil.getContent(gameXml));
            string   xmlTmpFile = gameXml + @".tmp";

            //  MessageBox.Show(xmlTmpFile);
            FileUtil.writeContent(xmlTmpFile, tmpXml);

            //遍历添加meta-data
            foreach (KeyValuePair <string, string> pair in meatas)
            {
                addMeataData(pt, xmlTmpFile, pair.Key, pair.Value);
            }

            pt.Close();
            string tempXml = FileUtil.getContent(xmlTmpFile);

            tempXml = FileUtil.xmlRestore(tempXml);
            tmpXml  = FileUtil.replaceXmlColon(tempXml);
            FileUtil.writeContent(gameXml, tmpXml);
            File.Delete(xmlTmpFile);
        }
Пример #6
0
        /// <summary>
        /// 读取渠道property文件返回 渠道对象
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public channelItem getItem(string cid)
        {
            string fileName = envConfig.channels + cid + @"\" + cid + "_info" + envConfig.configExt;

            GC.Collect();
            channelItem item = new channelItem();

            if (FileUtil.checkFile(fileName))
            {
                PpHelper helper = new PpHelper(fileName);
                item.name    = helper.GetPropertiesText("name");
                item.cid     = helper.GetPropertiesText("cid");
                item.package = helper.GetPropertiesText("package");
                item.version = helper.GetPropertiesText("version");
                item.foot    = helper.GetPropertiesText("foot");
                item.des     = helper.GetPropertiesText("des");
                //    item.apk = helper.GetPropertiesText("apk");
                item.isfoot     = helper.GetPropertiesText("isfoot");
                item.isR        = helper.GetPropertiesText("isR");
                item.sdkPackage = helper.GetPropertiesText("sdkPackage");
                item.isOwnKey   = helper.GetPropertiesText("isOwnKey");
                item.flag       = helper.GetPropertiesText("flag");
            }
            return(item);
        }
Пример #7
0
        private void addMeataData(PpHelper pt, string xmlTmpFile, string name, string valueKey)
        {
            string value = pt.GetPropertiesText(valueKey);
            Dictionary <string, string> meatas = new Dictionary <string, string>();

            meatas.Add("android" + FileUtil.colon + "name", name);
            meatas.Add("android" + FileUtil.colon + "value", value);
            XmlHelper.XmlInsertMultiElement(xmlTmpFile, "manifest/application", "meta-data", meatas);
        }
Пример #8
0
        private void compile_Load(object sender, EventArgs e)
        {
            string lastGame = envConfig.currenPath + @"\lastGame" + envConfig.configExt;

            if (FileUtil.checkFile(lastGame))
            {
                PpHelper pptHelper1 = new PpHelper(lastGame);
                txtGame.Text = pptHelper1.GetPropertiesText("game");
                string signCfg = envConfig.gameConfig + game + @"\sign" + envConfig.configExt;
                if (File.Exists(signCfg))
                {
                    PpHelper pptHelper = new PpHelper(signCfg);
                    txtSignPwd.Text = pptHelper.GetPropertiesText("signPwd");
                    txtAlias.Text   = pptHelper.GetPropertiesText("alias");
                    txtKeyPwd.Text  = pptHelper.GetPropertiesText("keyPwd");
                    if (!FileUtil.checkFile(envConfig.gameConfig + game + @"\" + game + ".keystore"))
                    {
                        txtKeyPwd.Text = "";
                    }
                    else
                    {
                        lbPwdFile.Text = "sign.keystore";
                    }
                    cfgLb.BackColor = Color.Green;
                    cfgLb.Text      = " 检测到" + game + "的配置文件";
                }
            }

            // this.StartPosition = FormStartPosition.CenterScreen;
            channelBoxs.CheckOnClick = true;
            List <string> folders = FileUtil.getFolders(envConfig.channelPath);

            foreach (string folder in folders)
            {
                string channel = new DirectoryInfo(folder).Name;
                if (channel == ".svn")
                {
                    continue;
                }

                string channelXml = envConfig.channelPath + channel + @"\channel.xml";
                try
                {
                    string channelName = XmlHelper.getChannelName(channelXml);
                    channelBoxs.Items.Add(new check(channel, channelName));
                }
                catch (Exception EE)
                {
                    MessageBox.Show(EE.Message + channelXml + " 不存在,或者有错误");
                }
            }
        }
Пример #9
0
        private bool isDebug()
        {
            bool     debug = false;
            PpHelper pt    = new PpHelper(envConfig.currenPath + @"\env.properties");

            if (pt.GetPropertiesText("debug") == "1")
            {
                debug = true;
            }
            else
            {
                debug = false;
            }
            return(debug);
        }
Пример #10
0
        /// <summary>
        /// 检测渠道 签名 property文件
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public bool checkChannelKey()
        {
            string fileName = envConfig.channels + selChannel.cid + @"\sign" + envConfig.configExt;

            if (FileUtil.checkFile(fileName))
            {
                PpHelper helper  = new PpHelper(fileName);
                string   alias   = helper.GetPropertiesText("alias");
                string   keypwd  = helper.GetPropertiesText("keyPwd");
                string   signpwd = helper.GetPropertiesText("signPwd");
                string   key     = helper.GetPropertiesText("keyPath");

                if (alias == "" || keypwd == "" || signpwd == "" || key == "")
                {
                    channel_key.ForeColor = Color.Red;
                    channel_key.Text      = "检测渠道签名文件失败";
                    return(false);
                }

                channel_key.Text      = key;
                channel_key_pwd.Text  = keypwd;
                channel_sign_pwd.Text = signpwd;
                channel_alias.Text    = alias;

                channel_key.ForeColor = Color.Green;
                channel_key.Text      = "检测渠道签名文件成功";
            }
            else
            {
                channel_key.ForeColor = Color.Red;
                channel_key.Text      = "检测渠道签名文件失败";
                return(false);
            }
            GC.Collect();
            return(true);
        }
Пример #11
0
        //打包主流程
        private void copyDecompileFile(string game, string channel, ProgressBar pro, Label lb)
        {
            // 拷贝游戏
            copyFolder(fromPath, envConfig.targetPath + @game + @"\" + channel + @"\", pro, lb, game);

            // 保存参数文件--assets
            string propertiesFile = envConfig.gameConfig + game + @"\" + channel + envConfig.configExt;

            if (!Directory.Exists(envConfig.targetPath + @game + @"\" + channel + @"\assets\"))
            {
                Directory.CreateDirectory(envConfig.targetPath + @game + @"\" + channel + @"\assets\");
            }
            if (getNum == fileNum)
            {
                File.Copy(propertiesFile, envConfig.targetPath + @game + @"\" + channel + @"\assets\" + game + envConfig.configExt, true);
                curEvent.Text = "copy  " + channel + "  完成.";
                pbT.Value     = 20;
            }
            //合并文件
            string apkBase = envConfig.channelPath + channel + @"\apkBase\";

            if (!Directory.Exists(apkBase))
            {
                MessageBox.Show("不存在sdk母包文件");
                return;
            }
            File.Delete(apkBase + @"AndroidManifest.xml");
            File.Delete(apkBase + @"apktool.yml");
            mergeFolder(envConfig.targetPath + @game + @"\" + channel + @"\", apkBase, pro, lb, channel);
            // propertiesFile = envConfig.gameConfig + game + @"\" + channel + envConfig.configExt;

            File.Copy(propertiesFile, envConfig.targetPath + @game + @"\" + channel + @"\assets\" + game + envConfig.configExt, true);
            //检测游戏母包是否还有其他文件操作
            delArmeabi(game, envConfig.targetPath + @game + @"\" + channel + @"\lib");
            fileNum = 0;
            //todo merge xml
            string gameXml = envConfig.targetPath + @game + @"\" + channel + @"\AndroidManifest.xml";
            string xxxPath = envConfig.targetPath + @game + @"\" + channel + @"\res\drawable-xxxhdpi\";

            if (Directory.Exists(xxxPath))
            {
                FileUtil.deleteFolder(xxxPath);
            }
            curEvent.Text = "合并" + gameXml;
            this.mergeXml(gameXml, channel);
            curEvent.Text = "xml合并完成";

            pro.Value = 60;
            pbT.Value = 60;
            lb.Text   = "60%";

            //todo replace packageName
            string   oldName     = getPackName(gameXml);
            PpHelper pt          = new PpHelper(propertiesFile);
            string   packageName = pt.GetPropertiesText("package");

            this.replaceSpecGameXml(game, gameXml, packageName, oldName);
            //todo 特殊游戏包名
            if (packageName.Length > 0)
            {
                XmlHelper.XmlAttributeEdit(gameXml, "manifest", "package", packageName);
            }
            string tmpXml1     = FileUtil.setXmlColon(FileUtil.getContent(gameXml));
            string xmlTmpFile1 = gameXml + @".tmp";

            FileUtil.writeContent(xmlTmpFile1, tmpXml1);
            XmlDocument dDoc = new XmlDocument();

            dDoc.Load(xmlTmpFile1);
            XmlNode    dpath = dDoc.SelectSingleNode(@"//manifest/application");
            XmlElement dXe   = (XmlElement)dpath;

            //    dXe.GetAttribute("android" + FileUtil.colon + "debuggable");
            dXe.SetAttribute("android" + FileUtil.colon + "debuggable", "false");
            dDoc.Save(xmlTmpFile1);
            tmpXml1 = FileUtil.replaceXmlColon(FileUtil.getContent(xmlTmpFile1));
            tmpXml1 = FileUtil.xmlRestore(tmpXml1);
            FileUtil.writeContent(gameXml, tmpXml1);
            File.Delete(xmlTmpFile1);



            //  string tmpXml = FileUtil.setXmlColon(FileUtil.getContent(gameXml));
            pbT.Value     = 61;
            pro.Value     = 61;
            lb.Text       = "61%";
            curEvent.Text = "包名替换完成";

            //todo copy ico
            if (picString.Length > 0)
            {
                string tmpXml     = FileUtil.setXmlColon(FileUtil.getContent(gameXml));
                string xmlTmpFile = gameXml + @".tmp";
                FileUtil.writeContent(xmlTmpFile, tmpXml);
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(xmlTmpFile);
                XmlNode    basePath = xmlDoc.SelectSingleNode(@"//manifest/application");
                XmlElement baseXe   = (XmlElement)basePath;
                string     icoName  = baseXe.GetAttribute("android" + FileUtil.colon + "icon");
                icoName = icoName.Substring(icoName.IndexOf('/') + 1);
                copyIco(picString, envConfig.targetPath + @game + @"\" + channel + @"\res\", icoName + ".png", channel);
                tmpXml = FileUtil.replaceXmlColon(FileUtil.getContent(xmlTmpFile));
                tmpXml = FileUtil.xmlRestore(tmpXml);
                FileUtil.writeContent(gameXml, tmpXml);
                File.Delete(xmlTmpFile);
            }

            //todo 检测渠道XML是否有特殊操作
            try
            {
                updateChannelXml(game, channel, gameXml, propertiesFile);
            }
            catch (Exception EE)
            {
                MessageBox.Show(EE.ToString());
            }
            curEvent.Text = "特殊渠道xml处理完成";

            //todo merge res *.xml

            this.mergeRes(channel, game);
            pbT.Value     = 65;
            pro.Value     = 65;
            lb.Text       = "65%";
            curEvent.Text = "res xml 合并完成";
            //todo make R.java
            //todo compile class file
            //todo make dex
            //todo make smali
            //todo merge smali
            string targetPath = envConfig.targetPath + game + @"\" + channel + @"\";
            string resPath    = targetPath + "res";
            string tmpFolder  = envConfig.upPath + @"temp\";
            string tmpCls     = tmpFolder + @"class\";
            string tmpR       = tmpFolder + @"R\";

            if (Directory.Exists(tmpR))
            {
                FileUtil.deleteFolder(tmpR);
            }
            Directory.CreateDirectory(tmpR);
            if (Directory.Exists(tmpCls))
            {
                FileUtil.deleteFolder(tmpCls);
            }
            Directory.CreateDirectory(tmpCls);
            string packagePath  = packageName.Replace(".", @"\");
            string javaFilePath = tmpR + packagePath;

            //            MessageBox.Show("java file:"+javaFilePath);
            curEvent.Text = "开始生成R文件";
            Process makeR = new Process();

            if (this.isDebug() == false)
            {
                makeR.StartInfo.UseShellExecute        = false;
                makeR.StartInfo.CreateNoWindow         = true;
                makeR.StartInfo.FileName               = envConfig.toolPath + @"\makeR.bat";
                makeR.StartInfo.RedirectStandardInput  = true;
                makeR.StartInfo.RedirectStandardOutput = true;
                makeR.StartInfo.RedirectStandardError  = true;
            }
            else
            {
                makeR.StartInfo.FileName = envConfig.toolPath + @"\makeR-debug.bat";
            }
            makeR.StartInfo.Arguments = " " + resPath + " " + targetPath + "AndroidManifest.xml" + " " + tmpR + "  " + tmpCls + " " + javaFilePath + " " + envConfig.targetPath + @game + @"\" + channel + @"\assets\";

            makeR.Start();
            string       line   = "\r\n";
            StreamReader reader = null;

            if (this.isDebug() == false)
            {
                reader = makeR.StandardOutput; //截取输出流
                line   = reader.ReadLine();    //每次读取一行
                while (!reader.EndOfStream)
                {
                    line  = reader.ReadLine();
                    line += "\r\n" + line;
                    richTxtInfo.AppendText(line);
                    richTxtInfo.SelectionStart = richTxtInfo.Text.Length;
                    richTxtInfo.ScrollToCaret();
                }
            }
            makeR.WaitForExit();
            pbT.Value     = 70;
            pro.Value     = 70;
            lb.Text       = "70%";
            curEvent.Text = "R文件生成完成";
            richTxtInfo.AppendText("\r\n R文件生成完成\r\n");



            if (makeRYes.Checked == true)
            {
                string channelXml    = envConfig.channelPath + channel + @"\channel.xml";
                string chanelPackage = XmlHelper.getChannelAtrr(channelXml, "chanelPackage");
                MessageBox.Show(chanelPackage);
                makeChannelRes(channel, pro, lb);
            }

            curEvent.Text = "生成class文件";
            Process makeDex = new Process();

            if (this.isDebug() == false)
            {
                makeDex.StartInfo.UseShellExecute        = false;
                makeDex.StartInfo.CreateNoWindow         = true;
                makeDex.StartInfo.FileName               = envConfig.toolPath + @"\dx.bat";
                makeDex.StartInfo.RedirectStandardInput  = true;
                makeDex.StartInfo.RedirectStandardOutput = true;
                makeDex.StartInfo.RedirectStandardError  = true;
            }
            else
            {
                makeDex.StartInfo.FileName = envConfig.toolPath + @"\dx.bat";
            }
            makeDex.StartInfo.Arguments = "   --dex --output=" + tmpFolder + "temp.dex  " + tmpCls;

            makeDex.Start();
            line = "\r\n";
            if (this.isDebug() == false)
            {
                reader = makeDex.StandardOutput; //截取输出流
                line   = reader.ReadLine();      //每次读取一行
                while (!reader.EndOfStream)
                {
                    line  = reader.ReadLine();
                    line += "\r\n" + line;
                    richTxtInfo.AppendText(line);
                    richTxtInfo.SelectionStart = richTxtInfo.Text.Length;
                    richTxtInfo.ScrollToCaret();
                }
            }
            makeDex.WaitForExit();
            richTxtInfo.AppendText("\r\n  class文件生成完成\r\n");


            curEvent.Text = "生成smali";
            Process makeSmali = new Process();

            if (this.isDebug() == false)
            {
                makeSmali.StartInfo.UseShellExecute        = false;
                makeSmali.StartInfo.CreateNoWindow         = true;
                makeSmali.StartInfo.FileName               = envConfig.toolPath + @"\getSmali.bat";
                makeSmali.StartInfo.RedirectStandardInput  = true;
                makeSmali.StartInfo.RedirectStandardOutput = true;
                makeSmali.StartInfo.RedirectStandardError  = true;
            }
            else
            {
                makeSmali.StartInfo.FileName = envConfig.toolPath + @"\getSmali-debug.bat";
                MessageBox.Show("begin");
            }
            makeSmali.StartInfo.Arguments = targetPath + @"smali\   " + tmpFolder + "temp.dex  ";

            makeSmali.Start();
            line = "\r\n";
            if (this.isDebug() == false)
            {
                reader = makeSmali.StandardOutput; //截取输出流
                line   = reader.ReadLine();        //每次读取一行
                while (!reader.EndOfStream)
                {
                    line  = reader.ReadLine();
                    line += "\r\n" + line;
                    richTxtInfo.AppendText(line);
                    richTxtInfo.SelectionStart = richTxtInfo.Text.Length;
                    richTxtInfo.ScrollToCaret();
                }
            }
            makeSmali.WaitForExit();
            pbT.Value     = 75;
            pro.Value     = 75;
            lb.Text       = "75%";
            curEvent.Text = "smali  合并完成";
            richTxtInfo.AppendText("\r\n" + "smali  合并完成\r\n");
            FileUtil.deleteFolder(tmpR);
            FileUtil.deleteFolder(tmpCls);
            File.Delete(tmpFolder + "temp.dex");

            string packageFolder  = envConfig.targetPath + @game + @"\" + channel + @"\";
            string compileFolder  = envConfig.compileFolder + game + @"\";
            string mkTime         = DateTime.Now.ToString("yyyyMMddHHmmss");
            string compileApkName = channel + "_" + mkTime + ".apk";

            Process p = new Process();

            if (this.isDebug() == false)
            {
                p.StartInfo.UseShellExecute        = false;
                p.StartInfo.CreateNoWindow         = true;
                p.StartInfo.FileName               = envConfig.apkToolCommand;
                p.StartInfo.RedirectStandardInput  = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardError  = true;
            }
            else
            {
                p.StartInfo.FileName = envConfig.currenPath + @"\apktool\apktool-debug.bat";
            }
            string compileApk = compileFolder + compileApkName;

            p.StartInfo.Arguments = "  b  " + packageFolder + "  -o  " + compileApk;

            p.Start();
            line = "\r\n";
            if (this.isDebug() == false)
            {
                reader = p.StandardOutput;  //截取输出流
                line   = reader.ReadLine(); //每次读取一行
                while (!reader.EndOfStream)
                {
                    line  = reader.ReadLine();
                    line += "\r\n" + line;
                    richTxtInfo.AppendText(line);
                    richTxtInfo.SelectionStart = richTxtInfo.Text.Length;
                    richTxtInfo.ScrollToCaret();
                }
            }
            p.WaitForExit();
            pbT.Value     = 80;
            pro.Value     = 80;
            lb.Text       = "80%";
            curEvent.Text = channel + " 打包完成";
            richTxtInfo.AppendText("\r\n" + curEvent.Text + "\r\n");

            Process makeSign = new Process();

            // 签名-调用命令行输出
            //makeSign.StartInfo.UseShellExecute = false;
            //makeSign.StartInfo.CreateNoWindow = true;
            //makeSign.StartInfo.RedirectStandardInput = true;
            //makeSign.StartInfo.RedirectStandardOutput = true;
            //makeSign.StartInfo.RedirectStandardError = true;


            string signPwd      = txtSignPwd.Text.ToString();
            string keyStrorePwd = txtKeyPwd.Text.ToString();
            string keyStore     = lbPwdFile.Text.ToString();
            string alias        = txtAlias.Text.ToString();
            string releasePath  = envConfig.releasePkg + game + @"\";

            if (!Directory.Exists(releasePath))
            {
                Directory.CreateDirectory(releasePath);
            }
            string releaseApk = releasePath + game + "_" + compileApkName;

            //  makeSign.StartInfo.FileName = envConfig.signPath + "jarsigner";
            makeSign.StartInfo.FileName = "jarsigner";
            //  compileApk = @"C:\Users\win8\Desktop\123.apk";
            makeSign.StartInfo.Arguments = "  -digestalg SHA1 -sigalg MD5withRSA -verbose -keystore " + keyStore + " -storepass " + keyStrorePwd + " -keypass " + signPwd + " -signedjar  " + releaseApk + "  " + compileApk + "  " + alias;


            Clipboard.SetText(makeSign.StartInfo.FileName + " " + makeSign.StartInfo.Arguments);
            //     MessageBox.Show("beginSign");

            makeSign.Start();

            //reader = makeSign.StandardOutput;//截取输出流
            //line = "\r\n";
            //line = reader.ReadLine();//每次读取一行
            //while (!reader.EndOfStream)
            //{
            //    line = reader.ReadLine();
            //    line += "\r\n" + line;
            //    richTxtInfo.AppendText(line);
            //    richTxtInfo.SelectionStart = richTxtInfo.Text.Length;
            //    richTxtInfo.ScrollToCaret();
            //}

            makeSign.WaitForExit();

            pbT.Value     = 100;
            pro.Value     = 100;
            lb.Text       = "100%";
            curEvent.Text = channel + "签名完成";
            richTxtInfo.AppendText("\r\n" + curEvent.Text + "\r\n");


            //todo 加固
        }
Пример #12
0
        //       public Dictionary<string, string> allProperties = new Dictionary<string, string>();
        private void readPt()
        {
            PpHelper pptHelper = new PpHelper(propertiesFile);
            Dictionary <string, string> dic = null;

            try
            {
                dic = pptHelper.getAllProperties();
            }
            catch (Exception)
            {
                MessageBox.Show("获取gameConfig参数配置异常,请检查!");
                this.DialogResult = DialogResult.Cancel;
                return;
            }

            dicNum = dic.Count();
            int i = 1;

            foreach (KeyValuePair <string, string> p in dic)
            {
                //     this.allProperties.Add(p.Key, p.Value);
                TextBox txtBoxK = new TextBox();
                txtBoxK.Name     = "K_" + i.ToString();
                txtBoxK.Text     = p.Key;
                txtBoxK.Left     = 0;
                txtBoxK.Top      = i * 50;
                txtBoxK.Location = new Point(pannelPts.Location.X + 5, i * 25);
                pannelPts.Controls.Add(txtBoxK);

                Label l1 = new Label();
                l1.Text     = "=";
                l1.Location = new Point(112, i * 25);
                l1.Size     = new System.Drawing.Size(10, 23);
                pannelPts.Controls.Add(l1);

                TextBox txtBoxV = new TextBox();
                txtBoxV.Name = "V_" + i.ToString();
                txtBoxV.Text = p.Value;

                if (p.Key == "version")
                {
                    txtBoxV.Text = selGame.version;
                }

                //if (p.Key == "version" && selGame.version != p.Value)
                //{
                //    txtBoxV.Text = selGame.version;

                //    DialogResult dr = MessageBox.Show("游戏版本" + selGame.version + "号与打包参数" + p.Value + "不一致,确定采用游戏版本? ", "版本不一致!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                //    if (dr == DialogResult.OK)
                //    {
                //        txtBoxV.Text = selGame.version;
                //    }

                //}

                txtBoxV.Location = new Point(130, i * 25);
                txtBoxV.Size     = new System.Drawing.Size(230, 23);
                txtBoxV.Top      = i * 25;

                pannelPts.Controls.Add(txtBoxV);
                i++;
            }
        }