Example #1
0
        private static bool CheckNewVersionDialog(List <PackageData> requestPackageDatas, List <PackageData> cachedPackageDatas)
        {
            foreach (var requestPackageData in requestPackageDatas)
            {
                var cachedPacakgeData =
                    cachedPackageDatas.Find(packageData => packageData.Name == requestPackageData.Name);

                var installedPackageVersion = InstalledPackageVersions.Get()
                                              .Find(packageVersion => packageVersion.Name == requestPackageData.Name);

                if (installedPackageVersion == null)
                {
                }
                else if (cachedPacakgeData == null &&
                         requestPackageData.VersionNumber > installedPackageVersion.VersionNumber ||
                         cachedPacakgeData != null && requestPackageData.Installed &&
                         requestPackageData.VersionNumber > cachedPacakgeData.VersionNumber &&
                         requestPackageData.VersionNumber > installedPackageVersion.VersionNumber)
                {
                    ShowDisplayDialog(requestPackageData.Name);
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        public PackageManagerView()
        {
            InstalledPackageVersions.Reload();


            PackageKitModel.Effects.GetAllPackagesInfo();
        }
Example #3
0
        public PackageView(PackageData packageData)
        {
            new SpaceView(2).AddTo(this);

            new LabelView(packageData.Name).FontBold().Width(150).AddTo(this);

            new LabelView(packageData.version).TextMiddleCenter().Width(80).AddTo(this);

            var installedPackage = InstalledPackageVersions.FindVersionByName(packageData.Name);

            new LabelView(installedPackage != null ? installedPackage.Version : " ").TextMiddleCenter().Width(80)
            .AddTo(this);

            new LabelView(packageData.AccessRight.ToString()).TextMiddleCenter().Width(80).AddTo(this);

            if (!string.IsNullOrEmpty(packageData.DocUrl))
            {
                new ButtonView(LocaleText.Doc, () => { }).AddTo(this);
            }
            else
            {
                new SpaceView(40).AddTo(this);
            }

            // 数据绑定
            var bindingSet = BindKit.CreateBindingSet(this, new PackageViewModel());

            if (installedPackage == null)
            {
                bindingSet.Bind(new ButtonView(LocaleText.Import).Width(90).AddTo(this))
                .For(v => v.OnClick)
                .To(vm => vm.Import)
                .CommandParameter(packageData);
            }
            else if (packageData.VersionNumber > installedPackage.VersionNumber)
            {
                bindingSet.Bind(new ButtonView(LocaleText.Update).Width(90).AddTo(this))
                .For(v => v.OnClick)
                .To(vm => vm.Update)
                .CommandParameter(packageData);
            }
            else if (packageData.VersionNumber == installedPackage.VersionNumber)
            {
                bindingSet.Bind(new ButtonView(LocaleText.Reimport).Width(90).AddTo(this))
                .For(v => v.OnClick)
                .To(vm => vm.Reimport)
                .CommandParameter(packageData);
            }
            else if (packageData.VersionNumber < installedPackage.VersionNumber)
            {
                new SpaceView(94).AddTo(this);
            }

            bindingSet.Bind(new ButtonView(LocaleText.ReleaseNotes).AddTo(this))
            .For(v => v.OnClick)
            .To(vm => vm.OpenReadme)
            .CommandParameter(packageData);

            bindingSet.Build();
        }
Example #4
0
        public FrameworkPMView()
        {
            mPackageDatas = PackageInfosRequestCache.Get().PackageDatas;

            InstalledPackageVersions.Reload();

            EditorActionKit.ExecuteNode(new GetAllRemotePackageInfo(packageDatas => { mPackageDatas = packageDatas; }));
        }
Example #5
0
        public PackageRepositoryView(PackageRepository packageRepository)
        {
            new SpaceView(2).AddTo(this);

            new LabelView(packageRepository.name).FontBold().Width(200).AddTo(this);

            new LabelView(packageRepository.latestVersion).TextMiddleCenter().Width(80).AddTo(this);

            var installedPackage = InstalledPackageVersions.FindVersionByName(packageRepository.name);

            new LabelView(installedPackage != null ? installedPackage.Version : " ").TextMiddleCenter().Width(100)
            .AddTo(this);

            new LabelView(packageRepository.accessRight).TextMiddleLeft().Width(50).AddTo(this);


            if (installedPackage == null)
            {
                new ButtonView(LocaleText.Import).Width(90).AddTo(this)
                .OnClick.AddListener(() =>
                {
                    PackageManagerConfig.SendCommand(new ImportPackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber > installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Update).Width(90).AddTo(this)
                .OnClick.AddListener(() =>
                {
                    PackageManagerConfig.SendCommand(new UpdatePackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber == installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Reimport).Width(90).AddTo(this)
                .OnClick.AddListener(() =>
                {
                    PackageManagerConfig.SendCommand(new ReimportPackageCommand(packageRepository));
                });
            }
            else if (packageRepository.VersionNumber < installedPackage.VersionNumber)
            {
                new SpaceView(94).AddTo(this);
            }

            new ButtonView(LocaleText.ReleaseNotes)
            .Width(100)
            .AddTo(this)
            .OnClick.AddListener(() =>
            {
                PackageManagerConfig.SendCommand(new OpenDetailCommand(packageRepository));
            });

            new LabelView(packageRepository.author)
            .TextMiddleLeft()
            .FontBold().Width(100)
            .AddTo(this);
        }
Example #6
0
        public PackageRepositoryView(PackageRepository packageRepository)
        {
            new SpaceView(2).AddTo(this);

            new LabelView(packageRepository.name).FontBold().Width(200).AddTo(this);

            new LabelView(packageRepository.latestVersion).TextMiddleCenter().Width(80).AddTo(this);

            var installedPackage = InstalledPackageVersions.FindVersionByName(packageRepository.name);

            new LabelView(installedPackage != null ? installedPackage.Version : " ").TextMiddleCenter().Width(100)
            .AddTo(this);

            new LabelView(packageRepository.accessRight).TextMiddleLeft().Width(50).AddTo(this);

            // 数据绑定
            var bindingSet = BindKit.CreateBindingSet(this, new PackageViewModel());

            if (installedPackage == null)
            {
                bindingSet.Bind(new ButtonView(LocaleText.Import).Width(90).AddTo(this))
                .For(v => v.OnClick)
                .To(vm => vm.Import)
                .CommandParameter(packageRepository);
            }
            else if (packageRepository.VersionNumber > installedPackage.VersionNumber)
            {
                bindingSet.Bind(new ButtonView(LocaleText.Update).Width(90).AddTo(this))
                .For(v => v.OnClick)
                .To(vm => vm.Update)
                .CommandParameter(packageRepository);
            }
            else if (packageRepository.VersionNumber == installedPackage.VersionNumber)
            {
                bindingSet.Bind(new ButtonView(LocaleText.Reimport).Width(90).AddTo(this))
                .For(v => v.OnClick)
                .To(vm => vm.Reimport)
                .CommandParameter(packageRepository);
            }
            else if (packageRepository.VersionNumber < installedPackage.VersionNumber)
            {
                new SpaceView(94).AddTo(this);
            }

            bindingSet.Bind(new ButtonView(LocaleText.ReleaseNotes).Width(100)
                            .AddTo(this))
            .For(v => v.OnClick)
            .To(vm => vm.OpenDetail)
            .CommandParameter(packageRepository);

            new LabelView(packageRepository.author)
            .TextMiddleLeft()
            .FontBold().Width(100)
            .AddTo(this);


            bindingSet.Build();
        }
Example #7
0
        protected override void ConfigureService(IQFrameworkContainer container)
        {
            InstalledPackageVersions.Reload();

            // 注册好 model
            var model = new PackageManagerModel
            {
                Repositories = PackageInfosRequestCache.Get().PackageRepositories
            };

            Container.RegisterInstance(model);

            Container.Register <IPackageManagerServer, PackageManagerServer>();
        }
Example #8
0
        public PackageManagerApp()
        {
            // 注册好 自己的实例
            Container.RegisterInstance(Container);

            // 配置命令的执行
            TypeEventSystem.Register <IEditorStrangeMVCCommand>(OnCommandExecute);

            InstalledPackageVersions.Reload();

            // 注册好 model
            var model = new PackageManagerModel
            {
                Repositories = PackageInfosRequestCache.Get().PackageRepositories
            };

            Container.RegisterInstance(model);

            Container.Register <IPackageManagerServer, PackageManagerServer>();
        }
Example #9
0
        public override void OnGUI()
        {
            base.OnGUI();

            mRootLayout.OnGUI();

            GUILayout.BeginVertical("box");

            mFrameworkInfoLayout.OnGUI();

            mToolbarIndex = GUILayout.Toolbar(mToolbarIndex, ToolbarNames);

            // 这里开始具体的内容
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("Package", GUILayout.Width(150));
            GUILayout.Label("Server", GUILayout.Width(80));
            GUILayout.Label("Local", GUILayout.Width(80));
            GUILayout.Label("Access Right", GUILayout.Width(80));
            GUILayout.Label("Doc", new GUIStyle {
                alignment = TextAnchor.MiddleCenter, fixedWidth = 40f
            });
            GUILayout.Label("Action", new GUIStyle {
                alignment = TextAnchor.MiddleCenter, fixedWidth = 100f
            });
            GUILayout.Label("Release Note", new GUIStyle {
                alignment = TextAnchor.MiddleCenter, fixedWidth = 100f
            });
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical("box");

            mScrollPos = GUILayout.BeginScrollView(mScrollPos, false, true, GUILayout.Height(240));

            foreach (var packageData in SelectedPackageType)
            {
                GUILayout.Space(2);
                GUILayout.BeginHorizontal();
                GUILayout.Label(packageData.Name, GUILayout.Width(150));
                GUILayout.Label(packageData.Version, GUILayout.Width(80));
                var installedPackage = InstalledPackageVersions.FindVersionByName(packageData.Name);
                GUILayout.Label(installedPackage != null ? installedPackage.Version : " ", GUILayout.Width(80));
                GUILayout.Label(packageData.AccessRight.ToString(), GUILayout.Width(80));

                if (packageData.DocUrl.IsNotNullAndEmpty())
                {
                    if (GUILayout.Button("Doc", GUILayout.Width(40)))
                    {
                        Application.OpenURL(packageData.DocUrl);
                    }
                }
                else
                {
                    GUILayout.Space(40);
                }

                if (installedPackage == null)
                {
                    if (GUILayout.Button("Import", GUILayout.Width(90)))
                    {
                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));

                        PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                    }
                }
                else if (installedPackage != null && packageData.VersionNumber > installedPackage.VersionNumber)
                {
                    if (GUILayout.Button("Update", GUILayout.Width(90)))
                    {
                        var path = Application.dataPath.Replace("Assets", packageData.InstallPath);

                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }

                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));

                        PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                    }
                }
                else if (installedPackage.IsNotNull() && packageData.VersionNumber == installedPackage.VersionNumber)
                {
                    if (GUILayout.Button("Reimport", GUILayout.Width(90)))
                    {
                        var path = Application.dataPath.Replace("Assets", packageData.InstallPath);

                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }

                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));
                        PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                    }
                }
                else if (installedPackage != null)
                {
                    // maybe support upload?
                    GUILayout.Space(94);
                }

                if (GUILayout.Button("Release Notes", GUILayout.Width(100)))
                {
                    ReadmeWindow.Init(packageData.readme, packageData.PackageVersions.First());
                }

                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();

            GUILayout.Space(2);

            GUILayout.EndVertical();

            GUILayout.EndVertical();


            GUILayout.Space(50);
        }
