Checkpoint
This commit is contained in:
@@ -1,27 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Foodsoft.Alpm;
|
||||
|
||||
// ReSharper disable once UnusedType.Global
|
||||
namespace Samples
|
||||
{
|
||||
[Example("installed")]
|
||||
internal class Installed : IExample
|
||||
{
|
||||
private static string ModToStr(Depend.ModType modType)
|
||||
private static string ModToStr(ModType modType)
|
||||
{
|
||||
return modType switch
|
||||
{
|
||||
Depend.ModType.Any => "",
|
||||
Depend.ModType.Equal => "==",
|
||||
Depend.ModType.GreaterThanOrEqual => ">=",
|
||||
Depend.ModType.LessThanOrEqual => "<=",
|
||||
Depend.ModType.GreaterThan => ">",
|
||||
Depend.ModType.LessThan => "<",
|
||||
ModType.Any => "",
|
||||
ModType.Equal => "==",
|
||||
ModType.GreaterThanOrEqual => ">=",
|
||||
ModType.LessThanOrEqual => "<=",
|
||||
ModType.GreaterThan => ">",
|
||||
ModType.LessThan => "<",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(modType), modType, null)
|
||||
};
|
||||
}
|
||||
@@ -60,7 +57,7 @@ namespace Samples
|
||||
|
||||
|
||||
//using var pkg = db.PackageCache.FindSatisfier("gcc=9.3.0-1");
|
||||
var result = db.Search(new string[] {"gcc", "objc"});
|
||||
var result = db.Search(new[] {"gcc", "objc"});
|
||||
foreach (var pkg in result)
|
||||
using (pkg)
|
||||
{
|
||||
@@ -82,7 +79,7 @@ namespace Samples
|
||||
var examples = (from t in Assembly.GetExecutingAssembly().GetTypes()
|
||||
let attribute = (Example?) t.GetCustomAttribute(typeof(Example))
|
||||
where attribute != null
|
||||
select new {Name = attribute.Name, Type = t}).ToImmutableDictionary((e) => e.Name);
|
||||
select new {attribute.Name, Type = t}).ToImmutableDictionary((e) => e.Name);
|
||||
|
||||
if (args.Length < 1)
|
||||
{
|
||||
@@ -110,7 +107,7 @@ namespace Samples
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
|
||||
public class Example : Attribute
|
||||
{
|
||||
public string Name { get; }
|
||||
|
||||
Reference in New Issue
Block a user