Пример #1
0
        private void SendLoadedNotice()
        {
            if (m_LoadedNoticeInfo.IsSendIDAsNotice && !m_LoadedNoticeInfo.IsReadyNoticeSend)
            {
                if (m_LoadedNoticeInfo.ApplyDefaultNoticeType)
                {
                    mIDAsNotice = Pooling <Notice> .From();
                }
                else
                {
                    ApplyCustomNotice();
                }

                if (m_LoadedNoticeInfo.ApplyCallLate)
                {
                    UpdaterNotice.SceneCallLater(SendLoadedNoticeAndRelease);
                }
                else
                {
                    SendLoadedNoticeAndRelease(0);
                }
            }
            else
            {
            }
        }
Пример #2
0
 private void ComponentUnitUpdateInScene(Action <int> target)
 {
     UpdaterNotice.SceneCallLater(target);
 }
Пример #3
0
        private void DuringDecompress()
        {
            if (!IsCompleted)
            {
                try
                {
                    int    size;
                    int    fixSize = 2048;
                    byte[] data;
                    string fileName;
                    while ((mEnt = mZipInputStream.GetNextEntry()) != null)
                    {
                        if (!string.IsNullOrEmpty(mEnt.Name))
                        {
                            fileName = Path.Combine(SavePath, mEnt.Name);

                            #region Android
                            fileName = fileName.Replace('\\', '/');

                            "log:Start uncompress zip, file name is {0}".Log(fileName);

                            if (fileName.EndsWith(StringUtils.PATH_SYMBOL))
                            {
                                Directory.CreateDirectory(fileName);
                                continue;
                            }
                            else
                            {
                            }
                            #endregion

                            FileStream = File.Create(fileName);

                            size = fixSize;
                            data = new byte[size];
                            while (true)
                            {
                                size = mZipInputStream.Read(data, 0, data.Length);

#if LOG_UNPRESS_ZIP
                                bool isReadAll = size <= 0;
                                if (isReadAll)
                                {
                                    "log:File {0} uncompress end.".Log(fileName);
                                }
                                else
                                {
                                    "log:Zip stream read size {0}".Log(size.ToString());
                                }
#endif
                                if (size > 0)
                                {
                                    FileStream.Write(data, 0, size);//解决读取不完整情况
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        else
                        {
                            "error".Log("Next Entry name is empty..");
                        }
                    }
                }
                catch (Exception e)
                {
                    "error:Zip exception {0}".Log(e.ToString());
                }
                finally
                {
                    if (FileStream != null)
                    {
                        FileStream.Close();
                        FileStream.Dispose();
                    }
                    else
                    {
                    }

                    if (mZipInputStream != null)
                    {
                        mZipInputStream.Close();
                        mZipInputStream.Dispose();
                    }
                    else
                    {
                    }

                    if (mEnt != null)
                    {
                        mEnt = null;
                    }
                    else
                    {
                    }

                    GC.Collect();
                    GC.Collect(1);

                    IsCompleted = true;
                    Operation   = ZipOperation.None;
                    UpdaterNotice.SceneCallLater((t) => { OnCompleted?.Invoke(); });
                }
            }
            else
            {
            }
        }