Successfully moved to XDMessaging.Lite but that required bumping the runtime version to 4.5.2.
parent
48948c197f
commit
d9ceeedeff
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
|
|
|
@ -6,11 +6,14 @@ using System.Linq;
|
|||
using System.Net.NetworkInformation;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
using SimpleIPC;
|
||||
|
||||
using WifiSitter.Helpers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// Project deps
|
||||
using WifiSitter.Helpers;
|
||||
|
||||
// 3rd party deps
|
||||
using XDMessaging;
|
||||
|
||||
namespace WifiSitter
|
||||
{
|
||||
public class WifiSitter : AbstractService
|
||||
|
@ -25,7 +28,8 @@ namespace WifiSitter
|
|||
private static string[] _ignoreNics;
|
||||
private volatile bool _paused;
|
||||
private static WifiSitterIpc _wsIpc;
|
||||
private Action<object, MessageEventArgs> _handleMsgRecv;
|
||||
private Action<object, XDMessageEventArgs> _handleMsgRecv;
|
||||
|
||||
#endregion // fields
|
||||
|
||||
|
||||
|
@ -87,7 +91,7 @@ namespace WifiSitter
|
|||
|
||||
// Setup IPC
|
||||
LogLine("Initializing IPC...");
|
||||
_handleMsgRecv = new Action<object, MessageEventArgs>(HandleMsgReceived);
|
||||
_handleMsgRecv = new Action<object, XDMessageEventArgs>(HandleMsgReceived);
|
||||
_wsIpc = new WifiSitterIpc(_handleMsgRecv);
|
||||
|
||||
// Check if there are any interfaces not detected by GetAllNetworkInterfaces()
|
||||
|
@ -356,7 +360,7 @@ namespace WifiSitter
|
|||
}
|
||||
|
||||
|
||||
private void HandleMsgReceived(object sender, MessageEventArgs e) {
|
||||
private void HandleMsgReceived(object sender, XDMessageEventArgs e) {
|
||||
LogLine("Message received");
|
||||
if (!e.DataGram.IsValid) {
|
||||
Trace.WriteLine("Invalid datagram received.");
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WifiSitter</RootNamespace>
|
||||
<AssemblyName>WifiSitter</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
|
@ -38,6 +38,7 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -47,6 +48,7 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -56,6 +58,7 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
|
@ -65,6 +68,7 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
|
@ -79,12 +83,8 @@
|
|||
<ApplicationIcon>wifisitter-icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SimpleIPC, Version=1.0.6011.16024, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SimpleIPC.1.0.6011.16024\lib\net40\SimpleIPC.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
@ -148,7 +148,7 @@
|
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_BuildVersioningStyle="None.None.None.Increment" BuildVersion_UpdateFileVersion="False" />
|
||||
<UserProperties BuildVersion_UpdateFileVersion="False" BuildVersion_BuildVersioningStyle="None.None.None.Increment" BuildVersion_StartDate="2000/1/1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
@ -5,29 +5,35 @@ using System.Text;
|
|||
|
||||
using System.Diagnostics;
|
||||
|
||||
using XDMessaging;
|
||||
|
||||
namespace WifiSitter
|
||||
{
|
||||
public class WifiSitterIpc
|
||||
{
|
||||
private static string _myChannel = String.Format("{0}-{1}", Process.GetCurrentProcess().Id, Process.GetCurrentProcess().ProcessName);
|
||||
public MessageListener MsgListener { get; private set; }
|
||||
|
||||
private XDMessagingClient _msgClient = new XDMessagingClient();
|
||||
|
||||
public IXDListener MsgListener { get; private set; }
|
||||
|
||||
public MessageBroadcaster MsgBroadcaster { get; private set; }
|
||||
public IXDBroadcaster MsgBroadcaster { get; private set; }
|
||||
|
||||
public string MyChannelName { get { return _myChannel; } }
|
||||
|
||||
public WifiSitterIpc (Action<object, MessageEventArgs> MessageReceivedHandler) {
|
||||
MsgListener = new MessageListener();
|
||||
public WifiSitterIpc(Action<object, XDMessageEventArgs> MessageReceivedHandler) {
|
||||
|
||||
try {
|
||||
WifiSitter.LogLine("Registering listener channel: {0}", _myChannel);
|
||||
MsgListener = _msgClient.Listeners.GetListenerForMode(XDTransportMode.Compatibility);
|
||||
MsgListener.RegisterChannel(_myChannel);
|
||||
}
|
||||
catch {
|
||||
WifiSitter.LogLine("Failed to register IPC listener channel {0}", _myChannel);
|
||||
}
|
||||
MsgListener.MessageReceived += (o,e) => { MessageReceivedHandler(o, e); };
|
||||
MsgListener.MessageReceived += (o, e) => { MessageReceivedHandler(o, e); };
|
||||
|
||||
MsgBroadcaster = new MessageBroadcaster();
|
||||
MsgBroadcaster = _msgClient.Broadcasters.GetBroadcasterForMode(XDTransportMode.Compatibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
|
||||
namespace WifiSitter
|
||||
{
|
||||
[Serializable]
|
||||
public class WifiSitterIpcMessage
|
||||
{
|
||||
public string Request { get; set; }
|
||||
|
@ -19,4 +20,13 @@ namespace WifiSitter
|
|||
Payload = SendingWhat;
|
||||
}
|
||||
}
|
||||
|
||||
public static class WifiSitterExtensions
|
||||
{
|
||||
public static string IpcMessageJsonString(this WifiSitterIpcMessage message) {
|
||||
string result;
|
||||
result = Newtonsoft.Json.JsonConvert.SerializeObject(message);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net40" />
|
||||
<package id="SimpleIPC" version="1.0.6011.16024" targetFramework="net40" />
|
||||
<package id="XDMessaging.Lite" version="5.0.1" targetFramework="net40" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
<package id="XDMessaging.Lite" version="5.0.1" targetFramework="net452" />
|
||||
</packages>
|
|
@ -8,7 +8,7 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WifiSitter.Properties {
|
||||
namespace WifiSitterGui.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WifiSitter.Properties {
|
||||
namespace WifiSitterGui.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
|
|
|
@ -11,12 +11,13 @@ using System.Windows.Input;
|
|||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using SimpleIPC;
|
||||
using System.Diagnostics;
|
||||
|
||||
using WifiSitterGui.ViewModel;
|
||||
using WifiSitter;
|
||||
|
||||
using XDMessaging;
|
||||
|
||||
namespace WifiSitterGui
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -30,7 +31,7 @@ namespace WifiSitterGui
|
|||
private static MainWindow _statusGui;
|
||||
private static WifiSitter.WifiSitterIpc _wsIpc;
|
||||
private static string _serviceChannel;
|
||||
private Action<object, MessageEventArgs> _handleMsgRcv;
|
||||
private Action<object, XDMessageEventArgs> _handleMsgRcv;
|
||||
|
||||
#endregion // fields
|
||||
|
||||
|
@ -44,14 +45,18 @@ namespace WifiSitterGui
|
|||
//ShowStatusSettingsWindow();
|
||||
|
||||
// Setup IPC message listener
|
||||
_handleMsgRcv = new Action<object, MessageEventArgs>(wsIpc_MessageReceived);
|
||||
_handleMsgRcv = new Action<object, XDMessageEventArgs>(wsIpc_MessageReceived);
|
||||
_wsIpc = new WifiSitter.WifiSitterIpc( _handleMsgRcv );
|
||||
|
||||
Trace.WriteLine(String.Format("WifiSitter service msg channel: {0}", ServiceChannelName));
|
||||
|
||||
if (! String.IsNullOrEmpty(ServiceChannelName)) {
|
||||
|
||||
_wsIpc.MsgBroadcaster.SendToChannel(ServiceChannelName, new WifiSitterIpcMessage("get_netstate", _wsIpc.MyChannelName, _wsIpc.MyChannelName));
|
||||
try {
|
||||
_wsIpc.MsgBroadcaster.SendToChannel(ServiceChannelName, new WifiSitterIpcMessage("get_netstate", _wsIpc.MyChannelName, _wsIpc.MyChannelName).IpcMessageJsonString());
|
||||
}
|
||||
catch (Exception e) {
|
||||
Trace.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -116,7 +121,7 @@ namespace WifiSitterGui
|
|||
}
|
||||
|
||||
|
||||
internal void wsIpc_MessageReceived(object sender, MessageEventArgs e) {
|
||||
internal void wsIpc_MessageReceived(object sender, XDMessageEventArgs e) {
|
||||
if (!e.DataGram.IsValid) {
|
||||
Trace.WriteLine("Invalid datagram received.");
|
||||
return;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WifiSitterGui</RootNamespace>
|
||||
<AssemblyName>WifiSitterGui</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@ -24,6 +24,7 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -33,21 +34,18 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>wifisitter-icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net40\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SimpleIPC, Version=1.0.6011.16024, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SimpleIPC.1.0.6011.16024\lib\net40\SimpleIPC.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup></configuration>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net40" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net40" />
|
||||
<package id="SimpleIPC" version="1.0.6011.16024" targetFramework="net40" />
|
||||
<package id="XDMessaging.Lite" version="5.0.1" targetFramework="net40" />
|
||||
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
<package id="XDMessaging.Lite" version="5.0.1" targetFramework="net452" />
|
||||
</packages>
|
Loading…
Reference in New Issue