Skip to content

Commit

Permalink
Reformat all files
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Nov 27, 2023
1 parent 8949a3c commit 08b2da1
Show file tree
Hide file tree
Showing 15 changed files with 216 additions and 214 deletions.
184 changes: 92 additions & 92 deletions Plogon/BuildProcessor.cs

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Plogon/BuildTask.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Plogon.Manifests;
#pragma warning disable CS8618
#pragma warning disable CS1591
Expand All @@ -8,23 +8,23 @@ namespace Plogon;
public class BuildTask
{
public Manifest? Manifest { get; set; }

public string? HaveCommit { get; set; }

public DateTime? HaveTimeBuilt { get; set; }

public string? HaveVersion { get; set; }

public string Channel { get; set; }

public string InternalName { get; set; }

// New in ANY channel
public bool IsNewPlugin { get; set; }

// New in THIS channel
public bool IsNewInThisChannel { get; set; }

public TaskType Type { get; set; }

public enum TaskType
Expand All @@ -34,8 +34,8 @@ public enum TaskType
}

public bool IsGitHub => Manifest != null && new Uri(Manifest.Plugin.Repository).Host == "github.com";

public bool IsGitLab => Manifest != null && new Uri(Manifest.Plugin.Repository).Host == "gitlab.com";

public override string ToString() => $"{Type} - {InternalName}[{Channel}] - {HaveCommit ?? "?"} - {Manifest?.Plugin?.Commit ?? "?"} - {Manifest?.Directory?.FullName ?? "?"}";
}
}
18 changes: 9 additions & 9 deletions Plogon/DalamudReleases.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
Expand All @@ -18,7 +18,7 @@ public class DalamudReleases
private const string URL_TEMPLATE = "https://kamori.goats.dev/Dalamud/Release/VersionInfo?track={0}";

private readonly Overrides? overrides;

private class Overrides
{
public Dictionary<string, string> ChannelTracks { get; set; } = new();
Expand All @@ -36,12 +36,12 @@ public DalamudReleases(FileInfo overridesFile, DirectoryInfo releasesDir)
if (overridesFile.Exists)
this.overrides = Toml.ToModel<Overrides>(overridesFile.OpenText().ReadToEnd());
}

/// <summary>
/// Where releases go
/// </summary>
public DirectoryInfo ReleasesDir { get; }

private async Task<DalamudVersionInfo?> GetVersionInfoForTrackAsync(string track)
{
var dalamudTrack = "release";
Expand All @@ -50,7 +50,7 @@ public DalamudReleases(FileInfo overridesFile, DirectoryInfo releasesDir)
dalamudTrack = mapping;
Log.Information("Overriding channel {Track} Dalamud track with {NewTrack}", track, dalamudTrack);
}

using var client = new HttpClient();
return await client.GetFromJsonAsync<DalamudVersionInfo>(string.Format(URL_TEMPLATE, dalamudTrack));
}
Expand All @@ -66,12 +66,12 @@ public async Task<DirectoryInfo> GetDalamudAssemblyDirAsync(string track)
var versionInfo = await this.GetVersionInfoForTrackAsync(track);
if (versionInfo == null)
throw new Exception("Could not get Dalamud version info");

var extractDir = this.ReleasesDir.CreateSubdirectory($"{track}-{versionInfo.AssemblyVersion}");

if (extractDir.GetFiles().Length != 0)
return extractDir;

Log.Information("Downloading Dalamud assembly for track {Track}({Version})", track, versionInfo.AssemblyVersion);

using var client = new HttpClient();
Expand All @@ -84,7 +84,7 @@ public async Task<DirectoryInfo> GetDalamudAssemblyDirAsync(string track)

return extractDir;
}

private class DalamudVersionInfo
{
#pragma warning disable CS8618
Expand All @@ -96,4 +96,4 @@ private class DalamudVersionInfo
public string DownloadUrl { get; set; }
#pragma warning restore CS8618
}
}
}
12 changes: 6 additions & 6 deletions Plogon/DiscordWebhook.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Discord;
using Discord.Webhook;
Expand All @@ -23,7 +23,7 @@ public DiscordWebhook()
var url = Environment.GetEnvironmentVariable("DISCORD_WEBHOOK");
if (string.IsNullOrEmpty(url))
return;

this.Client = new DiscordWebhookClient(url);
}

Expand All @@ -34,7 +34,7 @@ private static DateTime GetPacificStandardTime()
var pacificTime = TimeZoneInfo.ConvertTimeFromUtc(utc, pacificZone);
return pacificTime;
}

