<commit_before>﻿<Window x:Class="Server.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:local="clr-namespace:Server"
        mc:Ignorable="d" FontSize="14" Name="wMain" Icon="LocalServer.ico"
        Title="Server" Height="385.665" Width="526.886">
    <Window.Resources>
        <local:BooleanToStartStopConverter x:Key="BooleanToStartStopConverter" />
        <local:BooleanToServerStatusMessageConverter x:Key="BooleanToServerStatusMessageConverter" />
        <local:BooleanToBrushConverter x:Key="BooleanToBrushConverter" />
        <Style TargetType="TextBox">
            <Setter Property="Margin" Value="3"/>
            <Setter Property="Padding" Value="3"/>
        </Style>
        <Style TargetType="xctk:IntegerUpDown">
            <Setter Property="Margin" Value="3"/>
            <Setter Property="Padding" Value="3"/>
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Width" Value="120"/>
            <Setter Property="Margin" Value="3"/>
        </Style>
        <Style TargetType="Button">
            <Setter Property="Width" Value="70"/>
            <Setter Property="Margin" Value="3"/>
        </Style>
        <Style TargetType="ListBox">
            <Setter Property="Margin" Value="3"/>
        </Style>
    </Window.Resources>
    <DockPanel Margin="0 10 0 0">
        <StatusBar Name="sbMain" DockPanel.Dock="Bottom">
            <StatusBarItem>
                <TextBlock Text="{Binding Path=IsServerActive,Converter={StaticResource BooleanToServerStatusMessageConverter}}" Background="{Binding Path=IsServerActive,Converter={StaticResource BooleanToBrushConverter}}" />
            </StatusBarItem>
            <Separator/>
            <StatusBarItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Active users: " Width="auto"/>
                    <TextBlock Text="{Binding Path=ActiveClients}" Width="auto"/>
                </StackPanel>
            </StatusBarItem>
        </StatusBar>
        <DockPanel IsEnabled="{Binding Path=IsServerActive}" DockPanel.Dock="Right">
            <TextBlock DockPanel.Dock="Top" Text="Active Clients" TextAlignment="Center"/>
            <ListBox Name="lbActiveClients" ItemsSource="{Binding Path=lstClients}" DisplayMemberPath="Username"/>
        </DockPanel>
        <Grid Name="gControl" DockPanel.Dock="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0" Grid.Row="0" Text="Socket Address:"/>
            <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=IpAddress, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=IsServerStopped}"/>
            <xctk:IntegerUpDown Grid.Column="2" Grid.Row="0" Value="{Binding Path=Port, UpdateSourceTrigger=PropertyChanged}" Width="70" IsEnabled="{Binding Path=IsServerStopped}"/>

            <TextBlock Grid.Column="0" Grid.Row="1" Text="Username:"/>
            <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Path=Username, UpdateSourceTrigger=PropertyChanged}"/>

            <Button Name="bSwitchServerState" Grid.Column="3" Grid.Row="0" Grid.RowSpan="2" Content="{Binding Path=IsServerActive,Converter={StaticResource BooleanToStartStopConverter}}" Click="bSwitchServerState_Click"/>
        </Grid>
        <DockPanel IsEnabled="{Binding Path=IsServerActive}">
            <Grid DockPanel.Dock="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <TextBlock Grid.Column="0" Grid.Row="0" Text="Target Username:"/>
                <TextBox Name="tbTargetUsername" Grid.Column="1" Grid.Row="0"/>

                <TextBlock Grid.Column="0" Grid.Row="1" Text="Message:"/>
                <TextBox Name="tbMessage" Grid.Column="1" Grid.Row="1"/>

                <Button Name="bSend" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" Content="Send" Click="bSend_Click"/>
            </Grid>
            <ListBox Name="lstChatHistory" ItemsSource="{Binding Path=lstChat}"/>
        </DockPanel>
    </DockPanel><commit_msg>ip and port validation bugfix<commit_after>﻿<Window x:Class="Server.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:local="clr-namespace:Server"
        mc:Ignorable="d" FontSize="14" Name="wMain" Icon="LocalServer.ico"
        Title="Server" Height="385.665" Width="526.886">
    <Window.Resources>
        <local:BooleanToStartStopConverter x:Key="BooleanToStartStopConverter" />
        <local:BooleanToServerStatusMessageConverter x:Key="BooleanToServerStatusMessageConverter" />
        <local:BooleanToBrushConverter x:Key="BooleanToBrushConverter" />
        <Style TargetType="TextBox">
            <Setter Property="Margin" Value="3"/>
            <Setter Property="Padding" Value="3"/>
        </Style>
        <Style TargetType="xctk:IntegerUpDown">
            <Setter Property="Margin" Value="3"/>
            <Setter Property="Padding" Value="3"/>
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Width" Value="120"/>
            <Setter Property="Margin" Value="3"/>
        </Style>
        <Style TargetType="Button">
            <Setter Property="Width" Value="70"/>
            <Setter Property="Margin" Value="3"/>
        </Style>
        <Style TargetType="ListBox">
            <Setter Property="Margin" Value="3"/>
        </Style>
    </Window.Resources>
    <DockPanel Margin="0 10 0 0">
        <StatusBar Name="sbMain" DockPanel.Dock="Bottom">
            <StatusBarItem>
                <TextBlock Text="{Binding Path=IsServerActive,Converter={StaticResource BooleanToServerStatusMessageConverter}}" Background="{Binding Path=IsServerActive,Converter={StaticResource BooleanToBrushConverter}}" />
            </StatusBarItem>
            <Separator/>
            <StatusBarItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Active users: " Width="auto"/>
                    <TextBlock Text="{Binding Path=ActiveClients}" Width="auto"/>
                </StackPanel>
            </StatusBarItem>
        </StatusBar>
        <DockPanel IsEnabled="{Binding Path=IsServerActive}" DockPanel.Dock="Right">
            <TextBlock DockPanel.Dock="Top" Text="Active Clients" TextAlignment="Center"/>
            <ListBox Name="lbActiveClients" ItemsSource="{Binding Path=lstClients}" DisplayMemberPath="Username"/>
        </DockPanel>
        <Grid Name="gControl" DockPanel.Dock="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0" Grid.Row="0" Text="Socket Address:"/>
            <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=IpAddress, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}" IsEnabled="{Binding Path=IsServerStopped}"/>
            <xctk:IntegerUpDown Grid.Column="2" Grid.Row="0" Value="{Binding Path=Port, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}" Width="70" IsEnabled="{Binding Path=IsServerStopped}"/>

            <TextBlock Grid.Column="0" Grid.Row="1" Text="Username:"/>
            <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Path=Username, UpdateSourceTrigger=PropertyChanged}"/>

            <Button Name="bSwitchServerState" Grid.Column="3" Grid.Row="0" Grid.RowSpan="2" Content="{Binding Path=IsServerActive,Converter={StaticResource BooleanToStartStopConverter}}" Click="bSwitchServerState_Click"/>
        </Grid>
        <DockPanel IsEnabled="{Binding Path=IsServerActive}">
            <Grid DockPanel.Dock="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <TextBlock Grid.Column="0" Grid.Row="0" Text="Target Username:"/>
                <TextBox Name="tbTargetUsername" Grid.Column="1" Grid.Row="0"/>

                <TextBlock Grid.Column="0" Grid.Row="1" Text="Message:"/>
                <TextBox Name="tbMessage" Grid.Column="1" Grid.Row="1"/>

                <Button Name="bSend" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" Content="Send" Click="bSend_Click"/>
            </Grid>
            <ListBox Name="lstChatHistory" ItemsSource="{Binding Path=lstChat}"/>
        </DockPanel>
    </DockPanel>
{'fraction_non_alphanumeric': 0.14316490403446924, 'fraction_numerical': 0.014296905601253428, 'mean_word_length': 2.620347394540943, 'pattern_counts': {'":': 0, '<': 165, '<?xml version=': 0, '>': 165, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6512957', 'n_tokens_mistral': 2901, 'n_tokens_neox': 2672, 'n_words': 445}