Skip to content

Commit 0d3eaaa

Browse files
committed
Update
1 parent 5bc0c20 commit 0d3eaaa

20 files changed

Lines changed: 109 additions & 114 deletions

Source/NETworkManager.Models/NETworkManager.Models.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,16 @@
111111
<Compile Include="Network\Traceroute.cs" />
112112
<Compile Include="Network\TracerouteHopInfo.cs" />
113113
<Compile Include="Network\TracerouteHopReceivedArgs.cs" />
114+
<Compile Include="Network\WakeOnLAN.cs" />
114115
<Compile Include="Network\WakeOnLanInfo.cs" />
116+
<Compile Include="Network\Whois.cs" />
115117
<Compile Include="Network\WhoisServerInfo.cs" />
116118
<Compile Include="Network\WiFi.cs" />
117119
<Compile Include="Network\WiFiAdapterInfo.cs" />
118120
<Compile Include="Network\WiFiNetworkInfo.cs" />
121+
<Compile Include="PowerShell\PowerShell.cs" />
119122
<Compile Include="PowerShell\PowerShell.ExecutionPolicy.cs" />
123+
<Compile Include="PowerShell\PowerShellSessionInfo.cs" />
120124
<Compile Include="Properties\AssemblyInfo.cs" />
121125
<Compile Include="PuTTY\PuTTY.ConnectionMode.cs" />
122126
<Compile Include="RemoteDesktop\AudioCaptureRedirectionMode.cs" />
@@ -128,6 +132,7 @@
128132
<Compile Include="RemoteDesktop\RemoteDesktopKeystrokeInfo.cs" />
129133
<Compile Include="RemoteDesktop\RemoteDesktopPerformanceConstants.cs" />
130134
<Compile Include="RemoteDesktop\RemoteDesktopSessionInfo.cs" />
135+
<Compile Include="TigerVNC\TigerVNC.cs" />
131136
<Compile Include="TigerVNC\TigerVNCSessionInfo.cs" />
132137
<Compile Include="WebConsole\WebConsoleSessionInfo.cs" />
133138
</ItemGroup>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using NETworkManager.Utilities;
2+
using System.Net.Sockets;
3+
4+
namespace NETworkManager.Models.Network
5+
{
6+
public static class WakeOnLAN
7+
{
8+
public static void Send(WakeOnLANInfo info)
9+
{
10+
using (var udpClient = new UdpClient())
11+
{
12+
udpClient.Connect(info.Broadcast, info.Port);
13+
14+
udpClient.Send(info.MagicPacket, info.MagicPacket.Length);
15+
}
16+
}
17+
18+
public static byte[] CreateMagicPacket(byte[] mac)
19+
{
20+
var packet = new byte[17 * 6];
21+
22+
for (var i = 0; i < 6; i++)
23+
packet[i] = 0xFF;
24+
25+
for (var i = 1; i <= 16; i++)
26+
{
27+
for (var j = 0; j < 6; j++)
28+
packet[i * 6 + j] = mac[j];
29+
}
30+
31+
return packet;
32+
}
33+
34+
public static byte[] CreateMagicPacket(string mac)
35+
{
36+
var macBytes = MACAddressHelper.ConvertStringToByteArray(mac);
37+
38+
return CreateMagicPacket(macBytes);
39+
}
40+
}
41+
}

Source/NETworkManager/Models/Network/Whois.cs renamed to Source/NETworkManager.Models/Network/Whois.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
using System.Text;
66
using System.Threading.Tasks;
77
using System.Xml;
8-
using NETworkManager.Models.Settings;
98

109
namespace NETworkManager.Models.Network
1110
{
12-
public class Whois
11+
public static class Whois
1312
{
1413
#region Variables
15-
private static readonly string WhoisServerFilePath =
16-
Path.Combine(ConfigurationManager.Current.ExecutionPath, "Resources", "WhoisServers.xml");
14+
private static readonly string WhoisServerFilePath = ""; // ToDo // Path.Combine(ConfigurationManager.Current.ExecutionPath, "Resources", "WhoisServers.xml");
1715

1816
private static readonly List<WhoisServerInfo> WhoisServerList;
1917
private static readonly Lookup<string, WhoisServerInfo> WhoisServers;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace NETworkManager.Models.PowerShell
2+
{
3+
public static partial class PowerShell
4+
{
5+
public static string BuildCommandLine(PowerShellSessionInfo sessionInfo)
6+
{
7+
var command = $"-ExecutionPolicy {sessionInfo.ExecutionPolicy} {sessionInfo.AdditionalCommandLine}";
8+
9+
if (sessionInfo.EnableRemoteConsole)
10+
command += $" -NoExit -Command \"Enter-PSSession -ComputerName {sessionInfo.Host}\"";
11+
12+
return command;
13+
}
14+
}
15+
}

Source/NETworkManager/Models/PowerShell/PowerShellSessionInfo.cs renamed to Source/NETworkManager.Models/PowerShell/PowerShellSessionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using static NETworkManager.Models.PowerShell.PowerShell;
22

3-
namespace NETworkManager.Models.PowerShellTmp
3+
namespace NETworkManager.Models.PowerShell
44
{
55
public class PowerShellSessionInfo
66
{
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace NETworkManager.Models.TigerVNC
2+
{
3+
public static class TigerVNC
4+
{
5+
public static string BuildCommandLine(TigerVNCSessionInfo sessionInfo)
6+
{
7+
return $"{sessionInfo.Host}::{sessionInfo.Port}";
8+
}
9+
}
10+
}

Source/NETworkManager/Controls/PowerShellControl.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private async void Connect()
125125
var info = new ProcessStartInfo
126126
{
127127
FileName = _sessionInfo.ApplicationFilePath,
128-
Arguments = Models.PowerShellTmp.PowerShell.BuildCommandLine(_sessionInfo)
128+
Arguments = Models.PowerShell.PowerShell.BuildCommandLine(_sessionInfo)
129129
};
130130

131131
try

Source/NETworkManager/Controls/TightVNCControl.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private async void Connect()
125125
var info = new ProcessStartInfo
126126
{
127127
FileName = _sessionInfo.ApplicationFilePath,
128-
Arguments = Models.TigerVNCTMP.TigerVNC.BuildCommandLine(_sessionInfo)
128+
Arguments = TigerVNC.BuildCommandLine(_sessionInfo)
129129
};
130130

131131
try

Source/NETworkManager/Models/EventSystem/EventSystem.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
using System;
22
using NETworkManager.Models.Application;
3-
using NETworkManager.Models.Profile;
43

54
namespace NETworkManager.Models.EventSystem
65
{
76
public class EventSystem
87
{
9-
// This will notify the mail window, to change the view to another application and redirect a profile
10-
public static event EventHandler RedirectProfileToApplicationEvent;
11-
12-
public static void RedirectProfileToApplication(ApplicationName application, ProfileInfo profile)
13-
{
14-
RedirectProfileToApplicationEvent?.Invoke(null, new EventSystemRedirectProfileApplicationArgs(application, profile));
15-
}
16-
178
// This will notify the mail window, to change the view to another application and redirect some data (hostname, ip)
189
public static event EventHandler RedirectDataToApplicationEvent;
1910

Source/NETworkManager/Models/EventSystem/EventSystemRedirectProfileApplicationArgs.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)