Exemplo n.º 1
0
        public static string GroupName(PackageOrigin origin)
        {
            var group = PackageGroupOrigins.Packages.ToString();

            if (origin == PackageOrigin.Builtin)
            {
                group = PackageGroupOrigins.BuiltInPackages.ToString();
            }

            return(group);
        }
Exemplo n.º 2
0
 private PackageIdentity(string package_full_name, PACKAGE_ID package_id, PackageOrigin origin, string path)
 {
     FullName = package_full_name;
     ProcessorArchitecture = (PackageArchitecture)package_id.processorArchitecture;
     Name        = GetString(package_id.name);
     Publisher   = GetString(package_id.publisher);
     PublisherId = GetString(package_id.publisherId);
     ResourceId  = GetString(package_id.resourceId);
     Version     = new Version(package_id.version.Major, package_id.version.Minor, package_id.version.Build, package_id.version.Revision);
     Origin      = origin;
     Path        = path;
 }
Exemplo n.º 3
0
 private PackageIdentity(string package_full_name, PACKAGE_ID package_id, PackageOrigin origin, string path, IEnumerable <string> appids)
 {
     FullName = package_full_name;
     ProcessorArchitecture = (PackageArchitecture)package_id.processorArchitecture;
     Name                = GetString(package_id.name);
     Publisher           = GetString(package_id.publisher);
     PublisherId         = GetString(package_id.publisherId);
     ResourceId          = GetString(package_id.resourceId);
     Version             = new Version(package_id.version.Major, package_id.version.Minor, package_id.version.Build, package_id.version.Revision);
     Origin              = origin;
     Path                = path;
     FamilyName          = $"{Name}_{PublisherId}";
     ApplicationModelIds = appids ?? new string[0];
 }
Exemplo n.º 4
0
        public PackageInfo Single(PackageOrigin type, string name = null, string version = null)
        {
            if (name == null)
            {
                name = RandomString(Random.Next(5, 10));
            }
            if (version == null)
            {
                version = string.Format("1.0.{0}", _count);
                if (Random.NextDouble() > 0.5)
                {
                    version += "-preview";
                }
            }

            var group   = UpmBaseOperation.GroupName(type);
            var package = new PackageInfo
            {
                DisplayName = char.ToUpper(name[0]) + name.Substring(1),
                Name        = string.Format("com.unity.{0}", name),
                Description = LoremIpsum(Random.Next(3, 5), 2, 10, 5, 20),
                PackageId   = string.Format("com.unity.{0}@{1}", name, version),
                State       = PackageState.UpToDate,
                Group       = group,
                Version     = version,
                IsVerified  = false,
                IsCurrent   = true,
                IsLatest    = false,
                Origin      = type,
                Errors      = new List <Error>()
            };

            _count++;

            return(package);
        }
 internal static extern Win32Error GetStagedPackageOrigin(
     string packageFullName,
     out PackageOrigin origin
     );
Exemplo n.º 6
0
 /// <summary>
 /// Erstellt einen neuen Log Eintrag.
 /// </summary>
 /// <param name="package">Das zu loggende Paket.</param>
 /// <param name="origin">Die Herkunft des Paketes.</param>
 /// <param name="timeStamp">Der Zeitpunkt des Log Eintrages.</param>
 public PackageLogEntry(IPackage package, PackageOrigin origin, DateTime timeStamp)
 {
     Package = package.Clone().hideFields();
     Origin = origin;
     TimeStamp = timeStamp;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Erstellt einen neuen Log Eintrag.
 /// </summary>
 /// <param name="package">Das zu loggende Paket.</param>
 /// <param name="origin">Die Herkunft des Paketes.</param>
 public PackageLogEntry(IPackage package, PackageOrigin origin)
     : this(package, origin, DateTime.Now)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PackageReference"/> class.
 /// </summary>
 /// <param name="id">The id of the NuGet package.</param>
 /// <param name="version">The version of the NuGet package.</param>
 public PackageReference(string id, string version, PackageOrigin packageOrigin)
 {
     Id      = id;
     Version = version;
     Origin  = packageOrigin;
 }
Exemplo n.º 9
0
        private static IEnumerable <PackageReference> ReadPackageReferencesFromDirective(PackageOrigin origin,
                                                                                         string pattern, string fileContent)
        {
            var matches = Regex.Matches(fileContent, pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);

            foreach (var match in matches.Cast <Match>())
            {
                var id               = match.Groups[1].Value;
                var version          = match.Groups[2].Value;
                var packageReference = new PackageReference(id, version, origin);
                yield return(packageReference);
            }
        }