Exemple #1
0
        private bool CheckForConflicts(Package[] installedPackages)
        {
            bool hasConflicts = installedPackages.Any(p => p.HasConflict);

            if (!hasConflicts)
            {
                return(true);
            }

            var conflicts = UpdateMgr.GetConflictPackageList(installedPackages);

            DisplayMgr.List("PACKAGE CONFLICTS", conflicts, displayDetails: true);

            Console.WriteLine();
            Console.WriteLine("Conflicting Package Versions Exist.  Enter 'Y' to Fix:");

            var input = Console.ReadLine();

            if (input == "Y")
            {
                UpdateMgr.ApplyProjectUpdate(conflicts, new string[] {});
                return(true);
            }
            return(false);
        }
Exemple #2
0
 private void Awake()
 {
     this.UpdateMgr   = new UpdateMgr();
     this.resourceMgr = new AssetBundleMgr();
     this.resourceMgr.Init();
     this.UpdateResource();
 }
Exemple #3
0
        private bool CheckForUpdates(Package[] installedPackages)
        {
            bool hasUpdates = installedPackages.Any(p => p.HasUpdate);

            if (!hasUpdates)
            {
                return(false);
            }

            var updates = UpdateMgr.GetUpdatePackageList(installedPackages);

            DisplayMgr.List("PACKAGE UPDATES", updates);

            Console.WriteLine();
            Console.WriteLine("Updated Package Versions Exist.  Enter 'Y' to Update:");

            var input = Console.ReadLine();

            if (input == "Y")
            {
                Console.WriteLine("[Enter] for all packages.");
                Console.WriteLine("...or comma separated list of package names starting with:");

                var names = Console.ReadLine().Replace(" ", "").Split(',');

                UpdateMgr.ApplyProjectUpdate(updates, names);
                return(true);
            }
            return(false);
        }
Exemple #4
0
 private void Awake()
 {
     Instance = this;
     this.InitLog();
     this.updateMgr = new UpdateMgr();
     this.updateMgr.Init();
 }
Exemple #5
0
    public void tStart()
    {
        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append(DownloadCachePath);
        Utils.SB.Append("/");
        Utils.SB.Append(DownloadOverFileName);
        string path = Utils.SB.ToString();

        Utils.ClearSB();

        if (!FileHelper.BeFileExist(path))
        {
            LogMgr.I("CopyRes", "tStart", "下载中目录不存在下载完成标志,掠过资源覆盖阶段,直接进入updateComplete");
            //没有下载完成标识文件,不需要复制过程,
            UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.updateComplete);
            return;
        }

        //NTODO 这里需要返回进度,另外要最后再移动resVer

        //有下载完成标识,准备开始移动覆盖文件
        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append(DownloadCachePath);
        string _srcPath = Utils.SB.ToString();

        Utils.ClearSB();

        Listener <float> progressCB = (progress) =>
        {
            //发出进度事件
            float progress1 = progress * 0.9f;
            LogMgr.I("CopyRes", "tStart", "移动文件夹进度:" + progress + " 整体copy进度:" + progress1, BeShowLog);
            ntools.Messenger.Broadcast <float>("updateLoadingProgress", progress1);
        };

        Listener onComplete = () =>
        {
            LogMgr.I("CopyRes", "tStart", "移动文件夹完毕", BeShowLog);
            ntools.Messenger.Broadcast <float>("updateLoadingProgress", 0.9f);
            ProcessResVer();
        };

        List <string> ignroeFileList = new List <string>();

        ignroeFileList.Add("resVer.txt");

        LogMgr.I("CopyRes", "tStart", "移动srcPath:" + _srcPath + " 到目标路径:" + UnityUtil.PersistentPath, BeShowLog);
        FileMove.GetIns().MoveFoldersFiles(_srcPath, UnityUtil.PersistentPath, progressCB, onComplete, ignroeFileList);
    }
Exemple #6
0
    public void SetState(UnCompressState state)
    {
        if (state == curState)
        {
            return;
        }

        LogMgr.I("UnCompress", "SetState", "SetState切换状态到:" + state, BeShowLog);

        preState = curState;
        StateExit(preState);
        curState = state;

        switch (curState)
        {
        case UnCompressState.checkPersistResVer:
            CheckPersistResVer();
            break;

        case UnCompressState.checkStreamResVer:
            CheckStreamResVer();
            break;

        case UnCompressState.compareResVerPersist_Stream:
            CompareLocalResVer();
            break;

        case UnCompressState.readStreamResInfoList:
            ReadStreamResInfoList();
            break;

        case UnCompressState.unCompressStreamRes:
            UnCompressStreamRes2Persistent();
            break;

        case UnCompressState.readPersistResVerAfterUnCompress:
            ReadPersistResVerAfterUnCompress();
            break;

        case UnCompressState.unCompressComplete:
            Clear();
            ntools.Messenger.Broadcast <float>("updateLoadingProgress", 1f);
            UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.downLoad);
            break;
        }
    }
