Example #1
0
 private void GetNext()
 {
     if (Filelist.Count == 0)
     {
         return;
     }
     this.NowFile = Filelist.Dequeue();
     this.Stream  = new FileStream(this.NowFile.FileName, FileMode.Create);
 }
Example #2
0
    /// <summary>
    /// 解析下载并更新数据
    /// </summary>
    protected void ParseDownLoadAndUpdateData()
    {
        ///加载本地的.config
        string path = mLocalDataFolder + "filelist.config";

        if (!File.Exists(path))
        {
            if (mLocalDataListInfo == null)
            {
                mLocalDataListInfo = new Filelist();
            }
        }
        else
        {
            FileStream   stream = new FileStream(path, FileMode.Open);
            StreamReader reader = new StreamReader(stream);
            try
            {
                mLocalDataListInfo = JsonMapper.ToObject <Filelist>(reader.ReadToEnd());
                reader.Close();
                stream.Close();
            }
            catch (Exception exception)
            {
                Debug.Log(exception.Message);
                string str2 = reader.ReadToEnd();
                if (str2 == null)
                {
                    Debug.Log("reader.ReadToEnd() = null");
                }
                else
                {
                    Debug.Log("reader.ReadToEnd().Len = " + str2.Length);
                }
                reader.Close();
                stream.Close();
                mLocalDataListInfo = new Filelist();
            }
        }

        ///对比本地文件列表与服务器列表数据
        UpdateTool.GetDiff(ref UpdateTool.Instance.mDownData, ref mRemoveData, mLocalDataListInfo, mServerFileListInfo);
        //统计总下载数据大小
        uint num = 0;

        for (int i = 0; i < UpdateTool.Instance.mDownData.Count; i++)
        {
            num += UpdateTool.Instance.mDownData[i].mSize;
        }

        ContinueDownLoad(num.ToString());
    }
        public static Filelist GetFilesRecursive(string path)
        {
            // Store results in the file results list.
            var result = new Filelist();

            // Store a stack of our directories.
            var stack = new Stack <string>();

            // Add initial directory.
            stack.Push(path);

            // Continue while there are directories to process
            while (stack.Count > 0)
            {
                // Get top directory
                var dir = stack.Pop();

                foreach (var i in Directory.GetFiles(dir, "*.*"))
                {
                    using (var fstream = File.OpenRead(i))
                    {
                        var array = new byte[fstream.Length];
                        fstream.Read(array, 0, array.Length);
                        result.Add(new FileModel {
                            Path = i.Substring(path.Length), Data = array
                        });
                    }
                }

                // Add all directories at this directory.
                foreach (var dn in Directory.GetDirectories(dir))
                {
                    stack.Push(dn);
                }
            }
            return(result);
        }
Example #4
0
    //public static bool CheckAllRes(Filelist localListInfo)
    //{
    //    string ResPath = AssetManager.StreamingBase;
    //    if (localListInfo == null)
    //    {
    //        return false;
    //    }

    //    Dictionary<string, ResData> dataList = localListInfo.filelist;
    //    foreach (KeyValuePair<string, ResData> respair in dataList)
    //    {
    //        if (!File.Exists(ResPath + respair.Value.mDataPath))
    //        {
    //            return false;
    //        }
    //    }

    //    return true;
    //}


    /// <summary>
    /// 文件差异
    /// </summary>
    /// <param name="downLoadList"></param>
    /// <param name="removeList"></param>
    /// <param name="localListInfo"></param>
    /// <param name="serverListInfo"></param>
    public static void GetDiff(ref List <ResData> downLoadList, ref List <ResData> removeList, Filelist localListInfo, Filelist serverListInfo)
    {
        ///检查更新
        foreach (KeyValuePair <string, ResData> serverfile in serverListInfo.filelist)
        {
            if (!localListInfo.filelist.ContainsKey(serverfile.Key))
            {
                downLoadList.Add(serverfile.Value);
                continue;
            }
            if (!localListInfo.filelist[serverfile.Key].mDataMD5.Equals(serverfile.Value.mDataMD5))
            {
                downLoadList.Add(serverfile.Value);
                continue;
            }
        }

        //检查需要移除的资源
        foreach (KeyValuePair <string, ResData> localfile in localListInfo.filelist)
        {
            if (!serverListInfo.filelist.ContainsKey(localfile.Key))
            {
                removeList.Add(localfile.Value);
            }
        }
    }
