Bladeren bron

Some initial playing around

Antony Male 10 jaren geleden
bovenliggende
commit
ba54fe5d05

BIN
lib/x64/Interop.NETWORKLIST.dll


BIN
lib/x86/Interop.NETWORKLIST.dll


+ 2 - 0
src/SyncTrayzor/Bootstrapper.cs

@@ -83,6 +83,8 @@ namespace SyncTrayzor
 
         protected override void Configure()
         {
+            new MeteredNetworkManager();
+
             // Have to set the log path before anything else
             var pathConfiguration = Settings.Default.PathConfiguration;
             GlobalDiagnosticsContext.Set("LogFilePath", EnvVarTransformer.Transform(pathConfiguration.LogFilePath));

+ 26 - 0
src/SyncTrayzor/Services/MeteredNetworkManager.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using NETWORKLIST;
+
+namespace SyncTrayzor.Services
+{
+    public class MeteredNetworkManager
+    {
+        public MeteredNetworkManager()
+        {
+            var networkListManager = new NetworkListManagerClass();
+            uint cost;
+            var sockAddr = new NLM_SOCKADDR() { data = new byte[]{ 0 } };
+            networkListManager.GetCost(out cost, ref sockAddr);
+            //networkListManager.getco
+            //var networkConnection = networkListManager.GetNetworkConnection(Guid.NewGuid());
+            //networkConnection.
+            //var networkConnectionCost = new INetworkConnectionCost();
+            //uint cost;
+            //networkConnectionCost.GetCost(out cost);
+        }
+    }
+}

+ 6 - 0
src/SyncTrayzor/SyncTrayzor.csproj

@@ -93,6 +93,11 @@
       <HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.5\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
       <Private>True</Private>
     </Reference>
+    <Reference Include="Interop.NETWORKLIST">
+      <SpecificVersion>False</SpecificVersion>
+      <EmbedInteropTypes>False</EmbedInteropTypes>
+      <HintPath>..\..\lib\$(Platform)\Interop.NETWORKLIST.dll</HintPath>
+    </Reference>
     <Reference Include="Itenso.Windows.Controls.ListViewLayout">
       <HintPath>..\..\lib\Itenso.Windows.Controls.ListViewLayout.dll</HintPath>
     </Reference>
@@ -197,6 +202,7 @@
     <Compile Include="Services\FileWatcher.cs" />
     <Compile Include="Services\IpcCommsClient.cs" />
     <Compile Include="Services\IpcCommsServer.cs" />
+    <Compile Include="Services\MeteredNetworkManager.cs" />
     <Compile Include="Services\ProcessStartProvider.cs" />
     <Compile Include="Services\SingleApplicationInstanceManager.cs" />
     <Compile Include="Services\UpdateManagement\InstalledUpdateVariantHandler.cs" />