-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Possibilité de gérer des fichiers à travers le serveur
- Interface graphique - Logs
- Loading branch information
Showing
39 changed files
with
778 additions
and
581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | ||
<section name="QLS_UI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
<userSettings> | ||
<QLS_UI.Properties.Settings> | ||
<setting name="ip" serializeAs="String"> | ||
<value>127.0.0.1</value> | ||
</setting> | ||
<setting name="port" serializeAs="String"> | ||
<value>30000</value> | ||
</setting> | ||
</QLS_UI.Properties.Settings> | ||
</userSettings> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Application x:Class="QLS_UI.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:QLS_UI" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace QLS_UI | ||
{ | ||
/// <summary> | ||
/// Logique d'interaction pour App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<Window x:Class="QLS_UI.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:local="clr-namespace:QLS_UI" | ||
mc:Ignorable="d" | ||
Title="zoneck server" MinHeight="450" MinWidth="800" Background="#FF1F1E1E" FontFamily="Verdana" WindowStartupLocation="CenterScreen" Icon="/icon.png"> | ||
<Grid> | ||
<Grid x:Name="Grid_Setup" Visibility="Visible"> | ||
<TextBlock Text="Configuration du serveur" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="35" Margin="0,50,0,0"/> | ||
|
||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" Text="IP" FontSize="20" Margin="0,-100,0,0"/> | ||
<TextBox x:Name="txtBox_ip" Margin="0,-25,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="300" Height="40" Background="#FF0A3C0F" | ||
BorderBrush="Black" Foreground="White" Text="127.0.0.1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" | ||
FontFamily="Consolas" FontSize="20"/> | ||
|
||
<TextBlock Margin="0,100,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" Text="Port" FontSize="20"/> | ||
<TextBox x:Name="txtBox_port" Margin="0,170,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="300" Height="40" Background="#FF0A3C0F" | ||
BorderBrush="Black" Foreground="White" Text="30000" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" | ||
FontFamily="Consolas" FontSize="20"/> | ||
|
||
<Button VerticalAlignment="Bottom" HorizontalAlignment="Center" Width="250" Height="40" Background="#FF1D4240" | ||
BorderBrush="Black" Foreground="White" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" | ||
FontFamily="Consolas" FontSize="20" Margin="0,0,0,25" Content="Lancer" Click="Button_Start_Click" /> | ||
</Grid> | ||
|
||
<Grid x:Name="Grid_Logs" Visibility="Hidden"> | ||
<TextBlock Text="Logs" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="35" Margin="0,30,0,0"/> | ||
<TextBlock x:Name="label_ipport" Text="127.0.0.1 - 30000" Foreground="#FF776E6E" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="13" Margin="0,80,0,0"/> | ||
|
||
<RichTextBox x:Name="rtb_logs" Background="#FF212121" BorderBrush="Black" IsReadOnly="True" BorderThickness="3,3,3,3" Margin="20,100,20,20" Foreground="#FF7DFF00" SelectionBrush="#00000000" Padding="20,20,20,0" /> | ||
|
||
<Label x:Name="label_connecter" Foreground="#FF14691A" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,75,20,0" Content="connecté : 0"/> | ||
<Label x:Name="label_temps" Foreground="#FF14691A" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="20,75,0,0" Content="temps : 00:00:00"/> | ||
|
||
<Button VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,30,30" Width="75" Content="Stop" Background="#FF8C1616" BorderBrush="Black" Foreground="White" Height="23" Click="Button_StopStartServer_Click"/> | ||
|
||
<CheckBox x:Name="checkbox_logs" Content="logs" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,110,33" Foreground="White" BorderBrush="Black" Background="White" IsChecked="True"/> | ||
</Grid> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
using sck_server; | ||
using SuperSocket.SocketEngine.Configuration; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Timers; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using Path = System.IO.Path; | ||
|
||
namespace QLS_UI | ||
{ | ||
/// <summary> | ||
/// Logique d'interaction pour MainWindow.xaml | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
{ | ||
Timer T_ExecutionTime = new Timer(1000); | ||
TimeSpan Temps = new TimeSpan(); | ||
private ZoneckServer serveur; | ||
|
||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
|
||
txtBox_ip.Text = Properties.Settings.Default.ip; | ||
txtBox_port.Text = Properties.Settings.Default.port; | ||
} | ||
|
||
/// <summary> | ||
/// Lance le serveur | ||
/// </summary> | ||
/// <param name="sender"></param> | ||
/// <param name="e"></param> | ||
private void Button_Start_Click(object button, RoutedEventArgs _e) | ||
{ | ||
try | ||
{ | ||
serveur = new ZoneckServer(txtBox_ip.Text, Convert.ToInt32(txtBox_port.Text), DebugMessage); | ||
|
||
Properties.Settings.Default.ip = txtBox_ip.Text; | ||
Properties.Settings.Default.port = txtBox_port.Text; | ||
Properties.Settings.Default.Save(); | ||
|
||
rtb_logs.AppendText(DateTime.Now.ToString() + " - Server startup"); | ||
|
||
Grid_Setup.Visibility = Visibility.Hidden; | ||
Grid_Logs.Visibility = Visibility.Visible; | ||
|
||
label_ipport.Text = txtBox_ip.Text + " - " + Convert.ToInt32(txtBox_port.Text); | ||
T_ExecutionTime.Elapsed += (sender, e) => | ||
{ | ||
Temps = Temps.Add(new TimeSpan(0, 0, 1)); | ||
|
||
Dispatcher.Invoke(() => | ||
{ | ||
label_temps.Content = "temps : " + Temps.ToString(@"hh\:mm\:ss"); | ||
}); | ||
}; | ||
|
||
T_ExecutionTime.Start(); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Le serveur n'a pas réussi à se lancer. Veuillez vérifier les informations.", "Mauvaise(s) information(s)", MessageBoxButton.OK, MessageBoxImage.Error); | ||
txtBox_port.BorderBrush = Brushes.Red; | ||
txtBox_ip.BorderBrush = Brushes.Red; | ||
} | ||
} | ||
|
||
private void DebugMessage(string obj) | ||
{ | ||
Dispatcher.Invoke(() => | ||
{ | ||
if (obj.Contains("[nbre-personne-connecté] - ")) | ||
{ | ||
label_connecter.Content = "connecté : " + obj.Remove(0, obj.LastIndexOf('-') + 2).Trim(); | ||
} | ||
if (checkbox_logs.IsChecked == true) | ||
{ | ||
rtb_logs.AppendText(obj + "\r\n"); | ||
rtb_logs.ScrollToEnd(); | ||
} | ||
}); | ||
} | ||
|
||
private void Button_StopStartServer_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (((Button)sender).Content.ToString() == "Stop") | ||
{ | ||
serveur.StopServer(); | ||
T_ExecutionTime.Stop(); | ||
|
||
rtb_logs.AppendText("\n" + DateTime.Now.ToString() + " - Serveur stoppé" + "\r\n"); | ||
rtb_logs.ScrollToEnd(); | ||
|
||
(sender as Button).Content = "Lancer"; | ||
} | ||
else | ||
{ | ||
(sender as Button).Content = "Stop"; | ||
try | ||
{ | ||
serveur = new ZoneckServer(txtBox_ip.Text, Convert.ToInt32(txtBox_port.Text), DebugMessage); | ||
rtb_logs.AppendText("\n" + DateTime.Now.ToString() + " - Serveur lancé" + "\r\n"); | ||
rtb_logs.ScrollToEnd(); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Le serveur n'a pas réussi à se lancer. Veuillez vérifier les informations.", "Mauvaise(s) information(s)", MessageBoxButton.OK, MessageBoxImage.Error); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using System.Windows; | ||
|
||
// Les informations générales relatives à un assembly dépendent de | ||
// l'ensemble d'attributs suivant. Pour modifier les informations | ||
// associées à un assembly. | ||
[assembly: AssemblyTitle("QLS UI")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("QLS UI")] | ||
[assembly: AssemblyCopyright("Copyright © 2022")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly | ||
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de | ||
// COM, affectez la valeur True à l'attribut ComVisible sur ce type. | ||
[assembly: ComVisible(false)] | ||
|
||
//Pour commencer à générer des applications localisables, définissez | ||
//<UICulture>CultureUtiliséePourCoder</UICulture> dans votre fichier .csproj | ||
//dans <PropertyGroup>. Par exemple, si vous utilisez le français | ||
//dans vos fichiers sources, définissez <UICulture> à fr-FR. Puis, supprimez les marques de commentaire de | ||
//l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans | ||
//la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet. | ||
|
||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] | ||
|
||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème | ||
//(utilisé si une ressource est introuvable dans la page, | ||
// ou dictionnaires de ressources de l'application) | ||
ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique | ||
//(utilisé si une ressource est introuvable dans la page, | ||
// dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème) | ||
)] | ||
|
||
|
||
// Les informations de version pour un assembly se composent des quatre valeurs suivantes : | ||
// | ||
// Version principale | ||
// Version secondaire | ||
// Numéro de build | ||
// Révision | ||
// | ||
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut | ||
// en utilisant '*', comme indiqué ci-dessous : | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.