Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioZumbi12 committed Aug 23, 2019
1 parent 25ce665 commit a107129
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 79 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,5 @@ __pycache__/

# Deps
/GameBinaries
/TorchBinaries
/TorchBinaries
/SEDiscordBridge/ReleaseNotes.css
32 changes: 17 additions & 15 deletions SEDiscordBridge/DiscordBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
using Sandbox.Game.World;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Torch.API;
using Torch.API.Managers;
using Torch.API.Session;
using Torch.Commands;
Expand All @@ -35,7 +33,7 @@ public DiscordBridge(SEDiscordBridgePlugin plugin)
{
RegisterDiscord().ConfigureAwait(false).GetAwaiter().GetResult();
});
thread.Start();
thread.Start();
}

public void Stopdiscord()
Expand All @@ -54,19 +52,23 @@ private async Task DisconnectDiscord()
}

private Task RegisterDiscord()
{
{
discord = new DiscordClient(new DiscordConfiguration
{
Token = Plugin.Config.BotToken,
TokenType = TokenType.Bot
});

discord.ConnectAsync();

discord.MessageCreated += Discord_MessageCreated;
game = new DiscordGame();

discord.Ready += async e => Ready = true;
discord.Ready += async e =>
{
Ready = true;
await Task.CompletedTask;
};
return Task.CompletedTask;
}

Expand All @@ -76,7 +78,7 @@ public void SendStatus(string status)
{
game.Name = status;
discord.UpdateStatusAsync(game);
}
}
}

public void SendChatMessage(string user, string msg)
Expand Down Expand Up @@ -122,7 +124,7 @@ public void SendFacChatMessage(string user, string msg, string facName)
}
discord.SendMessageAsync(chann, msg.Replace("/n", "\n"));
}
}
}
}

public void SendStatusMessage(string user, string msg)
Expand All @@ -139,7 +141,7 @@ public void SendStatusMessage(string user, string msg)
msg = msg.Replace("{p}", user);
}

discord.SendMessageAsync(chann, msg.Replace("/n","\n"));
discord.SendMessageAsync(chann, msg.Replace("/n", "\n"));
}
}

Expand Down Expand Up @@ -250,12 +252,12 @@ private Task Discord_MessageCreated(DSharpPlus.EventArgs.MessageCreateEventArgs
}
return Task.CompletedTask;
}

private void SendCmdResponse(string response, DiscordChannel chann)
{
DiscordMessage dms = discord.SendMessageAsync(chann, response).Result;
if (Plugin.Config.RemoveResponse > 0)
Task.Delay(Plugin.Config.RemoveResponse*1000).ContinueWith(t => dms?.DeleteAsync());
Task.Delay(Plugin.Config.RemoveResponse * 1000).ContinueWith(t => dms?.DeleteAsync());
}

private string MentionNameToID(string msg, DiscordChannel chann)
Expand Down Expand Up @@ -337,20 +339,20 @@ private string MentionIDToName(DiscordMessage ddMsg)
name = ddMsg.Channel.Guild.GetMemberAsync(ddMsg.MentionedUsers.First().Id).Result.Nickname;
}
else
{
{
ulong id = ulong.Parse(Regex.Match(part, "<@!(.*?)>").Groups[1].Value);
name = discord.GetUserAsync(id).Result.Username;
if (Plugin.Config.UseNicks)
name = ddMsg.Channel.Guild.GetMemberAsync(id).Result.Nickname;
}
msg = msg.Replace(part, "@" + name);
}
catch (FormatException ex) {}
catch (FormatException) { }
}
if (part.StartsWith("<:") && part.EndsWith(">"))
{
string id = part.Substring(2, part.Length - 3);
msg = msg.Replace(part, ":"+ id.Split(':')[0]+":");
msg = msg.Replace(part, ":" + id.Split(':')[0] + ":");
}
}
return msg;
Expand Down
12 changes: 5 additions & 7 deletions SEDiscordBridge/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

Expand Down Expand Up @@ -31,13 +29,13 @@
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //onde os dicionários de recursos de temas específicos estão localizados
//(usado se algum recurso não for encontrado na página,
// ou dicionários de recursos do aplicativo)
//(usado se algum recurso não for encontrado na página,
// ou dicionários de recursos do aplicativo)
ResourceDictionaryLocation.SourceAssembly //onde o dicionário de recursos genéricos está localizado
//(usado se algum recurso não for encontrado na página,
// app, ou qualquer outro dicionário de recursos de tema específico)
//(usado se algum recurso não for encontrado na página,
// app, ou qualquer outro dicionário de recursos de tema específico)
)]


