public override bool Initialize(string url)
        {
            var match = HostingUrlPattern.Match(url);

            if (!match.Success)
            {
                return(false);
            }

            CompanyName = match.Groups["accountname"].Value;
            CompanyUrl  = match.Groups["companyurl"].Value;

            ProjectName = match.Groups["project"].Value;
            if (string.IsNullOrWhiteSpace(ProjectName))
            {
                ProjectName = match.Groups["repo"].Value;
            }

            ProjectUrl = match.Groups["companyurl"].Value + ProjectName + "/";

            if (!CompanyUrl.StartsWithIgnoreCase("https://"))
            {
                CompanyUrl = String.Concat("https://", CompanyUrl);
            }

            if (!ProjectUrl.StartsWithIgnoreCase("https://"))
            {
                ProjectUrl = String.Concat("https://", ProjectUrl);
            }

            return(true);
        }
Beispiel #2
0
        public override bool Initialize(string url)
        {
            var match = _gitHubRegex.Match(url);

            if (!match.Success)
            {
                return(false);
            }

            CompanyName = match.Groups["company"].Value;
            CompanyUrl  = match.Groups["companyurl"].Value;

            ProjectName = match.Groups["project"].Value;
            ProjectUrl  = match.Groups["url"].Value;

            if (!CompanyUrl.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase))
            {
                CompanyUrl = String.Concat("https://", CompanyUrl);
            }

            if (!ProjectUrl.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase))
            {
                ProjectUrl = String.Concat("https://", ProjectUrl);
            }

            return(true);
        }
Beispiel #3
0
        protected override void Execute(NativeActivityContext context)
        {
            var pModel = new PackageModel();

            pModel.Id          = PackageId.Get(context);
            pModel.Description = Description.Get(context);
            pModel.Version     = Models.PackageModel.CreateFullVersionFromMajorMinor(MajorVersion.Get(context), MinorVersion.Get(context));
            pModel.Authors     = Authors.Get(context);
            pModel.Owners      = Owners.Get(context);
            pModel.LicenseUrl  = LicenseUrl.Get(context);
            pModel.ProjectUrl  = ProjectUrl.Get(context);
            pModel.IconUrl     = IconUrl.Get(context);
            pModel.RequireLicenseAcceptance = RequireLicenseAcceptance.Get(context);
            pModel.ReleaseNotes             = ReleaseNotes.Get(context);
            pModel.Copyright              = Copyright.Get(context);
            pModel.Tags                   = Tags.Get(context);
            pModel.DirectorySet           = DirectorySet.Get(context);
            pModel.ModelsAssemblyGuid     = ModelsAssemblyGuid.Get(context) ?? Guid.NewGuid().ToString();
            pModel.ActivitiesAssemblyGuid = ActivitiesAssemblyGuid.Get(context) ?? Guid.NewGuid().ToString();

            this.PackageModel.Set(context, pModel);

            context.Properties.Add("PackageModel", pModel);

            context.ScheduleActivity(this.Body);
        }
Beispiel #4
0
        public NugetDetailsViewModel(IPackageSearchMetadata metadata)
        {
            _metadata   = metadata;
            _defaultUrl = new Uri("https://git.io/fAlfh");
            var startInfo = new ProcessStartInfo(ProjectUrl.ToString())
            {
                UseShellExecute = false
            };

            OpenPage = ReactiveCommand.Create(() => { Process.Start(startInfo); });
        }
 public NugetDetailsViewModel(NugetPackageDto dto)
 {
     _dto        = dto;
     _defaultUrl = new Uri("https://git.io/fAlfh");
     OpenPage    = ReactiveCommand.Create(() =>
     {
         Process.Start(new ProcessStartInfo(ProjectUrl.ToString())
         {
             UseShellExecute = true
         });
     });
 }
Beispiel #6
0
        public SimplePackageMetadata(IPackageSearchMetadata packageSearchMetadata)
        {
            Title      = packageSearchMetadata.Title;
            Authors    = packageSearchMetadata.Authors;
            Tags       = packageSearchMetadata.Tags;
            Summary    = packageSearchMetadata.Summary;
            IconUrl    = packageSearchMetadata.IconUrl;
            ProjectUrl = packageSearchMetadata.ProjectUrl;

            if (ProjectUrl != null)
            {
                var match = Regex.Match(ProjectUrl.ToString(), GithubWrapper.RGX_GITHUB_REPO);
                if (match.Success)
                {
                    HasGithub = true;
                    GithubUrl = match.Value;
                }
            }
        }
        protected override PackageModel Execute(CodeActivityContext context)
        {
            var pModel = new PackageModel();

            pModel.Id          = PackageId.Get(context);
            pModel.Description = Description.Get(context);
            pModel.Version     = Version.Get(context);
            pModel.Authors     = Authors.Get(context);
            pModel.Owners      = Owners.Get(context);
            pModel.LicenseUrl  = LicenseUrl.Get(context);
            pModel.ProjectUrl  = ProjectUrl.Get(context);
            pModel.IconUrl     = IconUrl.Get(context);
            pModel.RequireLicenseAcceptance = RequireLicenseAcceptance.Get(context);
            pModel.ReleaseNotes             = ReleaseNotes.Get(context);
            pModel.Copyright              = Copyright.Get(context);
            pModel.Tags                   = Tags.Get(context);
            pModel.DirectorySet           = DirectorySet.Get(context);
            pModel.ModelsAssemblyGuid     = ModelsAssemblyGuid.Get(context);
            pModel.ActivitiesAssemblyGuid = ActivitiesAssemblyGuid.Get(context);

            return(pModel);
        }
 public GameDetailsViewModel(GameModel game)
 {
     OpenPage = ReactiveCommand.Create(() => { Process.Start(ProjectUrl.ToString()); });
     _game    = game;
 }
 public NugetDetailsViewModel(IPackageSearchMetadata metadata)
 {
     _metadata   = metadata;
     _defaultUrl = new Uri("https://git.io/fAlfh");
     OpenPage    = ReactiveCommand.Create(() => { Process.Start(ProjectUrl.ToString()); });
 }