Skip to content

Commit

Permalink
Build n. 37
Browse files Browse the repository at this point in the history
  • Loading branch information
Plenyx committed May 21, 2019
1 parent c942921 commit c4ef1e4
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 140 deletions.
61 changes: 37 additions & 24 deletions Forms/FormArcVersions.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 45 additions & 35 deletions Forms/FormCustomName.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Forms/FormCustomName.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,29 +26,29 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
Expand Down
19 changes: 9 additions & 10 deletions Forms/FormDiscordWebhooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ public FormDiscordWebhooks(FormMain mainLink)
string[] values = line.Split(new string[] { "<;>" }, StringSplitOptions.None);
int.TryParse(values[0], out int active);
int.TryParse(values[3], out int onlySuccess);
// compatibility with older versions
// compatibility with build < 32
int showPlayers = 1;
if (values.Count() > 4)
{
int.TryParse(values[4], out showPlayers);
}
AddWebhook(new DiscordWebhookData()
{
Active = active == 1 ? true : false,
Active = active == 1,
Name = values[1],
URL = values[2],
OnlySuccess = onlySuccess == 1 ? true : false,
ShowPlayers = showPlayers == 1 ? true : false
OnlySuccess = onlySuccess == 1,
ShowPlayers = showPlayers == 1
});
}
}
Expand Down Expand Up @@ -151,16 +151,15 @@ public async Task ExecuteAllActiveWebhooksAsync(DPSReportJSON reportJSON, Dictio
serialiser.RegisterConverters(new[] { new DiscordAPIJSONContentConverter() });
string jsonContentWithoutPlayers = serialiser.Serialize(discordContentWithoutPlayers);
string jsonContentWithPlayers = serialiser.Serialize(discordContentWithPlayers);
var count = AllWebhooks.Count;
foreach (var key in AllWebhooks.Keys)
{
if (!AllWebhooks[key].Active || (AllWebhooks[key].OnlySuccess && !(reportJSON.Encounter.Success ?? false)))
var webhook = AllWebhooks[key];
if (!webhook.Active || (webhook.OnlySuccess && !(reportJSON.Encounter.Success ?? false)))
{
count--;
continue;
}
var uri = new Uri(AllWebhooks[key].URL);
if (AllWebhooks[key].ShowPlayers)
var uri = new Uri(webhook.URL);
if (webhook.ShowPlayers)
{
using (var content = new StringContent(jsonContentWithPlayers, Encoding.UTF8, "application/json"))
{
Expand All @@ -175,7 +174,7 @@ public async Task ExecuteAllActiveWebhooksAsync(DPSReportJSON reportJSON, Dictio
}
}
}
if (count > 0)
if (AllWebhooks.Count > 0)
{
mainLink.AddToText(">:> All active webhooks successfully executed.");
}
Expand Down
Loading

0 comments on commit c4ef1e4

Please sign in to comment.