/// <summary>
        /// 版本检测结果
        /// </summary>
        /// <param name="result"></param>
        void VersionResult(VersionUpdateType type, VersionUpdateBody verPackageResp)
        {
            VersionInfoData.CurVersionUpdateType = type;
            switch (type)
            {
            //当前版本已是最新
            case VersionUpdateType.NoNeedUpdate:
            {
                if (startGameCor != null)
                {
                    StopCoroutine(startGameCor);
                }
                startGameCor = StartCoroutine(startGame());
            }
            break;

            //更新增量包
            case VersionUpdateType.PatchPackageUpdate:
            {
                List <PatchPackage> patchList = verPackageResp.res_list;
                HandlePatchPackageData(patchList);
            }
            break;

            //更新渠道包
            case VersionUpdateType.ChannelPackageUpdate:
            {
                showMsg("取消", delegate { closeMessageBox(); Application.Quit(); },
                        "版本过低,请前往商店下载最新版本",
                        "确定", delegate { closeMessageBox(); Application.OpenURL(verPackageResp.bin_url); Application.Quit(); });
            }
            break;
            }
        }
        public string GenerateVersionNumber(VersionUpdateType updateType, string chapVers)
        {
            string versionNumber = string.Empty;
            int    partA         = 0; //this the first part indicating any changes to chapter Name or Order
            int    partB         = 0; //this the second part indicating any changes to chapter content;

            //if changes made to Chapter name or document's chapter collection then increment first part of version

            partA = Int32.Parse(chapVers.Substring(0, 1));
            partB = Int32.Parse(chapVers.Substring(chapVers.IndexOf(".") + 1, chapVers.Length - (chapVers.IndexOf(".") + 1)));

            if (updateType == VersionUpdateType.Content)
            {
                partB++;
            }
            else if (updateType == VersionUpdateType.ChapterName)//if changes made to chapter content then increment second part of version.
            {
                partA++;
            }

            else if (updateType == VersionUpdateType.New)
            {
                return(chapVers);
            }

            versionNumber = partA.ToString() + "." + partB.ToString();
            return(versionNumber);
        }
Esempio n. 3
0
 public static ChapterVersion CreateChapterVersion(string docId, ChapterVersion chapterVersion, VersionUpdateType versionUpdateType)
 {
     return(Provider.CreateChapterVersion(docId, chapterVersion, versionUpdateType));
 }
        public override ChapterVersion CreateChapterVersion(string docId, ChapterVersion chapterVersion, VersionUpdateType versionUpdateType)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ChapterVersionDataStore dataStore = new ChapterVersionDataStore(transaction);


                int maxSequenceNumber = 0;

                if (versionUpdateType == VersionUpdateType.New)
                {
                    maxSequenceNumber = GetNewSequenceNo(docId); //only generate sequence number when adding a new chapter else use existing sequence number
                }
                else
                {
                    maxSequenceNumber = chapterVersion.Sequence;
                }

                chapterVersion.Version      = GenerateVersionNumber(versionUpdateType, chapterVersion.Version);
                chapterVersion.VersionOrder = GetVersionOrder(docId, chapterVersion.ChapterId);

                //if (!CheckChapterName(docId, chapterVersion.Name))
                // {
                ChapterVersion chapterVer = new ChapterVersion(docId, chapterVersion.ChapterId, chapterVersion.Name, chapterVersion.Content, chapterVersion.Version, chapterVersion.VersionOrder, maxSequenceNumber);

                dataStore.Insert(chapterVer);
                transaction.Commit();

                return(chapterVer);
                //}
                //else
                //  return chapterVersion;
            }
        }
Esempio n. 5
0
 public abstract ChapterVersion CreateChapterVersion(string docId, ChapterVersion chapterVersion, VersionUpdateType versionUpdateType);