Example #5
0
    IEnumerator StartCoroutine()
    {
        Debug.Log(Environment.CurrentDirectory);
        Type entryType = Type.GetType("EntryEngine.Entry");

        if (entryType == null)
        {
            Loader loader = new Loader();
            if (Application.platform != RuntimePlatform.WindowsEditor && !string.IsNullOrEmpty(ServerUrl))
            //if (!string.IsNullOrEmpty(ServerUrl))
            {
                text = "正在检测版本更新";

                // 检查版本更新进行热更
                WaitForEndOfFrame wait    = new WaitForEndOfFrame();
                float             timeout = 0;
                WWW    www          = new WWW(ServerUrl + VERSION);
                byte[] versionBytes = null;
                while (true)
                {
                    if (www.isDone)
                    {
                        if (string.IsNullOrEmpty(www.error))
                        {
                            versionBytes = www.bytes;
                        }
                        else
                        {
                            text = "107:" + www.error;
                        }
                        break;
                    }
                    else
                    {
                        timeout += Time.deltaTime;
                        if (timeout >= 2)
                        {
                            // 下载超时
                            text = "下载超时,请检查网络后再试";
                            break;
                        }
                        yield return(wait);
                    }
                }
                //HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(ServerUrl + VERSION);
                //request.Timeout = 5000;
                //request.ContentType = "application/x-www-form-urlencoded";
                //bool isDone = false;
                //request.BeginGetResponse((ar) =>
                //{
                //    try
                //    {
                //        var response = request.EndGetResponse(ar);
                //        versionBytes = new byte[8];
                //        response.GetResponseStream().Read(versionBytes, 0, 8);
                //        response.Close();
                //    }
                //    catch (Exception ex)
                //    {
                //        text = ex.Message;
                //    }
                //    isDone = true;
                //}, request);

                if (versionBytes != null)
                {
                    byte[] newVersionBytes = null;
                    if (!loader.Load(VERSION))
                    {
                        yield return(loader.www);
                    }
                    {
                        for (int i = 0; i < 8; i++)
                        {
                            if (loader.bytes[i] != versionBytes[i])
                            {
                                // 需要更新版本
                                newVersionBytes = versionBytes;
                                break;
                            }
                        }
                    }

                    if (newVersionBytes != null)
                    {
                        text = "正在计算更新包大小";

                        www = new WWW(ServerUrl + FILE_LIST);
                        yield return(www);

                        if (!string.IsNullOrEmpty(www.error))
                        {
                            text = "169:" + www.error;
                            yield break;
                        }

                        if (!loader.Load(FILE_LIST))
                        {
                            yield return(loader.www);
                        }
                        string[] oldList          = ReadString(loader.bytes).Split(SPLIT, StringSplitOptions.RemoveEmptyEntries);
                        byte[]   newFilelistBytes = www.bytes;
                        string[] newList          = ReadString(newFilelistBytes).Split(SPLIT, StringSplitOptions.RemoveEmptyEntries);

                        // 暂时不删除不需要了的文件,只列出需要下载的新文件或者需要更新的文件
                        Dictionary <string, Filelist> oldFilelist = new Dictionary <string, Filelist>();
                        foreach (var item in oldList)
                        {
                            string[] splits = item.Split('\t');
                            Filelist file   = new Filelist();
                            file.File   = splits[0];
                            file.Time   = splits[1];
                            file.Length = long.Parse(splits[2]);
                            oldFilelist.Add(splits[0], file);
                        }

                        List <Filelist> newFilelist = new List <Filelist>();
                        foreach (var item in newList)
                        {
                            string[] splits = item.Split('\t');
                            Filelist file;
                            if (oldFilelist.TryGetValue(splits[0], out file))
                            {
                                // 时间不一致需要更新
                                if (file.Time != splits[1])
                                {
                                    file.Length = long.Parse(splits[2]);
                                    newFilelist.Add(file);
                                }
                            }
                            else
                            {
                                // 需要下载的新文件
                                file        = new Filelist();
                                file.File   = splits[0];
                                file.Time   = splits[1];
                                file.Length = long.Parse(splits[2]);
                                newFilelist.Add(file);
                            }
                        }

                        // 可能只是删除了文件,导致没有需要更新的文件
                        if (newFilelist.Count > 0)
                        {
                            long needDownload = newFilelist.Sum(f => f.Length) >> 10;
                            long download     = 0;
                            text = string.Format("正在更新:{0}kb", needDownload);
                            foreach (var item in newFilelist)
                            {
                                www = new WWW(ServerUrl + item.File);
                                yield return(www);

                                if (!string.IsNullOrEmpty(www.error))
                                {
                                    text = string.Format("229: file: {0} error: {1} len: {2} text:{3}", item.File, www.error, item.File.Length, string.Join(",", item.File.Select(c => ((int)c).ToString()).ToArray()));
                                    yield break;
                                }

                                item.File = item.File.Replace('\\', '/');
                                string dir = Path.GetDirectoryName(item.File);
                                if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
                                {
                                    Directory.CreateDirectory(dir);
                                }
                                File.WriteAllBytes(item.File, www.bytes);
                                // todo:每完成一个下载都写入旧文件列表,这样中途退出下次也能接着上次中断的文件开始下载
                                download += item.Length >> 10;
                                text      = string.Format("正在更新:{0}kb / {1}kb", download, needDownload);
                            }
                            File.WriteAllBytes(FILE_LIST, newFilelistBytes);
                        }

                        File.WriteAllBytes(VERSION, newVersionBytes);
                        Debug.Log("版本更新完成 {0}" + BitConverter.ToInt64(newVersionBytes, 0));
                    }
                }// end of if (www.error)
            }

            text = "正在准备运行环境";

            if (!loader.Load(RUNTIME))
            {
                yield return(loader.www);
            }
            {
                // 加载EntryEngine
                Assembly assembly = AppDomain.CurrentDomain.Load(loader.bytes, null);
                // 调用dll自解析
                Type       type   = assembly.GetType("Program");
                MethodInfo method = type.GetMethod("Main", BindingFlags.Public | BindingFlags.Static);
                method.Invoke(null, new object[1] {
                    null
                });
                Debug.Log("Load runtime completed.");
            }

            if (!loader.Load(FILE_LIST))
            {
                yield return(loader.www);
            }
            {
                string[] list = Encoding.UTF8.GetString(loader.bytes).Split(SPLIT, StringSplitOptions.RemoveEmptyEntries);
                // 从1开始,第0个元素是UnityRuntime.bytes
                for (int i = 1; i < list.Length; i++)
                {
                    string dllFile = list[i].Split('\t')[0];
                    if (!dllFile.EndsWith(".bytes"))
                    {
                        break;
                    }
                    if (!loader.Load(dllFile))
                    {
                        yield return(loader.www);
                    }
                    AppDomain.CurrentDomain.Load(loader.bytes, null);
                    Debug.Log(string.Format("加载{0}完成", dllFile));
                }
            }
        }

        text = "程序即将启动";

        // 创建Unity入口
        Assembly unity    = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == "Unity");
        Type     gateType = unity.GetType("EntryEngine.Unity.UnityGate");
        var      gate     = gameObject.AddComponent(gateType);

        // 设置同名属性
        //Debug.Log(gateType.GetProperty("Gate", BindingFlags.Public | BindingFlags.Static).GetValue(null, new object[0]));  // 测试是否已经执行了Start: 没有执行
        //var fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
        //for (int i = 0; i < fields.Length; i++)
        //    gateType.GetField(fields[i].Name, BindingFlags.Public | BindingFlags.Static).SetValue(null, fields[i].GetValue(this));
        gateType.GetField("GLMaterial", BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).SetValue(gate, GLMaterial);

        // 等待帧结束,让入口Start调用完毕
        yield return(new WaitForEndOfFrame());

        // 加载游戏入口场景
        Assembly client = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == "Client");
        // 使用入口展示场景实例 entry.ShowMainScene<T>();
        PropertyInfo entry = gateType.GetProperty("Entry");

        entry.PropertyType.GetMethod("ShowMainScene", Type.EmptyTypes).
        MakeGenericMethod(client.GetType("MAIN")).
        Invoke(entry.GetValue(gate, new object[0]), new object[0]);

        // 移除加载程序
        DestroyImmediate(this);
    }
