public override void Execute(object content)
        {
            base.Execute(content);

            PublishContent publishContent = _content as PublishContent;

            string versionFile      = publishContent.GetVersionPath() + "/version.xml";
            string cacheVersionFile = publishContent.GetRootPath() + "/version.xml";

            FileOperateUtil.CreateFileDirectory(versionFile);

            if (publishContent.bigVersion)
            {
                VersionContent versionContent = new VersionContent();
                versionContent.version = publishContent.version;
                versionContent.resUrl  = publishContent.resUrl;
                versionContent.Save(versionFile);

                string projectVersionFile = FileOperateUtil.GetRegPath(Application.dataPath + "/Resources/version.bytes");
                File.Copy(versionFile, projectVersionFile, true);
            }
            else
            {
                VersionContent versionContent = new VersionContent();
                if (File.Exists(cacheVersionFile))
                {
                    versionContent.Parse(File.ReadAllText(cacheVersionFile));
                }
                versionContent.version = publishContent.version;
                versionContent.resUrl  = publishContent.resUrl;

                ResVersion resVersion;
                resVersion.version = publishContent.resVersion;
                resVersion.url     = publishContent.updateFile;
                resVersion.md5     = publishContent.updateFileMD5;
                resVersion.size    = publishContent.updateFileSize;

                versionContent.resVersions.Add(resVersion);
                versionContent.Save(versionFile);
            }

            File.Copy(versionFile, cacheVersionFile, true);

            Success(publishContent);
        }
示例#2
0
        private void ResetVersion()
        {
            string path = PublishContent.GetPlatformPath(PublishContent.DEFINE_PUBLISH_PATH, this.mPlatform);
            string file = path + "/version.xml";

            if (File.Exists(file))
            {
                string         text           = File.ReadAllText(file);
                VersionContent versionContent = new VersionContent();
                versionContent.Parse(text);

                string[] vStrList = versionContent.version.Split('.');
                if (bigVersion)
                {
                    version    = vStrList[0] + "." + (Convert.ToInt32(vStrList[1]) + 1);
                    resVersion = version + ".0";
                }
                else
                {
                    if (versionContent.resVersions.Count > 0)
                    {
                        resVersion = versionContent.resVersions[versionContent.resVersions.Count - 1].version;
                    }
                    else
                    {
                        resVersion = versionContent.version + ".0";
                    }
                    string[] resVStrList = resVersion.Split('.');
                    resVersion = resVStrList[0] + "." + resVStrList[1] + "." + (Convert.ToInt32(resVStrList[2]) + 1);
                    version    = versionContent.version;
                }
            }
            else
            {
                version    = "1.0";
                resVersion = "1.0.0";
            }
        }