-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dr1rrb/dev/dr/net9
Udpate dotnet
- Loading branch information
Showing
17 changed files
with
345 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 4 additions & 11 deletions
15
Crawler/DuplicatiCrawler/Client/AzureDevOps/BuildDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Crawler.Client.AzureDevOps | ||
{ | ||
public class BuildDefinition | ||
{ | ||
[JsonProperty("id")] | ||
public int Id { get; set; } | ||
} | ||
} | ||
namespace Crawler.Client.AzureDevOps; | ||
|
||
internal sealed record BuildDefinition([property: JsonPropertyName("id")] int Id); |
15 changes: 4 additions & 11 deletions
15
Crawler/DuplicatiCrawler/Client/AzureDevOps/GetVariableGroupsResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Crawler.Client.AzureDevOps | ||
{ | ||
internal class GetVariableGroupsResponse | ||
{ | ||
[JsonProperty("value")] | ||
public VariableGroup[] Groups { get; set; } | ||
} | ||
} | ||
namespace Crawler.Client.AzureDevOps; | ||
|
||
internal sealed record GetVariableGroupsResponse([property: JsonPropertyName("value")] VariableGroup[] Groups); |
18 changes: 5 additions & 13 deletions
18
Crawler/DuplicatiCrawler/Client/AzureDevOps/QueueBuildRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Crawler.Client.AzureDevOps | ||
{ | ||
public class QueueBuildRequest | ||
{ | ||
[JsonProperty("definition")] | ||
public BuildDefinition Definition { get; set; } | ||
namespace Crawler.Client.AzureDevOps; | ||
|
||
[JsonProperty("parameters")] | ||
public string Parameters { get; set; } | ||
} | ||
} | ||
internal sealed record QueueBuildRequest( | ||
[property: JsonPropertyName("definition")] BuildDefinition Definition, | ||
[property: JsonPropertyName("parameters")] string Parameters); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Crawler.Client.AzureDevOps | ||
{ | ||
public class Variable | ||
{ | ||
[JsonProperty("value")] | ||
public string Value { get; set; } | ||
} | ||
} | ||
namespace Crawler.Client.AzureDevOps; | ||
|
||
internal sealed record Variable([property: JsonPropertyName("value")] string Value); |
48 changes: 17 additions & 31 deletions
48
Crawler/DuplicatiCrawler/Client/AzureDevOps/VariableGroup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using System.Collections.Immutable; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Crawler.Client.AzureDevOps | ||
{ | ||
public class VariableGroup | ||
{ | ||
[JsonProperty("id")] | ||
public uint Id { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
namespace Crawler.Client.AzureDevOps; | ||
|
||
[JsonProperty("variables")] | ||
public Dictionary<string, Variable> Variables { get; set; } | ||
|
||
// Yes its ugly ... it a mutable entity | ||
[JsonIgnore] | ||
public string this[string key] => Variables[Name.Replace('-', '.') + '.' + key].Value; | ||
internal sealed record VariableGroup( | ||
[property: JsonPropertyName("id")] uint Id, | ||
[property: JsonPropertyName("name")] string Name, | ||
[property: JsonPropertyName("variables")] ImmutableDictionary<string, Variable> Variables) | ||
{ | ||
[JsonIgnore] | ||
public string this[string key] => Variables[Name.Replace('-', '.') + '.' + key].Value; | ||
|
||
public bool TryUpdate(string key, string value) | ||
{ | ||
var variable = Variables[Name.Replace('-', '.') + '.' + key]; | ||
public VariableGroup With(string key, string value) | ||
{ | ||
var variableName = Name.Replace('-', '.') + '.' + key; | ||
|
||
if (variable.Value.Equals(value, StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
return false; | ||
} | ||
else | ||
{ | ||
variable.Value = value; | ||
return true; | ||
} | ||
} | ||
return Variables.TryGetValue(variableName, out var current) | ||
&& current.Value.Equals(value, StringComparison.Ordinal) | ||
? this | ||
: this with { Variables = Variables.SetItem(variableName, new(value)) }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Crawler.Client.GitHub | ||
{ | ||
public class Asset | ||
{ | ||
[JsonProperty("browser_download_url")] | ||
public string Url { get; set; } | ||
} | ||
} | ||
namespace Crawler.Client.GitHub; | ||
|
||
internal sealed record Asset([property: JsonPropertyName("browser_download_url")] string Url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Crawler.Client.GitHub | ||
{ | ||
public class Release | ||
{ | ||
[JsonProperty("html_url")] | ||
public string Url { get; set; } | ||
namespace Crawler.Client.GitHub; | ||
|
||
[JsonProperty("name")] | ||
public string Version { get; set; } | ||
|
||
[JsonProperty("body")] | ||
public string Notes { get; set; } | ||
|
||
public Asset[] Assets { get; set; } | ||
|
||
[JsonProperty("published_at")] | ||
public DateTimeOffset PublicationDate { get; set; } | ||
} | ||
} | ||
internal sealed record Release( | ||
[property: JsonPropertyName("html_url")] string Url, | ||
[property: JsonPropertyName("name")] string Version, | ||
[property: JsonPropertyName("body")] string Notes, | ||
[property: JsonPropertyName("assets")] Asset[] Assets, | ||
[property: JsonPropertyName("published_at")] DateTimeOffset PublicationDate); |
Oops, something went wrong.