Exemple #1
0
        private void CreateManifest(GainTask gt)
        {
            int recid = gt.RecID;

            if (CreateFile(recid))
            {
                return;
            }
            string platformname    = gt.PlatFormName;
            string platformversion = gt.ChannelVersion;
            string myversion       = gt.MyVersion;
            string gamename        = gt.GameName;
            string gameid          = gt.GameID;
            string gameversion     = gt.GameVersion + "_" + gt.StrCollectDatetime;
            int    pluginid        = gt.PlugInID;
            string pluginversion   = gt.PlugInVersion;



            string SDKPackageDir = "";

            SDKPackageDir = System.Configuration.ConfigurationManager.AppSettings["SDKPackageDir"];
            //接入时生成的主项目配置
            string pfManifest = SDKPackageDir + "SDK\\Channel_SDK\\" + platformname + "\\" + platformversion + "\\MainActivity\\AndroidManifest.xml";
            //SDK基础库项目配置
            string typeManifest = SDKPackageDir + "SDK\\Type_SDK\\" + myversion + "\\lib\\TypeSDKBaseLibrary\\AndroidManifest.xml";
            //CP Unity项目生成的配置
            string gamefileManifest = SDKPackageDir + "game_file\\" + gameid + "\\" + gameversion + "\\AndroidManifest.xml";



            if (!System.IO.File.Exists(gamefileManifest))
            {
                string gamefile = System.Configuration.ConfigurationManager.AppSettings["SDKPackageDir"] + "game_file\\" + gameid + "\\" + gameversion + "\\";
                UnZip(gamefile + "game.zip", gamefile, "");
            }
            string pluginManifest = "";

            if (pluginid == 1)
            {
                pluginManifest = SDKPackageDir + "SDK\\Channel_SDK\\LeBian\\" + pluginversion + "\\MainActivity_LeBian\\AndroidManifest.xml";
            }

            string filepath          = SDKPackageDir + "SDK/Extra_Config/Manifest/" + recid + "/";
            string temporaryFilename = "";

            CopyManifest(filepath, pfManifest, typeManifest, gamefileManifest, pluginManifest, out temporaryFilename);
            string xmlfile = filepath + temporaryFilename + "/";

            try
            {
                string content = "";

                XmlDocument AndroidManifest1     = new XmlDocument();
                String      AndroidManifestFile1 = xmlfile + "1.xml";//渠道(主)
                //XmlDocument AndroidManifest2 = new XmlDocument();
                //String AndroidManifestFile2 = xmlfile + "2.xml";//
                //XmlDocument AndroidManifest3 = new XmlDocument();
                //String AndroidManifestFile3 = xmlfile + "3.xml";//gamefile

                AndroidManifest1.Load(AndroidManifestFile1);
                //AndroidManifest2.Load(AndroidManifestFile2);
                //AndroidManifest3.Load(AndroidManifestFile3);
                if (pluginid == 1)
                {
                    AndroidManifest1 = GetPrimaryAndroidManifest(AndroidManifest1);
                    GetManifest(xmlfile + "4.xml", AndroidManifest1.InnerXml, gt.PlatFormName, out content);
                    //插件需删除主xml中的一个activety android:name="com.galaxy.sdk.android.amigo.MainActivity"
                }
                GetManifest(xmlfile + "2.xml", pluginid == 0 ? AndroidManifest1.InnerXml : content, out content);
                GetManifest(xmlfile + "3.xml", content, out content);

                XmlDocument manifestxml = new XmlDocument();
                manifestxml.LoadXml(content);
                manifestxml.Save(filepath + "AndroidManifest.xml");


                //if (System.IO.Directory.Exists(xmlfile))
                //{
                //    System.IO.Directory.Delete(xmlfile, true);
                //}
            }
            catch (Exception)
            {
            }
        }
