Skip to content

Commit

Permalink
Fix FreeServer, UnknownCommands in Configs, Error in Translation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheR00st3r committed Nov 15, 2023
1 parent 6c1cd57 commit 0713eb7
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 19 deletions.
8 changes: 4 additions & 4 deletions PugSharp.Match/Match.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Match : IDisposable
private const int Kill4 = 4;
private const int Kill5 = 5;
private const int NumOfMatchLiveMessages = 10;
private const int _TimeBetweenDelayMessages = 10;
private const uint _TimeBetweenDelayMessages = 10;
private static readonly ILogger<Match> _Logger = LogManager.CreateLogger<Match>();

private readonly System.Timers.Timer _VoteTimer = new();
Expand Down Expand Up @@ -487,11 +487,11 @@ private async Task CompleteMatchAsync()
while (delay > 0)
{
_Logger.LogInformation("Waiting for sourceTV. Remaining Delay: {delay}s", delay);
await Task.Delay(TimeSpan.FromSeconds(Math.Min(_TimeBetweenDelayMessages, delay))).ConfigureAwait(false);
delay -= _TimeBetweenDelayMessages;
var delayLoopTime = Math.Min(_TimeBetweenDelayMessages, delay);
await Task.Delay(TimeSpan.FromSeconds(delayLoopTime)).ConfigureAwait(false);
delay -= delayLoopTime;
}


if (_DemoUploader != null)
{
await _DemoUploader.UploadDemoAsync(MatchInfo.DemoFile, CancellationToken.None).ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion PugSharp.Translation/Properties/Resources.Designer.cs

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

63 changes: 61 additions & 2 deletions PugSharp.Translation/Properties/Resources.de.resx
Original file line number Diff line number Diff line change
@@ -1,6 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="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>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<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
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
Expand Down Expand Up @@ -98,7 +157,7 @@
<value>{0:playerName} ist nicht bereit! {1:readyPlayers} von {2:requiredPlayers} sind bereit.</value>
</data>
<data name="PugSharp.Match.Info.StartMatch" xml:space="preserve">
<value>Start Spiel. **{0:team1Name}** als **{1:team1Side}**. **{2:team2Name}** als **{team2Side}**</value>
<value>Start Spiel. **{0:team1Name}** als **{1:team1Side}**. **{2:team2Name}** als **{3:team2Side}**</value>
</data>
<data name="PugSharp.Match.Error.NoMapVoteExpected" xml:space="preserve">
<value>Im Moment ist keine Kartenabstimmung aktiv!</value>
Expand Down
2 changes: 1 addition & 1 deletion PugSharp.Translation/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
<value>{0:playerName} is ready! {1:readyPlayers} of {2:requiredPlayers} are ready.</value>
</data>
<data name="PugSharp.Match.Info.StartMatch" xml:space="preserve">
<value>Starting Match. **{0:team1Name}** as **{1:team1Side}**. **{2:team2Name}** as **{team2Side}**</value>
<value>Starting Match. **{0:team1Name}** as **{1:team1Side}**. **{2:team2Name}** as **{3:team2Side}**</value>
</data>
<data name="PugSharp.Match.Info.WaitingForAllPlayers" xml:space="preserve">
<value>Waiting for all players to be ready.</value>
Expand Down
13 changes: 9 additions & 4 deletions PugSharp.Translation/PugSharp.Translation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\PugSharp.Logging\PugSharp.Logging.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand All @@ -23,10 +27,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Update="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Update="Meziantou.Analyzer" Version="2.0.110">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
</ItemGroup>

</Project>
10 changes: 7 additions & 3 deletions PugSharp.Translation/TextHelper.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using PugSharp.Translation.Properties;
using Microsoft.Extensions.Logging;
using PugSharp.Logging;
using PugSharp.Translation.Properties;
using System.Globalization;
using System.Text.RegularExpressions;

namespace PugSharp.Translation;

public partial class TextHelper : ITextHelper
{
private static readonly ILogger<Match> _Logger = LogManager.CreateLogger<Match>();

private const char _DefaultColor = '\u0001';
private const int _RegexTimeout = 1000;
private readonly char _HighlightColor;
Expand Down Expand Up @@ -44,9 +48,9 @@ public string GetTranslatedText(string key, CultureInfo cultureInfo, params obje
var stringArguments = arguments.Select(GetArgumentString).ToArray<object>();
text = string.Format(CultureInfo.CurrentCulture, text, stringArguments);
}
catch (Exception)
catch (Exception ex)
{
// Do nothing
_Logger.LogError(ex, "Error formatting text {text}", text);
}
}

Expand Down
2 changes: 1 addition & 1 deletion resources/cfg/PugSharp/live.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ mp_maxmoney 16000
mp_molotovusedelay 0
mp_overtime_enable 1
mp_overtime_halftime_pausetimer 0
mp_overtime_maxrounds 6
mp_overtime_startmoney 10000
mp_playercashawards 1
mp_randomspawn 0
Expand Down Expand Up @@ -106,7 +107,6 @@ sv_hibernate_postgame_delay 300
sv_holiday_mode 0
sv_human_autojoin_team 2
sv_ignoregrenaderadio 0
sv_infinite_ammo 0
sv_occlude_players 1
sv_talk_enemy_dead 0
sv_talk_enemy_living 0
Expand Down
3 changes: 0 additions & 3 deletions resources/cfg/PugSharp/warmup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ sv_disable_teamselect_menu 1
sv_full_alltalk 0
sv_hibernate_when_empty 0
sv_human_autojoin_team 2
sv_infinite_ammo 0
sv_showimpacts 0
sv_voiceenable 1
sm_cvar sv_mute_players_with_social_penalties 0
sv_mute_players_with_social_penalties 0
tv_relayvoice 1
mp_ct_default_melee weapon_knife
Expand All @@ -39,6 +37,5 @@ mp_warmup_start
mp_warmup_pausetimer 1
mp_warmuptime 9999
cash_team_bonus_shorthanded 0
cash_team_loser_bonus_shorthanded 0
tv_relayvoice 0
tv_autorecord 0

0 comments on commit 0713eb7

Please sign in to comment.