/// <summary>
/// Send a webhook
/// </summary>
Expand All @@ -46,7 +46,7 @@ public async Task<ulong> Send(Color color, string message, string title, string
{
if (this.Client == null)
throw new Exception("Webhooks not set up");

var embed = new EmbedBuilder()
.WithColor(color)
.WithTitle(title)
Expand All @@ -62,7 +62,7 @@ public async Task<ulong> Send(Color color, string message, string title, string
username = "Gon";
avatarUrl = "https://goatcorp.github.io/icons/gon.png";
}

return await this.Client.SendMessageAsync(embeds: new[] { embed }, username: username, avatarUrl: avatarUrl);
}
}
}
40 changes: 20 additions & 20 deletions Plogon/GitHubApi.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
Expand Down Expand Up @@ -62,7 +62,7 @@ public async Task<bool> CrossOutAllOfMyComments(int issueNumber)
if (comment.User.Id != me.Id)
continue;
any = true;

// Only do this once
if (comment.Body.StartsWith("<details>"))
continue;
Expand Down Expand Up @@ -99,7 +99,7 @@ public async Task<string> GetIssueBody(int issueNumber)

return pr.Body;
}

private const string PR_LABEL_NEW_PLUGIN = "new plugin";
private const string PR_LABEL_NEED_ICON = "need icon";
private const string PR_LABEL_BUILD_FAILED = "build failed";
Expand All @@ -119,42 +119,42 @@ public enum PrLabel
/// No label
/// </summary>
None = 0,

/// <summary>
/// "new plugin"
/// </summary>
NewPlugin = 1 << 0,

/// <summary>
/// "need icon"
/// </summary>
NeedIcon = 1 << 1,

/// <summary>
/// "build failed"
/// </summary>
BuildFailed = 1 << 2,

/// <summary>
/// "version conflict"
/// </summary>
VersionConflict = 1 << 3,

/// <summary>
/// "move channel"
/// </summary>
MoveChannel = 1 << 4,

/// <summary>
/// "size-s"
/// </summary>
SizeSmall = 1 << 5,

/// <summary>
/// "size-m"
/// </summary>
SizeMid = 1 << 6,

/// <summary>
/// "size-l"
/// </summary>
Expand All @@ -169,7 +169,7 @@ public enum PrLabel
public async Task SetPrLabels(int issueNumber, PrLabel label)
{
var managedLabels = new HashSet<string>();

var existing = await this.ghClient.Issue.Labels.GetAllForIssue(repoOwner, repoName, issueNumber);
if (existing != null)
{
Expand All @@ -183,42 +183,42 @@ public async Task SetPrLabels(int issueNumber, PrLabel label)
managedLabels.Add(PR_LABEL_NEW_PLUGIN);
else
managedLabels.Remove(PR_LABEL_NEW_PLUGIN);

if (label.HasFlag(PrLabel.NeedIcon))
managedLabels.Add(PR_LABEL_NEED_ICON);
else
managedLabels.Remove(PR_LABEL_NEED_ICON);

if (label.HasFlag(PrLabel.BuildFailed))
managedLabels.Add(PR_LABEL_BUILD_FAILED);
else
managedLabels.Remove(PR_LABEL_BUILD_FAILED);

if (label.HasFlag(PrLabel.VersionConflict))
managedLabels.Add(PR_LABEL_VERSION_CONFLICT);
else
managedLabels.Remove(PR_LABEL_VERSION_CONFLICT);

if (label.HasFlag(PrLabel.MoveChannel))
managedLabels.Add(PR_LABEL_MOVE_CHANNEL);
else
managedLabels.Remove(PR_LABEL_MOVE_CHANNEL);

if (label.HasFlag(PrLabel.SizeSmall))
managedLabels.Add(PR_LABEL_SIZE_SMALL);
else
managedLabels.Remove(PR_LABEL_SIZE_SMALL);

if (label.HasFlag(PrLabel.SizeMid))
managedLabels.Add(PR_LABEL_SIZE_MID);
else
managedLabels.Remove(PR_LABEL_SIZE_MID);

if (label.HasFlag(PrLabel.SizeLarge))
managedLabels.Add(PR_LABEL_SIZE_LARGE);
else
managedLabels.Remove(PR_LABEL_SIZE_LARGE);

await this.ghClient.Issue.Labels.ReplaceAllForIssue(repoOwner, repoName, issueNumber, managedLabels.ToArray());
}
}
}
12 changes: 6 additions & 6 deletions Plogon/GitHubOutputBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
#pragma warning disable CS1591

namespace Plogon;
Expand All @@ -8,20 +8,20 @@ public static class GitHubOutputBuilder
private static bool isActive = false;

public static void SetActive(bool active) => isActive = active;

public static void StartGroup(string name)
{
if (!isActive)
return;

Console.WriteLine($"::group::{name}");
}

public static void EndGroup()
{
if (!isActive)
return;

Console.WriteLine($"::endgroup::");
}
}
}
Loading

0 comments on commit 08b2da1

Please sign in to comment.