Example #6
0
 public void Add(UpFileInfo item)
 {
     Filelist.Enqueue(item);
 }
Example #7
0
 private static Filelist getFiles()
 {
     Filelist objFilelist = new Filelist ();
     List<String> arrFile = new List<String> ();
     string[] arrFileFormats = new string[] { "ogg", "mp3", "mp4", "wav" };
     foreach(string format in arrFileFormats) {
         String[] _tmp = Directory.GetFiles (@".", "*." + format, SearchOption.AllDirectories);
         arrFile = arrFile.Concat (_tmp.ToList()).ToList();
     }
     foreach(String _file in arrFile) {
         string[] tmpScreenFilename = _file.Split (Path.DirectorySeparatorChar);
         string screenFilename = "";
         screenFilename = tmpScreenFilename [tmpScreenFilename.Length - 1];
         if (screenFilename.Length > (Console.WindowWidth - 1) / 2) {
             screenFilename = screenFilename.Substring (0, ((Console.WindowWidth - 1) / 2) - Constants.SCREEN_FILENAME_OFFSET);
         }
         PlaylistItem objPlaylistItem = new PlaylistItem ();
         objPlaylistItem.setFilename (screenFilename);
         objPlaylistItem.setFullPath (Path.GetFullPath(_file));
         objFilelist.addItem (objPlaylistItem);
     }
     return objFilelist;
 }
