Skip to content

Commit

Permalink
Ajout de commentaires
Browse files Browse the repository at this point in the history
  • Loading branch information
zonetecde committed Mar 10, 2023
1 parent 81d0a8b commit 1249e98
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 195 deletions.
12 changes: 6 additions & 6 deletions ClassLibrary/ClassLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ public enum MESSAGE_TYPE

public class FileMessage
{
public string path;
public string content;
public bool warnOtherPeople;
public string Path;
public string Content;
public bool WarnOtherPeople;

public FileMessage(string path, bool warnOtherPeople = false, string content = "")
{
this.path = path;
this.warnOtherPeople = warnOtherPeople;
this.content = content;
this.Path = path;
this.WarnOtherPeople = warnOtherPeople;
this.Content = content;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions QLS UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void Button_Start_Click(object button, RoutedEventArgs _e)
Properties.Settings.Default.port = txtBox_port.Text;
Properties.Settings.Default.Save();

rtb_logs.AppendText(DateTime.Now.ToString() + " - Server startup");
rtb_logs.AppendText(DateTime.Now.ToString() + " - Lancement du serveur \r\n");

Grid_Setup.Visibility = Visibility.Hidden;
Grid_Logs.Visibility = Visibility.Visible;
Expand Down Expand Up @@ -82,9 +82,9 @@ private void DebugMessage(string obj)
{
Dispatcher.Invoke(() =>
{
if (obj.Contains("[nbre-personne-connecté] - "))
if (obj.Contains(" - Nombre de personne(s) connectée(s) au serveur : "))
{
label_connecter.Content = "connecté : " + obj.Remove(0, obj.LastIndexOf('-') + 2).Trim();
label_connecter.Content = "connecté : " + obj.Remove(0, obj.LastIndexOf(':') + 2).Trim();
}
if (checkbox_logs.IsChecked == true)
{
Expand All @@ -101,7 +101,7 @@ private void Button_StopStartServer_Click(object sender, RoutedEventArgs e)
serveur.StopServer();
T_ExecutionTime.Stop();

rtb_logs.AppendText("\n" + DateTime.Now.ToString() + " - Serveur stoppé" + "\r\n");
rtb_logs.AppendText("\n" + DateTime.Now.ToString() + " - Arrêt du serveur" + "\r\n");
rtb_logs.ScrollToEnd();

(sender as Button).Content = "Lancer";
Expand All @@ -112,7 +112,7 @@ private void Button_StopStartServer_Click(object sender, RoutedEventArgs e)
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.AppendText("\n" + DateTime.Now.ToString() + " - Lancement du serveur" + "\r\n");
rtb_logs.ScrollToEnd();
}
catch
Expand Down
10 changes: 4 additions & 6 deletions QLS UI/QLS UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="zck_server, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\zck_server\bin\Debug\zck_server.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
Expand Down Expand Up @@ -121,12 +125,6 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\zck_server\zck_server.csproj">
<Project>{66a04f51-acc6-4da7-bdd6-c43e6a6654ed}</Project>
<Name>zck_server</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="icon.png" />
</ItemGroup>
Expand Down
Binary file added setup/QLS Zoneck 1.0.6.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion setup/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "QLS Zoneck"
#define MyAppVersion "1.0.5"
#define MyAppVersion "1.0.6"
#define MyAppPublisher "zonetecde"
#define MyAppURL "github.com/zonetecde/zoneck-server"
#define MyAppExeName "QLS UI.exe"
Expand Down
14 changes: 7 additions & 7 deletions zck_client/ClassLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public enum MESSAGE_TYPE

public class FileMessage
{
public string path;
public string content;
public bool warnOtherPeople;
public string Path;
public string Content;
public bool WarnOtherPeople;

public FileMessage(string path, bool warnOtherPeople, string content = "")
public FileMessage(string path, bool warnOtherPeople = false, string content = "")
{
this.path = path;
this.warnOtherPeople = warnOtherPeople;
this.content = content;
this.Path = path;
this.WarnOtherPeople = warnOtherPeople;
this.Content = content;
}
}
}
Expand Down
31 changes: 13 additions & 18 deletions zck_client/ZoneckClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public void CreateFile(string path)
/// Supprime un fichier sur le serveur
/// </summary>
/// <param name="path">Chemin du fichier à supprimer</param>
/// <param name="warnOtherPeople">Prévenur les autres utilisateurs qu'un fichier a été supprimé</param>
/// <remarks>Si warnOtherPeople est activé, Les personnes connectées au serveur reçevrons une alerte envoyé dans leur fonction MessageReceived. Ce sera un message de type "FILE_DELETED". Le chemin d'accès au fichier se trouvera dans msg.Content</remarks>
/// <param name="warnOtherPeople">Prévenir les autres utilisateurs qu'un fichier a été supprimé</param>
/// <remarks>Si warnOtherPeople est activé, Les personnes connectées au serveur recevrons une alerte envoyé dans leur fonction MessageReceived. Ce sera un message de type "FILE_DELETED". Le chemin d'accès au fichier se trouvera dans msg.Content</remarks>
public void DeleteFile(string path, bool warnOtherPeople)
{
string msg = JsonConvert.SerializeObject(new Message(MyId, JsonConvert.SerializeObject(new FileMessage(path, warnOtherPeople)), MESSAGE_TYPE.FILE_DELETED)) + "\r\n";
Expand All @@ -90,8 +90,8 @@ public void DeleteFile(string path, bool warnOtherPeople)
/// </summary>
/// <param name="path">Le chemin d'accès au fichier</param>
/// <param name="updatedFileContent">Le nouveau contenue du fichier</param>
/// <param name="warnOtherPeople">Prévenur les autres utilisateurs qu'un fichier a été modifié</param>
/// <remarks>Si warnOtherPeople est activé, Les personnes connectées au serveur reçevrons une alerte envoyé dans leur fonction MessageReceived. Ce sera un message de type "FILE_UPDATED". Il faudra désérialiser le msg.Content en type "FileMessage". Le chemin d'accès au fichier se trouvera dans fM.Path, et le nouveau contenu dans fM.Content.</remarks>
/// <param name="warnOtherPeople">Prévenir les autres utilisateurs qu'un fichier a été modifié</param>
/// <remarks>Si warnOtherPeople est activé, Les personnes connectées au serveur recevrons une alerte envoyé dans leur fonction MessageReceived. Ce sera un message de type "FILE_UPDATED". Il faudra désérialiser le msg.Content en type "FileMessage". Le chemin d'accès au fichier se trouvera dans fM.Path, et le nouveau contenu dans fM.Content.</remarks>
public void UpdateFile(string path, string updatedFileContent, bool warnOtherPeople)
{
string msg = JsonConvert.SerializeObject(new Message(MyId, JsonConvert.SerializeObject(new FileMessage(path, warnOtherPeople, updatedFileContent)), MESSAGE_TYPE.FILE_UPDATED)) + "\r\n";
Expand Down Expand Up @@ -129,20 +129,15 @@ private void _Receive()

if (!String.IsNullOrEmpty(message))
{
if (!message.Contains("@[B]"))
{
Message received_message = JsonConvert.DeserializeObject<Message>(message);

// pour id
if (received_message.MessageType == MESSAGE_TYPE.DONNER_ID)
MyId = received_message.Content;

Receive(received_message);
}
else
{
Receive(new Message(String.Empty, message.Remove(0, 4), MESSAGE_TYPE.MESSAGE_BRUTE));
}

Message received_message = JsonConvert.DeserializeObject<Message>(message);

// pour id
if (received_message.MessageType == MESSAGE_TYPE.DONNER_ID)
MyId = received_message.Content;

Receive(received_message);


}
}
Expand Down
Loading

0 comments on commit 1249e98

Please sign in to comment.