Expand Down
5 changes: 3 additions & 2 deletions SEDiscordBridge/SEDBCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ namespace SEDiscordBridge
public class SEDBCommandHandler : CommandContext
{
/// <inheritdoc />
public SEDBCommandHandler(ITorchBase torch, ITorchPlugin plugin, ulong steamIdSender, string rawArgs = null, List<string> args = null) :
base(torch, plugin, steamIdSender, rawArgs, args) { }
public SEDBCommandHandler(ITorchBase torch, ITorchPlugin plugin, ulong steamIdSender, string rawArgs = null, List<string> args = null) :
base(torch, plugin, steamIdSender, rawArgs, args)
{ }

public event Action<DiscordChannel, string, string, string> OnResponse;
public DiscordChannel ResponeChannel;
Expand Down
8 changes: 3 additions & 5 deletions SEDiscordBridge/SEDBConfig.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System.Collections.ObjectModel;
using System.Windows.Controls;
using Torch;
using Torch.Views;

namespace SEDiscordBridge
{
Expand All @@ -13,7 +11,7 @@ public class SEDBConfig : ViewModel
private bool _preLoad = true;
public bool PreLoad { get => _preLoad; set => SetValue(ref _preLoad, value); }

private bool _dataCollect = true;
private bool _dataCollect = false;
public bool DataCollect { get => _dataCollect; set => SetValue(ref _dataCollect, value); }

private string _token = "";
Expand All @@ -34,7 +32,7 @@ public class SEDBConfig : ViewModel
private string _commandPrefix = ";;";
public string CommandPrefix { get => _commandPrefix; set => SetValue(ref _commandPrefix, value); }

private bool _asServer = false;
private bool _asServer = false;
public bool AsServer { get => _asServer; set => SetValue(ref _asServer, value); }

private bool _useNicks = false;
Expand Down Expand Up @@ -63,7 +61,7 @@ public class SEDBConfig : ViewModel

private string _leave = ":new_moon: The player {p} left the server";
public string Leave { get => _leave; set => SetValue(ref _leave, value); }

private bool _useStatus = true;
public bool UseStatus { get => _useStatus; set => SetValue(ref _useStatus, value); }

Expand Down
2 changes: 1 addition & 1 deletion SEDiscordBridge/SEDBControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Label x:Name="popupTarget" FontWeight="Bold" FontSize="16" Content="Main Config:" />
<CheckBox Content="Enabled" Margin="3" IsChecked="{Binding Enabled}" ToolTip="Enable or disable SEDiscordBridge"/>
<CheckBox Content="Load Bot before server start" Margin="3" IsChecked="{Binding PreLoad}" ToolTip="Load BOT before server start? Good to test or check if boot is connecting!"/>
<CheckBox Content="Send simulation speed to captainjackyt.com for analytics" Margin="3" IsChecked="{Binding DataCollect}" ToolTip="Enabling this will send simulation speed and player count to stated website"/>
<CheckBox Content="Send simulation speed to captainjackyt.com for analytics (wip server stats website)" Margin="3" IsChecked="{Binding DataCollect}" ToolTip="Enabling this will send simulation speed and player count to stated website" IsEnabled="False"/>
<Label Height="20">
<LineBreak/>
</Label>
Expand Down
16 changes: 8 additions & 8 deletions SEDiscordBridge/SEDBControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ public SEDBControl(SEDiscordBridgePlugin plugin) : this()
{
Plugin = plugin;
DataContext = plugin.Config;


cbFontColor.ItemsSource = new ObservableCollection<string>(typeof(MyFontEnum).GetFields().Select(x => x.Name).ToList());
cbFacFontColor.ItemsSource = new ObservableCollection<string>(typeof(MyFontEnum).GetFields().Select(x => x.Name).ToList());
UpdateDataGrid();
}

private void UpdateDataGrid()
{
var factions = from f in Plugin.Config.FactionChannels select new { Faction = f.Split(':')[0], Channel = f.Split(':')[1] };
var factions = from f in Plugin.Config.FactionChannels select new { Faction = f.Split(':')[0], Channel = f.Split(':')[1] };
dgFacList.ItemsSource = factions;
}

Expand All @@ -56,9 +56,9 @@ private void SaveConfig_OnClick(object sender, RoutedEventArgs e)
}
}
else
{
{
Plugin.UnloadSEDB();
}
}
}

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
Expand All @@ -83,8 +83,8 @@ private void BtnDelFac_Click(object sender, RoutedEventArgs e)
{
dynamic dataRow = dgFacList.SelectedItem;
Plugin.Config.FactionChannels.Remove(dataRow.Faction + ":" + dataRow.Channel);
UpdateDataGrid();
}
UpdateDataGrid();
}
}

private void DgFacList_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand All @@ -94,7 +94,7 @@ private void DgFacList_SelectionChanged(object sender, SelectionChangedEventArgs
dynamic dataRow = dgFacList.SelectedItem;
txtFacName.Text = dataRow.Faction;
txtFacChannel.Text = dataRow.Channel;
}
}
}

private void CbFontColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand Down
21 changes: 11 additions & 10 deletions SEDiscordBridge/SEDiscordBridge.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,20 @@
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.6.2\lib\net45\NLog.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\NLog.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sandbox.Common">
<HintPath>..\GameBinaries\Sandbox.Common.dll</HintPath>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\DedicatedServer64\Sandbox.Common.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sandbox.Game">
<HintPath>..\GameBinaries\Sandbox.Game.dll</HintPath>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\DedicatedServer64\Sandbox.Game.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
Expand Down Expand Up @@ -113,27 +114,27 @@
<Private>False</Private>
</Reference>
<Reference Include="Torch">
<HintPath>..\TorchBinaries\Torch.dll</HintPath>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\Torch.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Torch.API">
<HintPath>..\TorchBinaries\Torch.API.dll</HintPath>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\Torch.API.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Torch.Server">
<HintPath>..\TorchBinaries\Torch.Server.exe</HintPath>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\Torch.Server.exe</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VRage">
<HintPath>..\GameBinaries\VRage.dll</HintPath>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\DedicatedServer64\VRage.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VRage.Game">
<HintPath>..\GameBinaries\VRage.Game.dll</HintPath>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\DedicatedServer64\VRage.Game.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VRage.Library">
<HintPath>..\GameBinaries\VRage.Library.dll</HintPath>
<HintPath>..\..\..\..\SpaceEngineersDedicado\torch-server\DedicatedServer64\VRage.Library.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="WindowsBase">
Expand Down
Loading

0 comments on commit a107129

Please sign in to comment.