Пример #1
0
        public Version.Version GetCurrentVersion(bool force = false)
        {
            if (currentVersion != null && !force)
            {
                return(currentVersion);
            }
            string filename = Platform.Path + Platform.AppVerFileName;

            if (FileManager.IsFileExist(filename))
            {
                try
                {
                    string version = FileManager.ReadAllText(filename);
                    if (!string.IsNullOrEmpty(version))
                    {
                        currentVersion = new Version.Version(version);
                        return(currentVersion);
                    }
                }
                catch (Exception e)
                {
                    Debuger.LogError(e.Message);
                    return(null);
                }
            }
            return(null);
        }
Пример #2
0
 private void RefAppVersion(Version.Version cur, Version.Version onl, bool isShowOnline = true)
 {
     if (UpdateGameObject)
     {
         if (isShowOnline)
         {
             OnlineAppVersionText.text = onl.Master + "." + onl.Minor + "." + onl.Revised;
         }
         CurrentAppVersionText.text = cur.Master + "." + cur.Minor + "." + cur.Revised;
     }
 }
Пример #3
0
        public IEnumerator DownloadAppFile()
        {
            SrcUrl = GameConfig.UpdateServer[m_urlIndex] + Platform.osDir + "/" + Platform.AppVerFileName;
            using (WWW w = new WWW(SrcUrl))
            {
                yield return(w);

                if (w.error != null)
                {
                    m_loadOver    = true;
                    onlineVersion = new Version.Version(w.text);
                    yield return(null);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 获取安装路径的存储信息
        /// </summary>
        /// <returns></returns>
        private IEnumerator LoadOldTableAndVersion()
        {
            isLoadOldTableAndVersion = false;
            string filepath = Platform.InitalPath + Platform.AppVerFileName;

#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_IPHONE
            filepath = "file:///" + filepath;
#endif
            using (WWW w = new WWW(filepath))
            {
                yield return(w);

                if (w.error != null)
                {
                    yield break;
                }
                initalVersion = new Version.Version(w.text);
            }
            filepath = Platform.InitalPath + Platform.Md5FileName;
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_IPHONE
            filepath = "file:///" + filepath;
#endif
            using (WWW w = new WWW(filepath))
            {
                yield return(w);

                if (w.error != null)
                {
                    yield break;
                }
                string   str    = w.text;
                string[] strarr = str.Split('\n');
                for (int i = 0; i < strarr.Length; i++)
                {
                    var pair = strarr[i].Split(',');
                    if (pair.Length == 3)
                    {
                        FileInfo fileInfo = new FileInfo();
                        fileInfo.fullname    = pair[0];
                        fileInfo.md5         = pair[1];
                        fileInfo.size        = int.Parse(pair[2]);
                        oldmd5Table[pair[0]] = fileInfo;
                    }
                }
            }
            filecount = oldmd5Table.Count;
            isLoadOldTableAndVersion = true;
        }