Exemple #7
0
        public void DoUpdate(UpdateMgr UpdateManager)
        {
            CloseLauncher();

            var res = UpdateManager.GetUpdateResult();
            var fn  = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), UpdatePath);

            cancleSource = new CancellationTokenSource();
            UpdateCount  = res.Count;
            UpdateNow    = 0;

            if (!Directory.Exists(fn))
            {
                Directory.CreateDirectory(fn);
            }

            UpdateTask = Task.Factory.StartNew(() =>
            {
                SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Application.Current.Dispatcher));
                foreach (var file in res)
                {
                    if (cancleSource.IsCancellationRequested)
                    {
                        break;
                    }

                    var url = UpdateManager.GetDownloadUrl(file.Name);

                    HttpDownload.HttpDownloadFile(url, fn + file.Name + ".cozy_update");

                    SynchronizationContext.Current.Send(x =>
                    {
                        FileInfoList.Add(file.Name);
                        UpdateNow++;
                    }, null);
                }

                MoveFile();

                OkEnable     = true;
                CancleEnable = false;
            }, cancleSource.Token);

            CancleEnable = true;
            OkEnable     = false;
        }
Exemple #8
0
        protected override void Initialize()
        {
            base.Initialize();

            phiColManager     = new PhiColMgr();
            shelterMgr        = new ShelterMgr();
            drawManager       = new DrawMgr();
            updateMgr         = new UpdateMgr();
            visionMgr         = new VisionMgr();
            objMemoryMananger = new ObjMemoryMgr();

            Sound.Initial();

            // 在此处将主界面压入堆栈。


            // test

            gameScreens.Push(new RuleSelectScreen());

            //
        }
Exemple #9
0
    private void ProcessResVer()
    {
        //最后更新沙盒版本号
        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append(DownloadCachePath);
        Utils.SB.Append("/resVer.txt");
        string srcResVerPath = Utils.SB.ToString();

        Utils.SB.Clear();

        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append("/resVer.txt");
        string destResVerPath = Utils.SB.ToString();

        Utils.SB.Clear();

        LogMgr.I("CopyRes", "ProcessResVer", "移动resVer:" + srcResVerPath + " 到目标路径:" + destResVerPath, BeShowLog);
        FileHelper.MoveFile(srcResVerPath, destResVerPath);

        ntools.Messenger.Broadcast <float>("updateLoadingProgress", 1f);

        //清理下载中目录,其实不需要清理,因为都移走了
        UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.updateComplete);
    }
Exemple #10
0
 public void RegistUpdaters(UpdateMgr manager)
 {
     manager.AddGroup(SenceObjs.GetConvertList <IUpdater>());
 }
Exemple #11
0
    public void SetState(DownloadResState state)
    {
        if (state == curState)
        {
            return;
        }

        LogMgr.I("DownloadRes", "SetState", "SetState切换状态到:" + state, BeShowLog);

        preState = curState;
        StateExit(preState);
        curState = state;

        switch (curState)
        {
        case DownloadResState.checkRemoteResVer:
            CheckRemoteResVer();
            break;

        case DownloadResState.compareResVerPersist_Remote:
            CompareResVerPersist_Remote();
            break;

        case DownloadResState.checkPersistDownloadingRes:
            CheckPersistDownloadingRes();
            break;

        case DownloadResState.pullRemoteResInfoList:
            PullRemoteResInfoList();
            break;

        case DownloadResState.readPersistResInfoList:
            ReadPersistResInfoList();
            break;

        case DownloadResState.compareResInfoListPersist_Remote:
            CompareResInfoListPersist_Remote();
            break;

        case DownloadResState.checkBreakpoint:
            CheckBreakpoint();
            break;

        case DownloadResState.filterUpdateResInfoList:
            FilterUpdateResInfoList();
            break;

        case DownloadResState.saveRemoteResVer2Downloading:
            SaveRemoteResVer2Downloading();
            break;

        case DownloadResState.startDownload:
            StartDownload();
            break;

        case DownloadResState.saveResInfoList2DownloadingFoler:
            SaveResInfoList2DownloadingFoler();
            break;

        case DownloadResState.generateDownloadOverFlagFile:
            GenerateDownloadOverFlagFile();
            break;

        case DownloadResState.downloadComplete:
            Clear();
            //这里的100即可是版本检测的100也可是下载的100
            Messenger.Broadcast <float>("updateLoadingProgress", 1f);
            UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.copyRess);
            break;
        }
    }