Example #8
0
 public static void start()
 {
     int intCursorStartPos = Constants.DEFAULT_CURSOR_START_Y_POS;
     int intCursorCurrentPos = intCursorStartPos;
     int intMaxNumberOfItems = Console.WindowHeight - Constants.NUM_OF_ITEMS_OFFSET; // 3 for top, 3 for bottom
     int playlistStateCounter = 0;
     Playlist objPlaylist = new Playlist ();
     Filelist objFilelist = new Filelist ();
     // Get Files
     objFilelist = getFiles ();
     // Build Screen
     buildScreen();
     objFilelist.showFilelist (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_X_OFFSET , Constants.FILELIST_Y_OFFSET);
     Util.WritePos (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " 1/" + objFilelist.getPages().ToString(), ConsoleColor.DarkRed, Util.BACKGROUND);
     Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorStartPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
     do {
         while(! Console.KeyAvailable) {
             switch(Console.ReadKey(true).Key) {
                 case ConsoleKey.DownArrow:
                         intCursorCurrentPos++;
                         if(intCursorCurrentPos > (intMaxNumberOfItems + intCursorStartPos - 1)) { intCursorCurrentPos = (intMaxNumberOfItems + intCursorStartPos - 1); }
                         if(objFilelist.getFilelist().Count <= (intCursorCurrentPos - intCursorStartPos) + (intMaxNumberOfItems * objFilelist.getPageOffset())) {
                             intCursorCurrentPos--;
                         }
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS, intCursorCurrentPos - 1, "   ", ConsoleColor.Blue, Util.BACKGROUND);
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorCurrentPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
                 break;
                 case ConsoleKey.UpArrow:
                         intCursorCurrentPos--;
                         if(intCursorCurrentPos < intCursorStartPos) { intCursorCurrentPos = intCursorStartPos; }
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS, intCursorCurrentPos + 1, "   ", ConsoleColor.Blue, Util.BACKGROUND);
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorCurrentPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
                     break;
                 case ConsoleKey.LeftArrow:
                     break;
                 case ConsoleKey.RightArrow:
                     break;
                 case ConsoleKey.Delete:
                     break;
                 case ConsoleKey.W:
                         // TODO: Switch windows: File list to play list and vice versa
                     break;
                 case ConsoleKey.F1:
                         objPlaylist.pageOffsetInc();
                         if(objPlaylist.getPageOffset() > (objPlaylist.getPages() - 1)) { objPlaylist.setPageOffset(objPlaylist.getPages() - 1); }
                         objPlaylist.showPlaylist (Constants.PLAYLIST_X_OFFSET, Constants.PLAYLIST_Y_OFFSET);
                         Util.WritePos (Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objPlaylist.getPageOffset() + 1).ToString() + "/" + objPlaylist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                     break;
                 case ConsoleKey.F2:
                         objPlaylist.pageOffsetDec();
                         if(objPlaylist.getPageOffset() < 0) { objPlaylist.setPageOffset(0); }
                         objPlaylist.showPlaylist (Constants.PLAYLIST_X_OFFSET, Constants.PLAYLIST_Y_OFFSET);
                         Util.WritePos (Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objPlaylist.getPageOffset() + 1).ToString() + "/" + objPlaylist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                     break;
                 case ConsoleKey.F6:
                         objFilelist.pageOffsetInc();
                         intCursorCurrentPos = intCursorStartPos;
                         if(objFilelist.getPageOffset() > (objFilelist.getPages() - 1)) { objFilelist.setPageOffset(objFilelist.getPages() - 1); }
                         objFilelist.showFilelist (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_X_OFFSET , Constants.FILELIST_Y_OFFSET);
                         Util.WritePos (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objFilelist.getPageOffset() + 1).ToString() + "/" + objFilelist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorCurrentPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
                     break;
                 case ConsoleKey.F7:
                         objFilelist.pageOffsetDec();
                         intCursorCurrentPos = intCursorStartPos;
                         if(objFilelist.getPageOffset() < 0) { objFilelist.setPageOffset(0); }
                         objFilelist.showFilelist (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_X_OFFSET , Constants.FILELIST_Y_OFFSET);
                         Util.WritePos (((Console.WindowWidth - 1) / 2) + Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objFilelist.getPageOffset() + 1).ToString() + "/" + objFilelist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                         Util.WritePos(((Console.WindowWidth - 1) / 2) + Constants.DEFAULT_CURSOR_START_X_POS , intCursorCurrentPos, "-->", ConsoleColor.Blue, Util.BACKGROUND);
                     break;
                 case ConsoleKey.S:
                         if(objPlaylist.getName() == "") {
                             Util.WritePos(Constants.PLAYLIST_NAME_X_OFFSET, Constants.PLAYLIST_NAME_Y_OFFSET, "Enter playlist name: ");
                             objPlaylist.setName(Console.ReadLine());
                         }
                         if(objPlaylist.getName().Substring(objPlaylist.getName().LastIndexOf(".") + 1) == objPlaylist.getName()) {
                             objPlaylist.setName(objPlaylist.getName() + "." + objPlaylist.getFileFormat());
                         } else {
                             objPlaylist.setFileFormat(objPlaylist.getName().Substring(objPlaylist.getName().LastIndexOf(".") + 1));
                         }
                         Writer objWriter = new Writer(objPlaylist);
                         objWriter.writeFile();
                     break;
                 case ConsoleKey.Enter:
                         playlistStateCounter++;
                         if(playlistStateCounter > intMaxNumberOfItems) {
                             playlistStateCounter = 1; objPlaylist.pageOffsetInc();
                             Util.WritePos (Constants.FILELIST_PAGE_OFFSET, Console.WindowHeight - 1, " " + (objPlaylist.getPageOffset() + 1).ToString() + "/" + objPlaylist.getPages().ToString() + " ", ConsoleColor.DarkRed, Util.BACKGROUND);
                         }
                         PlaylistItem objPlaylistItem = new PlaylistItem();
                         objPlaylistItem.setFilename(objFilelist.getFilelist()[(intCursorCurrentPos - intCursorStartPos) + (intMaxNumberOfItems * objFilelist.getPageOffset())].getFilename());
                         objPlaylistItem.setFullPath(objFilelist.getFilelist()[(intCursorCurrentPos - intCursorStartPos) + (intMaxNumberOfItems * objFilelist.getPageOffset())].getFullPath());
                         objPlaylist.addItem(objPlaylistItem);
                         objPlaylist.showPlaylist (Constants.PLAYLIST_X_OFFSET, Constants.PLAYLIST_Y_OFFSET);
                     break;
                 case ConsoleKey.Escape:
                         Console.BackgroundColor = ConsoleColor.Black;
                         Console.Clear();
                         Environment.Exit(-1);
                     break;
             }
         }
     } while(Console.ReadKey(true).Key != ConsoleKey.Escape);
 }
