mirror of
https://github.com/DaKerboul/perun.git
synced 2026-08-09 17:05:39 +02:00
VS projecy update to 8.0.0
This commit is contained in:
@@ -1,91 +0,0 @@
|
||||
// This class handles UDP communication
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
internal class UDPController
|
||||
{
|
||||
// Main class for UDP listener
|
||||
public static int intListenPort; // Port to listen at
|
||||
public static bool boolDone; // Helper to exit main loop without killing thread
|
||||
public static UdpClient udpListener; // Listener object
|
||||
public static string[] arrLogHistory; // Log history for GUI
|
||||
public static string[] arrSendBuffer; // Mysql send buffer
|
||||
public static Thread thrUDPListener; // Seperate thread for UDP
|
||||
|
||||
public static void Create(int intListenPort, ref string[] arrLogHistory, ref string[] arrSendBuffer)
|
||||
{
|
||||
// Create class
|
||||
UDPController.intListenPort = intListenPort;
|
||||
UDPController.arrLogHistory = arrLogHistory;
|
||||
UDPController.arrSendBuffer = arrSendBuffer;
|
||||
}
|
||||
|
||||
public static void StopListen()
|
||||
{
|
||||
// FInish listening
|
||||
UDPController.boolDone = true;
|
||||
UDPController.udpListener.Close();
|
||||
UDPController.udpListener = null;
|
||||
|
||||
for (int i = 0; i < arrSendBuffer.Length - 1; i++)
|
||||
{
|
||||
arrSendBuffer[i] = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void StartListen()
|
||||
{
|
||||
Console.WriteLine("UDP Listen start");
|
||||
try
|
||||
{
|
||||
// Start listening to UDP
|
||||
|
||||
udpListener = new UdpClient(intListenPort);
|
||||
IPEndPoint ipendpointGroupEP = new IPEndPoint(IPAddress.Loopback, intListenPort);
|
||||
string strReceivedData;
|
||||
byte[] arrReceiveByteArray;
|
||||
|
||||
// Start the main loop
|
||||
UDPController.boolDone = false;
|
||||
while (!UDPController.boolDone)
|
||||
{
|
||||
// Start listening
|
||||
Console.WriteLine("UDP: Waiting for packet");
|
||||
arrReceiveByteArray = udpListener.Receive(ref ipendpointGroupEP);
|
||||
strReceivedData = Encoding.ASCII.GetString(arrReceiveByteArray, 0, arrReceiveByteArray.Length);
|
||||
Console.WriteLine("Sender: {0} Payload: {1}", ipendpointGroupEP.ToString(), strReceivedData);
|
||||
|
||||
// Add to log history and rotate
|
||||
dynamic dynamicRawUDPFrame = JsonConvert.DeserializeObject(strReceivedData); // Deserialize received frame
|
||||
string strRawUDPFrameType = dynamicRawUDPFrame.type;
|
||||
PerunHelper.LogHistoryAdd(ref arrLogHistory, "UDP packet received, type: " + strRawUDPFrameType);
|
||||
|
||||
// Add to mySQL send buffer (find first empty slot)
|
||||
for (int i = 0; i < arrSendBuffer.Length - 1; i++)
|
||||
{
|
||||
if (arrSendBuffer[i] == null)
|
||||
{
|
||||
arrSendBuffer[i] = strReceivedData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
udpListener.Close(); // Close port
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// General exception found
|
||||
if (e.HResult != -2147467259) {
|
||||
Console.WriteLine(e.ToString());
|
||||
PerunHelper.LogHistoryAdd(ref arrLogHistory, "ERROR UDP - port may be in use");
|
||||
}
|
||||
}
|
||||
Console.WriteLine("UDP listen stop");
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>ftp://s18.mydevil.net/perun/</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
@@ -33,12 +34,11 @@
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>Perun.htm</WebPage>
|
||||
<ApplicationRevision>7</ApplicationRevision>
|
||||
<ApplicationVersion>0.7.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>0.8.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -171,7 +171,7 @@
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 i x64%29</ProductName>
|
||||
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
|
||||
@@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
|
||||
// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
|
||||
// przy użyciu symbolu „*”, tak jak pokazano poniżej:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.7.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.7.0.0")]
|
||||
[assembly: AssemblyVersion("0.8.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.8.0.0")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user