Skip to content

Commit

Permalink
Ver 0.10.0-RC1: Can get player's IP now
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiroiame-Kusu committed Sep 9, 2023
1 parent a398003 commit ec6dc9c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Serein/Universal/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ internal static class Global
/// <summary>
/// 版本号
/// </summary>
public const string VERSION = "v0.10.0-B1";
public const string VERSION = "v0.10.0-RC1";
//public static readonly string VERSION = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion.ToString();

/// <summary>
/// 分支
/// </summary>
public const string BRANCH = "Preview";
public const string BRANCH = "ReleaseCandidate";


/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Serein/Universal/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.10.0.0")]
[assembly: AssemblyFileVersion("0.10.0-B1")]
[assembly: AssemblyVersion("0.10.0.1")]
[assembly: AssemblyFileVersion("0.10.0-RC1")]
2 changes: 1 addition & 1 deletion Serein/WPF/Serein-WPF.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net6.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
3 changes: 2 additions & 1 deletion Serein/WPF/Windows/Pages/Server/Panel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@
DockPanel.Dock="Top"
IsReadOnly="True"
IsUndoEnabled="False"
UndoLimit="0" />
UndoLimit="0"
TextChanged="PanelRichTextBox_TextChanged"/>
</DockPanel>
</GroupBox>
</Grid>
Expand Down
19 changes: 18 additions & 1 deletion Serein/WPF/Windows/Pages/Server/Panel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
using System;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Controls;
using Esprima.Ast;

namespace Serein.Windows.Pages.Server
{
public partial class Panel : UiPage
{
private readonly Timer _updateInfoTimer = new Timer(2000) { AutoReset = true };

public static string ServerLog {get; set;}
public Panel()
{
InitializeComponent();
Expand Down Expand Up @@ -188,5 +190,20 @@ private void AutoJVMOptimization_Click(object sender, RoutedEventArgs e)
{
Global.Settings.Server.AutoJVMOptimization = (bool)AutoJVMOptimization.IsChecked;
}

private void PanelRichTextBox_TextChanged(object sender, TextChangedEventArgs e)
{

TextRange textRange = new TextRange(
// TextPointer to the start of content in the RichTextBox.
PanelRichTextBox.Document.ContentStart,
// TextPointer to the end of content in the RichTextBox.
PanelRichTextBox.Document.ContentEnd
);

// The Text property on a TextRange object returns a string
// representing the plain text content of the TextRange.
ServerLog = textRange.Text;
}
}
}
17 changes: 17 additions & 0 deletions Serein/WPF/Windows/Pages/Server/PlayerList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public PlayerList()


}

private void refresh()
{
string? PlayerListItems = null;
Expand All @@ -69,7 +70,23 @@ private void refresh()
{
string? Username = PlayerListData["sample"][a]["name"].ToString();
string? UUID = PlayerListData["sample"][a]["id"].ToString();

string UsernameFilter = Username + @"\[\/(.*?)\]";
string IPFilter = @"\[\/(.*?)\]";
string? IP = null;
try
{
MatchCollection match = Regex.Matches(Panel.ServerLog, UsernameFilter);
Console.WriteLine(match.Count());
string? str = Regex.Match(match[match.Count() - 1].Value, IPFilter).ToString();
str = str.Remove(0, 2);
IP = str.Substring(0, str.Length - 1);
}
catch
{

}

items.Add(new Player() { Username = Username, UUID = UUID, IP = IP });
}
}
Expand Down

0 comments on commit ec6dc9c

Please sign in to comment.