Example #9
0
    //------------------------------------------------------------------------------------------
    /// <summary>
    /// 检测资源
    /// </summary>
    //public void CheckResource()
    //{
    //    string path = mLocalDataFolder + "/filelist.config";
    //    if (!File.Exists(path))
    //    {
    //        ///本地目录没有filelist,从服务器下载
    //        BehaviourUtil.StartCoroutine(LoadFileListFromServer());
    //    }
    //    else
    //    {
    //        FileStream stream = new FileStream(path, FileMode.Open);
    //        StreamReader reader = new StreamReader(stream);
    //        try
    //        {
    //            mLocalDataListInfo = JsonMapper.ToObject<Filelist>(reader.ReadToEnd());
    //        }
    //        catch (Exception exception)
    //        {
    //            string str2 = reader.ReadToEnd();
    //            if (str2 == null)
    //            {
    //                GameDebug.Log("reader.ReadToEnd() = null");
    //            }
    //            else
    //            {
    //                GameDebug.Log("reader.ReadToEnd().Len = " + str2.Length);
    //            }
    //            GameDebug.Log(reader.ReadToEnd());
    //            GameDebug.Log(exception.ToString());
    //            reader.Close();
    //            stream.Close();
    //            BehaviourUtil.StartCoroutine(LoadFileListFromServer());
    //            return;
    //        }
    //        reader.Close();
    //        stream.Close();

    //        if (!UpdateTool.CheckAllRes(mLocalDataListInfo))
    //        {
    //            BehaviourUtil.StartCoroutine(LoadFileListFromServer());
    //        }
    //        else
    //        {
    //            UpdateComplete(false);
    //        }
    //    }
    //}


    /// <summary>
    /// 从服务器下载文件列表
    /// </summary>
    /// <returns></returns>
    private IEnumerator LoadFileListFromServer()
    {
        #region 更新miniClient

#if !UNITY_EDITOR && UNITY_ANDROID && False
        //鉴于应用宝平台有增量更新设置,此功能暂时屏蔽
        string appversion = GameConfig.ServerAppURL + GameConfig.AppVersionPath;

        WWW appvWWW = new WWW(appversion);
        yield return(appvWWW);

        if (string.IsNullOrEmpty(appvWWW.error))
        {
            int  serverversion = AppVersion.VersionID;
            bool versionok     = true;

            serverversion = Convert.ToInt32(appvWWW.text);
            AppVersion.ServerAppVersion = serverversion;
            if (versionok)
            {
                if (serverversion != AppVersion.VersionID)
                {
                    //更新客户端
                    string appURL = GameConfig.ServerAppURL + GameConfig.AppPath;
                    UpdateTool.Instance.UpdateClient(appURL);
                    yield break;
                }
            }
        }
#endif
        #endregion

        WWW filelistWWW = null;
        //获取服务器上当前的版本信息
        string sVPath = GameConfig.AssetServerURL + GameConfig.AssetVersion;

        filelistWWW = new WWW(sVPath);
        yield return(filelistWWW);

        if (!string.IsNullOrEmpty(filelistWWW.error))
        {
            UpdateFailed();
            yield break;
        }
        AppVersion.assetVersion = JsonMapper.ToObject <AssetVersion>(filelistWWW.text);

        if (AppVersion.assetVersion == null || string.IsNullOrEmpty(AppVersion.assetVersion.version))
        {
            AppVersion.assetVersion.version = AppSystemInfo.appInfo.versionName;
        }


        string versiondata = GameConfig.GetRealSrvDataPath(AppVersion.assetVersion.version) + GameConfig.DataversionPath;
        filelistWWW = new WWW(versiondata);
        yield return(filelistWWW);

        if (!string.IsNullOrEmpty(filelistWWW.error))
        {
            UpdateFailed();
            yield break;
        }

        //加载本地的config

        mServerRes = JsonMapper.ToObject <ResVersion>(filelistWWW.text);
        AssetParam param = new AssetParam();
        yield return(AssetManager.instance.LoadResource("dataversion.config", param));

        if (param.asset == null || param.asset.Data == null)
        {
            UpdateFailed();
            yield break;
        }

        string     text      = param.asset.Data.text;
        ResVersion localresv = JsonMapper.ToObject <ResVersion>(text);

        if (localresv == null || mServerRes == null)
        {
            UpdateComplete(false);
            NotifyProcess(1, "资源更新失败...");
            yield break;
        }
        //测试:走下面的流程
        if (mServerRes.md5 == localresv.md5)
        {
            UpdateComplete(false);
            yield break;
        }


        NotifyProcess(0, "检查资源更新...");

        //服务器上的filelist
        string filelistpath = string.Format("{0}filelist.config", GameConfig.GetRealSrvDataPath(AppVersion.assetVersion.version));

        filelistWWW = new WWW(filelistpath);
        yield return(filelistWWW);

        if (!string.IsNullOrEmpty(filelistWWW.error))
        {
            //TODO:处理加载失败

            UpdateFailed();
            yield break;
        }

        string configdata = filelistWWW.text;

        if (string.IsNullOrEmpty(configdata))
        {
            //有错误
            UpdateFailed(string.Empty);
            yield break;
        }

        mServerFileListInfo = JsonMapper.ToObject <Filelist>(configdata);

        filelistWWW.Dispose();


        if (mServerFileListInfo != null)
        {
            ParseDownLoadAndUpdateData();
        }
        else
        {
            UpdateFailed(string.Empty);
        }
    }