Example #10
0
 protected override void OnModelConfig(IQFrameworkContainer modelLayer)
 {
     InstalledPackageVersions.Reload();
     modelLayer.RegisterInstance <IPackageManagerModel>(new PackageManagerModel());
     modelLayer.RegisterInstance <IPackageManagerServer>(new PackageManagerServer());
 }
Example #11
0
        protected override void OnRefresh()
        {
            Clear();

            new EGO.Framework.SpaceView(2).AddTo(this);

            new EGO.Framework.LabelView(mPackageData.Name)
            .FontBold()
            .Width(150)
            .AddTo(this);

            new EGO.Framework.LabelView(mPackageData.Version)
            .TextMiddleCenter()
            .Width(80)
            .AddTo(this);

            var installedPackage = InstalledPackageVersions.FindVersionByName(mPackageData.Name);

            new EGO.Framework.LabelView(installedPackage != null ? installedPackage.Version : " ")
            .TextMiddleCenter()
            .Width(80)
            .AddTo(this);

            new EGO.Framework.LabelView(mPackageData.AccessRight.ToString())
            .TextMiddleCenter()
            .Width(80)
            .AddTo(this);

            if (mPackageData.DocUrl.IsNotNullAndEmpty())
            {
                new ButtonView(LocaleText.Doc, () => { }).AddTo(this);
            }
            else
            {
                new EGO.Framework.SpaceView(40).AddTo(this);
            }


            if (installedPackage == null)
            {
                new ButtonView(LocaleText.Import, () =>
                {
                    EditorActionKit.ExecuteNode(new InstallPackage(mPackageData));

                    PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                })
                .Width(90)
                .AddTo(this);
            }

            else if (installedPackage != null && mPackageData.VersionNumber > installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Update, () =>
                {
                    var path = Application.dataPath.Replace("Assets", mPackageData.InstallPath);

                    path.DeleteDirIfExists();

                    EditorActionKit.ExecuteNode(new InstallPackage(mPackageData));

                    PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                })
                .Width(90)
                .AddTo(this);
            }
            else if (installedPackage.IsNotNull() &&
                     mPackageData.VersionNumber == installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Reimport, () =>
                {
                    var path = Application.dataPath.Replace("Assets", mPackageData.InstallPath);

                    path.DeleteDirIfExists();

                    EditorActionKit.ExecuteNode(new InstallPackage(mPackageData));
                    PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                })
                .Width(90)
                .AddTo(this);
            }
            else if (installedPackage != null)
            {
                new EGO.Framework.SpaceView(94).AddTo(this);
            }

            new ButtonView(LocaleText.ReleaseNotes,
                           () => { ReadmeWindow.Init(mPackageData.readme, mPackageData.PackageVersions.First()); }).Width(100)
            .AddTo(this);
        }