Example #1
0
    // 获取需要更新的ab资源文件
    public static string GetABResUpdateFile(ResVersionInfo oldABVer, ResVersionInfo newABVer)
    {
        if (newABVer == null)
        {
            return(string.Empty);
        }

        int inewABVer = newABVer.m_ABResVersion;

        if (oldABVer == null)
        {
            if (inewABVer == 0)
            {
                return("ab.zip");
            }
            else
            {
                return("ab" + newABVer.m_ABResVersion + ".zip");
            }
        }
        else
        {
            int ioldABVer = oldABVer.m_ABResVersion;
            if (inewABVer > ioldABVer)
            {
                return("ab" + inewABVer + "-" + ioldABVer + ".zip");
            }
            else
            {
                return(string.Empty);
            }
        }
    }
Example #2
0
    // 解析资源版本。
    public static ResVersionInfo Analyse(string Path)
    {
        ResVersionInfo Info = new ResVersionInfo();
        StreamReader   sr;

        try{
            sr = File.OpenText(Path);
        }
        catch (Exception e)
        {
            return(null);
        }

        string line;

        while ((line = sr.ReadLine()) != null)
        {
            if (line.StartsWith("ABResVersion"))
            {
                Info.m_ABResVersion = int.Parse(line.Replace("ABResVersion = ", ""));
            }
        }

        //关闭流
        sr.Close();
        //销毁流
        sr.Dispose();
        return(Info);
    }
Example #3
0
        public void Start()
        {
            ProgressID_         = StageProgressID.Idle;
            ProgressValue_      = 0;
            ResVersionInfo_     = null;
            CurrentVersionInfo_ = null;
            ResPatchInfoList_   = null;
            CurrentPatchInfo_   = null;
            ErrorCode_          = ErrorCode.Ok;
            ErrorInfo_          = string.Empty;
            ContentInfo_        = string.Empty;

            Pipline_ = new Pipline();
            Pipline_.InitStage(this);

            Downloader.StopAllTask();
        }
Example #4
0
        protected override void OnEnter()
        {
            Updater_.SetProgressID(StageProgressID.GetResVersionBegin);
            Updater_.SetProgressValue(0);
            Updater_.ClearError();

            ResVersionInfo VersionInfo = UpdateTool.GetResVersionInfo();

            if (VersionInfo == null)
            {
                StageCode_ = StageCode.Failed;
                Updater_.SetError(ErrorCode.GetResVersionInfoFailed, UpdateTool.VersionInfoPath_);
            }
            else
            {
                Updater_.SetResVersionInfo(VersionInfo);
                Updater_.SetCurrentVersionInfo(VersionInfo.Version_);
                StageCode_ = StageCode.Succeeded;
            }

            Updater_.SetProgressID(StageProgressID.GetResVersionEnd);
            Updater_.SetProgressValue(1.0f);
        }
Example #5
0
 public void SetResVersionInfo(ResVersionInfo VersionInfo)
 {
     ResVersionInfo_ = VersionInfo;
 }