Exemple #2
0
        /// <summary>
        /// 获取一条任务
        /// </summary>
        private void GetTask()
        {
            string msg      = "";
            string platform = GameRequest.GetQueryString("platform");

            if (string.IsNullOrEmpty(platform))
            {
                msg = "{\"status\":\"error\",\"msg\":\"error03\"}";
            }
            else if (platform != "Android" && platform != "iOS")
            {
                msg = "{\"status\":\"error\",\"msg\":\"error03\"}";
            }
            else
            {
                if (platform == "Android")
                {
                    Message umsg = aideNativeWebFacade.GetGainTask(platform);
                    if (umsg.Success)
                    {
                        GainTask gt = umsg.EntityList[0] as GainTask;
                        if (gt.RecID == 0)
                        {
                            msg = "{\"status\":\"success\",\"msg\":\"no data now\",\"data\":null}";
                        }
                        else
                        {
                            string recid = gt.RecID.ToString();

                            try
                            {
                                CheckManifest(gt);
                            }
                            catch (Exception ex)
                            {
                                msg = "{\"status\":\"error99\",\"msg\":\"" + Server.UrlEncode(ex.Message) + "\",\"data\":null}"; Response.Write(msg);
                                PrintLog(recid, platform, msg);
                                PrintServerLog(recid, platform, "Manifest:" + msg);
                                string sql = string.Format(@"update {1} set PackageTaskStatus=4,FinishDatetime=getdate() where recid={0} and (PackageTaskStatus=2 or PackageTaskStatus=0)", recid, platform == "Android" ? "[sdk_NewPackageCreateTask]" : "[sdk_NewPackageCreateTask_IOS]");
                                aideNativeWebFacade.ExecuteSql(sql);
                                return;
                            }


                            //string urlHead = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "/";

                            string gameid             = gt.GameID;
                            string gamename           = gt.GameName;
                            string platFormName       = gt.PlatFormName;
                            string gameVersion        = gt.GameVersion;
                            string strCollectDatetime = gt.StrCollectDatetime;
                            string strIconPath        = gt.IconPath;
                            string strCreateTaskID    = gt.CreateTaskID;
                            string strmyversion       = gt.MyVersion;
                            string strChannelVersion  = gt.ChannelVersion;
                            string strIsEncryption    = gt.IsEncryption;
                            string strAdID            = gt.AdID;
                            int    strPlugInID        = gt.PlugInID;
                            string strPlugInVersion   = gt.PlugInVersion;
                            string strCompileMode     = gt.CompileMode;
                            string strKeyname         = gt.KeyName;

                            msg = "{\"status\":\"success\",\"msg\":\"gainTask_OK\",\"data\":[{\"TaskID\":\"" + recid + "\",\"Channel\":\"" + platFormName + "\",\"GameID\":\"" + gameid + "\",\"ChannelVersion\":\"" + strChannelVersion + "\",\"GameVersion\":\"" + gameVersion + "_" + strCollectDatetime + "\",\"IconID\":\"" + strIconPath + "\",\"BatchNo\":\"" + strCreateTaskID + "\",\"SdkVer\":\"" + strmyversion + "\",\"IsEncrypt\":\"" + strIsEncryption + "\",\"AdID\":\"" + strAdID + "\",\"PluginID\":\"" + strPlugInID + "\",\"PluginVersion\":\"" + strPlugInVersion + "\",\"CompileMode\":\"" + strCompileMode + "\",\"SignKey\":\"" + strKeyname + "\"}]}";

                            PrintLog(recid, platform, msg);
                        }
                    }
                    else
                    {
                        msg = "{\"status\":\"error\",\"msg\":\"error02\"}";
                    }
                }
                else
                {
                    Message umsg = aideNativeWebFacade.GetGainTask(platform);
                    if (umsg.Success)
                    {
                        GainTask gt = umsg.EntityList[0] as GainTask;
                        if (gt.RecID == 0)
                        {
                            msg = "{\"status\":\"success\",\"msg\":\"no data now\",\"data\":null}";
                        }
                        else
                        {
                            string urlHead            = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "/";
                            string recid              = gt.RecID.ToString();
                            string gameid             = gt.GameID;
                            string gamename           = gt.GameName;
                            string platFormName       = gt.PlatFormName;
                            string gameVersion        = gt.GameVersion;
                            string strCollectDatetime = gt.StrCollectDatetime;
                            string strIconPath        = gt.IconPath;
                            string strCreateTaskID    = gt.CreateTaskID;
                            string strmyversion       = gt.MyVersion;
                            string strChannelVersion  = gt.ChannelVersion;
                            string strgamenamespell   = gt.GameNameSpell;
                            string strunityver        = gt.UnityVer;
                            string strproductname     = gt.ProductName;

                            //msg = "{\"status\":\"success\",\"msg\":\"gainTask_OK\",\"data\":[{\"TaskID\":\"" + recid + "\",\"Channel\":\"" + platFormName.ToLower() + "\",\"GameID\":\"" + strgamenamespell + "\",\"GameVersion\":\"" + strCollectDatetime + "\",\"IconID\":\"" + strIconPath + "\",\"BatchNo\":\"" + strCreateTaskID + "\",\"SdkVer\":\"" + strmyversion + "\",\"GameFileName\":\"" + gameVersion + "\",\"UnityVer\":\"" + strunityver + "\",\"ProductName\":\"" + strproductname + "\"}]}";
                            msg = "{\"status\":\"success\",\"msg\":\"gainTask_OK\",\"data\":[{\"TaskID\":\"" + recid + "\",\"Channel\":\"" + platFormName + "\",\"GameID\":\"" + gameid + "\",\"ChannelVersion\":\"" + strChannelVersion + "\",\"GameVersion\":\"" + gameVersion + "\",\"CreateTime\":\"" + strCollectDatetime + "\",\"IconID\":\"" + strIconPath + "\",\"BatchNo\":\"" + strCreateTaskID + "\",\"SdkVer\":\"" + strmyversion + "\",\"GameFileName\":\"" + gamename + "\",\"UnityVer\":\"" + strunityver + "\",\"ProductName\":\"" + strproductname + "\"}]}";

                            PrintLog(recid, platform, msg);
                        }
                    }
                    else
                    {
                        msg = "{\"status\":\"error\",\"msg\":\"error02_2\"}";
                    }
                }
            }
            Response.Write(msg);
        }
Exemple #3
0
 private void CheckManifest(GainTask gt)
 {
     CreateManifest(gt);
 }