ntminer 4 年之前
父节点
当前提交
3bd46be41c
共有 100 个文件被更改,包括 3200 次插入1327 次删除
  1. 0 3
      NTMiner.sln
  2. 21 3
      src/AppModels/AppModels.csproj
  3. 0 16
      src/AppModels/Messages.cs
  4. 1 1
      src/AppModels/Vms/StateBarViewModel.cs
  5. 5 2
      src/AppModels/packages.config
  6. 0 5
      src/AppViews0/AppViewFactory.cs
  7. 16 12
      src/AppViews0/AppViews0.csproj
  8. 19 7
      src/AppViews0/MinerStudio/Views/Ucs/WsServerNodePage.xaml
  9. 12 12
      src/AppViews0/Properties/Resources.Designer.cs
  10. 5 5
      src/AppViews0/Properties/Settings.Designer.cs
  11. 0 2
      src/AppViews0/Views/Design/SignUpPageViewModel.xaml
  12. 5 0
      src/AppViews0/Views/Ucs/MinerProfileOption.xaml.cs
  13. 5 2
      src/AppViews0/packages.config
  14. 3 1
      src/BlankWindow/BlankWindow.csproj
  15. 1 1
      src/BlankWindow/packages.config
  16. 1 3
      src/CalcConfigUpdater/App.config
  17. 14 1
      src/CalcConfigUpdater/CalcConfigUpdater.csproj
  18. 1 1
      src/CalcConfigUpdater/FodyWeavers.xml
  19. 3 0
      src/CalcConfigUpdater/packages.config
  20. 11 1
      src/DevConsole/DevConsole.csproj
  21. 1 1
      src/DevConsole/FodyWeavers.xml
  22. 3 0
      src/DevConsole/app.config
  23. 24 0
      src/MinerClient/App.xaml.cs
  24. 8 0
      src/MinerClient/Daemon/NTMinerRpcClient.dll.config
  25. 50 0
      src/MinerClient/Daemon/System.Net.Http.Extensions.xml
  26. 8 0
      src/MinerClient/Daemon/System.Net.Http.Primitives.xml
  27. 1 1
      src/MinerClient/FodyWeavers.xml
  28. 23 13
      src/MinerClient/MinerClient.csproj
  29. 1634 230
      src/MinerClient/NoDevFee/Newtonsoft.Json.xml
  30. 50 0
      src/MinerClient/NoDevFee/System.Net.Http.Extensions.xml
  31. 594 109
      src/MinerClient/NoDevFee/System.Net.Http.Formatting.xml
  32. 8 0
      src/MinerClient/NoDevFee/System.Net.Http.Primitives.xml
  33. 2 1
      src/MinerClient/app.config
  34. 9 7
      src/MinerClient/packages.config
  35. 1 3
      src/MinerClientFinder/App.config
  36. 17 0
      src/MinerClientFinder/App.xaml.cs
  37. 1 1
      src/MinerClientFinder/FodyWeavers.xml
  38. 20 2
      src/MinerClientFinder/MinerClientFinder.csproj
  39. 3 0
      src/MinerClientFinder/packages.config
  40. 26 12
      src/MinerClientSelfHost/MinerClientSelfHost.csproj
  41. 7 5
      src/MinerClientSelfHost/packages.config
  42. 5 0
      src/MinerStudio/App.xaml.cs
  43. 1 1
      src/MinerStudio/FodyWeavers.xml
  44. 22 12
      src/MinerStudio/MinerStudio.csproj
  45. 2 1
      src/MinerStudio/app.config
  46. 28 28
      src/MinerStudio/app.manifest
  47. 9 7
      src/MinerStudio/packages.config
  48. 26 12
      src/MinerStudioSelfHost/MinerStudioSelfHost.csproj
  49. 7 5
      src/MinerStudioSelfHost/packages.config
  50. 4 1
      src/NTMiner.Controllers/NTMiner.Controllers.csproj
  51. 2 1
      src/NTMinerClient/Core/Impl/ClientDataSet.cs
  52. 6 21
      src/NTMinerClient/Core/Impl/CoinGroupSet.cs
  53. 9 24
      src/NTMinerClient/Core/Impl/CoinSet.cs
  54. 6 21
      src/NTMinerClient/Core/Impl/FileWriterSet.cs
  55. 6 21
      src/NTMinerClient/Core/Impl/FragmentWriterSet.cs
  56. 6 21
      src/NTMinerClient/Core/Impl/GroupSet.cs
  57. 29 46
      src/NTMinerClient/Core/Impl/LocalMessageSet.cs
  58. 17 21
      src/NTMinerClient/Core/Impl/OverClockDataSet.cs
  59. 7 22
      src/NTMinerClient/Core/Impl/PoolSet.cs
  60. 12 27
      src/NTMinerClient/Core/Impl/SysDicItemSet.cs
  61. 9 24
      src/NTMinerClient/Core/Impl/SysDicSet.cs
  62. 6 21
      src/NTMinerClient/Core/Kernels/Impl/CoinKernelSet.cs
  63. 6 21
      src/NTMinerClient/Core/Kernels/Impl/KernelInputSet.cs
  64. 6 21
      src/NTMinerClient/Core/Kernels/Impl/KernelOutputSet.cs
  65. 15 30
      src/NTMinerClient/Core/Kernels/Impl/KernelOutputTranslaterSet.cs
  66. 6 21
      src/NTMinerClient/Core/Kernels/Impl/KernelSet.cs
  67. 6 21
      src/NTMinerClient/Core/Kernels/Impl/PackageSet.cs
  68. 18 33
      src/NTMinerClient/Core/Kernels/Impl/PoolKernelSet.cs
  69. 11 26
      src/NTMinerClient/Core/MinerStudio/Impl/ColumnsShowSet.cs
  70. 15 31
      src/NTMinerClient/Core/MinerStudio/Impl/MineWorkSet.cs
  71. 15 31
      src/NTMinerClient/Core/MinerStudio/Impl/MinerGroupSet.cs
  72. 2 15
      src/NTMinerClient/Core/MinerStudio/Impl/NTMinerWalletSet.cs
  73. 19 34
      src/NTMinerClient/Core/Profiles/Impl/GpuProfileSet.cs
  74. 8 23
      src/NTMinerClient/Core/Profiles/Impl/WalletSet.cs
  75. 9 18
      src/NTMinerClient/Gpus/Impl/GpusSpeed.cs
  76. 1 1
      src/NTMinerClient/Messages.cs
  77. 31 15
      src/NTMinerClient/NTMinerClient.csproj
  78. 30 21
      src/NTMinerClient/NTMinerContext.partials.CreateMineContext.cs
  79. 8 3
      src/NTMinerClient/NTMinerContext.partials.static.cs
  80. 8 6
      src/NTMinerClient/packages.config
  81. 8 23
      src/NTMinerDaemon/Core/Impl/OperationResultSet.cs
  82. 1 1
      src/NTMinerDaemon/FodyWeavers.xml
  83. 25 13
      src/NTMinerDaemon/NTMinerDaemon.csproj
  84. 2 1
      src/NTMinerDaemon/app.config
  85. 8 6
      src/NTMinerDaemon/packages.config
  86. 11 27
      src/NTMinerDataSchemas/Core/MinerServer/ClientData.cs
  87. 1 0
      src/NTMinerDataSchemas/Core/MinerServer/IMinerData.cs
  88. 0 21
      src/NTMinerDataSchemas/Gpus/GpuNameCountExtensions.cs
  89. 6 3
      src/NTMinerDataSchemas/NTMinerDataSchemas.csproj
  90. 22 0
      src/NTMinerDataSchemas/SetBase.cs
  91. 1 1
      src/NTMinerDataSchemas/packages.config
  92. 4 1
      src/NTMinerGpus/NTMinerGpus.csproj
  93. 4 1
      src/NTMinerHub/NTMinerHub.csproj
  94. 5 2
      src/NTMinerLogging/NTMinerLogging.csproj
  95. 1 1
      src/NTMinerLogging/packages.config
  96. 1 1
      src/NTMinerNoDevFee/FodyWeavers.xml
  97. 22 10
      src/NTMinerNoDevFee/NTMinerNoDevFee.csproj
  98. 2 1
      src/NTMinerNoDevFee/app.config
  99. 6 4
      src/NTMinerNoDevFee/packages.config
  100. 24 39
      src/NTMinerRpcClient/Impl/KernelOutputKeywordSet.cs

+ 0 - 3
NTMiner.sln

@@ -10,9 +10,6 @@ EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{E66C9F7C-617A-4E97-978A-A06E3A95BEE8}"
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{E66C9F7C-617A-4E97-978A-A06E3A95BEE8}"
 EndProject
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{43C57D59-9DC7-45AE-9D09-5D3D413E41EC}"
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{43C57D59-9DC7-45AE-9D09-5D3D413E41EC}"
-	ProjectSection(SolutionItems) = preProject
-		docs\Server\README.md = docs\Server\README.md
-	EndProjectSection
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevConsole", "src\DevConsole\DevConsole.csproj", "{56216641-FA69-46BD-AD32-C31F9FA735C8}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevConsole", "src\DevConsole\DevConsole.csproj", "{56216641-FA69-46BD-AD32-C31F9FA735C8}"
 EndProject
 EndProject

+ 21 - 3
src/AppModels/AppModels.csproj

@@ -9,9 +9,12 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>AppModels</AssemblyName>
     <AssemblyName>AppModels</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
+    <TargetFrameworkProfile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -21,6 +24,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -29,6 +33,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="Interop.NetFwTypeLib">
     <Reference Include="Interop.NetFwTypeLib">
@@ -48,6 +53,13 @@
     <Reference Include="System.Net.Http">
     <Reference Include="System.Net.Http">
       <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
       <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
     </Reference>
     </Reference>
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xaml" />
     <Reference Include="System.Xaml" />
     <Reference Include="WindowsBase" />
     <Reference Include="WindowsBase" />
@@ -153,7 +165,6 @@
     <Compile Include="Vms\KernelOutputSelectViewModel.cs" />
     <Compile Include="Vms\KernelOutputSelectViewModel.cs" />
     <Compile Include="Vms\KernelInputSelectViewModel.cs" />
     <Compile Include="Vms\KernelInputSelectViewModel.cs" />
     <Compile Include="Vms\MinerProfileViewModel.cs" />
     <Compile Include="Vms\MinerProfileViewModel.cs" />
-    <Compile Include="Vms\SignUpPageViewModel.cs" />
     <Compile Include="Vms\SpeedTableViewModel.cs" />
     <Compile Include="Vms\SpeedTableViewModel.cs" />
     <Compile Include="Vms\StartStopMineButtonViewModel.cs" />
     <Compile Include="Vms\StartStopMineButtonViewModel.cs" />
     <Compile Include="Vms\SysDicItemSelectViewModel.cs" />
     <Compile Include="Vms\SysDicItemSelectViewModel.cs" />
@@ -267,10 +278,17 @@
     </ProjectReference>
     </ProjectReference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <None Include="app.config" />
     <Compile Include="MinerStudio\MinerStudioRoot.partials.MinerClientMessagesViewModel.cs" />
     <Compile Include="MinerStudio\MinerStudioRoot.partials.MinerClientMessagesViewModel.cs" />
     <Compile Include="MinerStudio\MinerStudioRoot.partials.MinerClientOperationResultsViewModel.cs" />
     <Compile Include="MinerStudio\MinerStudioRoot.partials.MinerClientOperationResultsViewModel.cs" />
+    <None Include="app.config" />
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
+  </Target>
 </Project>
 </Project>

+ 0 - 16
src/AppModels/Messages.cs

@@ -6,17 +6,6 @@ using System;
 using System.Windows;
 using System.Windows;
 
 
 namespace NTMiner {
 namespace NTMiner {
-    [MessageType(description: "升级")]
-    public class UpgradeCommand : Cmd {
-        public UpgradeCommand(string fileName, Action callback) {
-            this.FileName = fileName;
-            this.Callback = callback;
-        }
-
-        public string FileName { get; private set; }
-        public Action Callback { get; private set; }
-    }
-
     [MessageType(description: "启用windows远程桌面")]
     [MessageType(description: "启用windows远程桌面")]
     public class EnableRemoteDesktopCommand : Cmd {
     public class EnableRemoteDesktopCommand : Cmd {
         public EnableRemoteDesktopCommand() {
         public EnableRemoteDesktopCommand() {
@@ -350,11 +339,6 @@ namespace NTMiner {
         }
         }
     }
     }
 
 
-    [MessageType(description: "打开用户注册页")]
-    public class ShowSignUpPageCommand : Cmd {
-        public ShowSignUpPageCommand() { }
-    }
-
     [MessageType(description: "打开钱包地址编辑界面")]
     [MessageType(description: "打开钱包地址编辑界面")]
     public class EditWalletCommand : EditCommand<WalletViewModel> {
     public class EditWalletCommand : EditCommand<WalletViewModel> {
         public EditWalletCommand(FormType formType, WalletViewModel source) : base(formType, source) {
         public EditWalletCommand(FormType formType, WalletViewModel source) : base(formType, source) {

+ 1 - 1
src/AppModels/Vms/StateBarViewModel.cs

@@ -79,7 +79,7 @@ namespace NTMiner.Vms {
                 if (IsRemoteDesktopEnabled) {
                 if (IsRemoteDesktopEnabled) {
                     return "Windows远程桌面已启用";
                     return "Windows远程桌面已启用";
                 }
                 }
-                return "Windows远程桌面已禁用";
+                return "未启用Windows远程桌面";
             }
             }
         }
         }
 
 

+ 5 - 2
src/AppModels/packages.config

@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
-  <package id="LiveCharts" version="0.9.7" targetFramework="net40" />
-  <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net40" />
+  <package id="LiveCharts" version="0.9.7" targetFramework="net40" requireReinstallation="true" />
+  <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net40" requireReinstallation="true" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
 </packages>
 </packages>

+ 0 - 5
src/AppViews0/AppViewFactory.cs

@@ -224,11 +224,6 @@ namespace NTMiner {
                     KernelOutputKeywords.ShowWindow();
                     KernelOutputKeywords.ShowWindow();
                 });
                 });
             }, location: location);
             }, location: location);
-            VirtualRoot.BuildCmdPath<ShowSignUpPageCommand>(path: message => {
-                UIThread.Execute(() => {
-                    SignUpPage.ShowWindow();
-                });
-            }, location: location);
             VirtualRoot.BuildCmdPath<EditWalletCommand>(path: message => {
             VirtualRoot.BuildCmdPath<EditWalletCommand>(path: message => {
                 UIThread.Execute(() => {
                 UIThread.Execute(() => {
                     WalletEdit.ShowWindow(message.FormType, message.Source);
                     WalletEdit.ShowWindow(message.FormType, message.Source);

+ 16 - 12
src/AppViews0/AppViews0.csproj

@@ -10,7 +10,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>AppViews0</AssemblyName>
     <AssemblyName>AppViews0</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
     </TargetFrameworkProfile>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
@@ -83,6 +83,14 @@
       <HintPath>..\..\packages\LiveCharts.Wpf.0.9.7\lib\net40\LiveCharts.Wpf.dll</HintPath>
       <HintPath>..\..\packages\LiveCharts.Wpf.0.9.7\lib\net40\LiveCharts.Wpf.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xaml">
     <Reference Include="System.Xaml">
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
@@ -145,9 +153,6 @@
     <Compile Include="Views\Ucs\WindowsAutoLogon.xaml.cs">
     <Compile Include="Views\Ucs\WindowsAutoLogon.xaml.cs">
       <DependentUpon>WindowsAutoLogon.xaml</DependentUpon>
       <DependentUpon>WindowsAutoLogon.xaml</DependentUpon>
     </Compile>
     </Compile>
-    <Compile Include="Views\Ucs\SignUpPage.xaml.cs">
-      <DependentUpon>SignUpPage.xaml</DependentUpon>
-    </Compile>
     <Compile Include="MinerStudio\Views\Ucs\MinerClients.xaml.cs">
     <Compile Include="MinerStudio\Views\Ucs\MinerClients.xaml.cs">
       <DependentUpon>MinerClients.xaml</DependentUpon>
       <DependentUpon>MinerClients.xaml</DependentUpon>
     </Compile>
     </Compile>
@@ -536,10 +541,6 @@
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
     </Page>
     </Page>
-    <Page Include="Views\Design\SignUpPageViewModel.xaml">
-      <Generator>MSBuild:Compile</Generator>
-      <SubType>Designer</SubType>
-    </Page>
     <Page Include="Views\Design\RestartWindowsViewModel.xaml">
     <Page Include="Views\Design\RestartWindowsViewModel.xaml">
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
@@ -732,10 +733,6 @@
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
     </Page>
     </Page>
-    <Page Include="Views\Ucs\SignUpPage.xaml">
-      <Generator>MSBuild:Compile</Generator>
-      <SubType>Designer</SubType>
-    </Page>
     <Page Include="MinerStudio\Views\Ucs\MinerClients.xaml">
     <Page Include="MinerStudio\Views\Ucs\MinerClients.xaml">
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
@@ -1209,6 +1206,13 @@
     <PostBuildEvent>
     <PostBuildEvent>
     </PostBuildEvent>
     </PostBuildEvent>
   </PropertyGroup>
   </PropertyGroup>
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
+  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
   <Target Name="BeforeBuild">

+ 19 - 7
src/AppViews0/MinerStudio/Views/Ucs/WsServerNodePage.xaml

@@ -34,9 +34,9 @@
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.Address}"></TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.Address}"></TextBlock>
                 <TextBlock Style="{StaticResource LblTb}">进程内存</TextBlock>
                 <TextBlock Style="{StaticResource LblTb}">进程内存</TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.ProcessMemoryMbText}"></TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.ProcessMemoryMbText}"></TextBlock>
-                <TextBlock Style="{StaticResource LblTb}">线程数</TextBlock>
+                <TextBlock Style="{StaticResource LblTb}">进程线程数</TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.ThreadCount}"></TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.ThreadCount}"></TextBlock>
-                <TextBlock Style="{StaticResource LblTb}">句柄数</TextBlock>
+                <TextBlock Style="{StaticResource LblTb}">进程句柄数</TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.HandleCount}"></TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.HandleCount}"></TextBlock>
                 <TextBlock Style="{StaticResource LblTb}">总内存</TextBlock>
                 <TextBlock Style="{StaticResource LblTb}">总内存</TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.TotalPhysicalMemory,Converter={StaticResource ByteToGbConverter}}"></TextBlock>
                 <TextBlock Style="{StaticResource TextBlock}" Text="{Binding WebApiServerStateVm.TotalPhysicalMemory,Converter={StaticResource ByteToGbConverter}}"></TextBlock>
@@ -105,15 +105,27 @@
                 </DataGridTextColumn>
                 </DataGridTextColumn>
                 <DataGridTextColumn IsReadOnly="True" Width="70" Header="进程内存" Binding="{Binding ProcessMemoryMbText}">
                 <DataGridTextColumn IsReadOnly="True" Width="70" Header="进程内存" Binding="{Binding ProcessMemoryMbText}">
                 </DataGridTextColumn>
                 </DataGridTextColumn>
-                <DataGridTextColumn IsReadOnly="True" Width="50" Header="线程数" Binding="{Binding ThreadCount}">
+                <DataGridTextColumn IsReadOnly="True" Width="50" Binding="{Binding ThreadCount}">
+                    <DataGridTextColumn.Header>
+                        <TextBlock TextWrapping="Wrap">进程线程数</TextBlock>
+                    </DataGridTextColumn.Header>
                 </DataGridTextColumn>
                 </DataGridTextColumn>
-                <DataGridTextColumn IsReadOnly="True" Width="50" Header="句柄数" Binding="{Binding HandleCount}">
+                <DataGridTextColumn IsReadOnly="True" Width="50" Binding="{Binding HandleCount}">
+                    <DataGridTextColumn.Header>
+                        <TextBlock TextWrapping="Wrap">进程句柄数</TextBlock>
+                    </DataGridTextColumn.Header>
                 </DataGridTextColumn>
                 </DataGridTextColumn>
-                <DataGridTextColumn IsReadOnly="True" Width="60" Header="总内存" Binding="{Binding TotalPhysicalMemory,Converter={StaticResource ByteToGbConverter}}">
+                <DataGridTextColumn IsReadOnly="True" Width="60" Header="机器内存" Binding="{Binding TotalPhysicalMemory,Converter={StaticResource ByteToGbConverter}}">
                 </DataGridTextColumn>
                 </DataGridTextColumn>
-                <DataGridTextColumn IsReadOnly="True" Width="60" Header="剩余内存" Binding="{Binding AvailablePhysicalMemory,Converter={StaticResource ByteToGbConverter}}">
+                <DataGridTextColumn IsReadOnly="True" Width="60" Binding="{Binding AvailablePhysicalMemory,Converter={StaticResource ByteToGbConverter}}">
+                    <DataGridTextColumn.Header>
+                        <TextBlock TextWrapping="Wrap">剩余机器内存</TextBlock>
+                    </DataGridTextColumn.Header>
                 </DataGridTextColumn>
                 </DataGridTextColumn>
-                <DataGridTextColumn IsReadOnly="True" Width="70" Header="CPU使用率" Binding="{Binding CpuPerformanceText}">
+                <DataGridTextColumn IsReadOnly="True" Width="70" Binding="{Binding CpuPerformanceText}">
+                    <DataGridTextColumn.Header>
+                        <TextBlock TextWrapping="Wrap">机器CPU使用率</TextBlock>
+                    </DataGridTextColumn.Header>
                 </DataGridTextColumn>
                 </DataGridTextColumn>
                 <DataGridTextColumn IsReadOnly="True" Width="306" Header="CPU名称" Binding="{Binding CpuVm.Name}">
                 <DataGridTextColumn IsReadOnly="True" Width="306" Header="CPU名称" Binding="{Binding CpuVm.Name}">
                 </DataGridTextColumn>
                 </DataGridTextColumn>

+ 12 - 12
src/AppViews0/Properties/Resources.Designer.cs

@@ -1,10 +1,10 @@
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 // <auto-generated>
 // <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
 //
 //
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
 // </auto-generated>
 // </auto-generated>
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 
 
@@ -13,12 +13,12 @@ namespace NTMiner.Properties {
     
     
     
     
     /// <summary>
     /// <summary>
-    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
     /// </summary>
     /// </summary>
-    // This class was auto-generated by the StronglyTypedResourceBuilder
-    // class via a tool like ResGen or Visual Studio.
-    // To add or remove a member, edit your .ResX file then rerun ResGen
-    // with the /str option, or rebuild your VS project.
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
@@ -33,7 +33,7 @@ namespace NTMiner.Properties {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Returns the cached ResourceManager instance used by this class.
+        ///   返回此类使用的缓存的 ResourceManager 实例。
         /// </summary>
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
         internal static global::System.Resources.ResourceManager ResourceManager {
         internal static global::System.Resources.ResourceManager ResourceManager {
@@ -47,8 +47,8 @@ namespace NTMiner.Properties {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Overrides the current thread's CurrentUICulture property for all
-        ///   resource lookups using this strongly typed resource class.
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写。
         /// </summary>
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
         internal static global::System.Globalization.CultureInfo Culture {
         internal static global::System.Globalization.CultureInfo Culture {

+ 5 - 5
src/AppViews0/Properties/Settings.Designer.cs

@@ -1,10 +1,10 @@
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 // <auto-generated>
 // <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
 //
 //
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
 // </auto-generated>
 // </auto-generated>
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 
 
@@ -12,7 +12,7 @@ namespace NTMiner.Properties {
     
     
     
     
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
         
         
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

+ 0 - 2
src/AppViews0/Views/Design/SignUpPageViewModel.xaml

@@ -1,2 +0,0 @@
-<vm:SignUpPageViewModel xmlns:vm="clr-namespace:NTMiner.Vms;assembly=AppModels">
-</vm:SignUpPageViewModel>

+ 5 - 0
src/AppViews0/Views/Ucs/MinerProfileOption.xaml.cs

@@ -15,6 +15,11 @@ namespace NTMiner.Views.Ucs {
             InitializeComponent();
             InitializeComponent();
             _outerUserGroupBg = OuterUserGroup.BorderBrush;
             _outerUserGroupBg = OuterUserGroup.BorderBrush;
             _automationGroupBg = AutomationGroup.BorderBrush;
             _automationGroupBg = AutomationGroup.BorderBrush;
+            this.OnLoaded(window => {
+                VirtualRoot.BuildEventPath<SignUpedEvent>("注册了新外网群控用户后自动填入外网群控用户名", LogEnum.None, path: message => {
+                    this.Vm.OuterUserId = message.LoginName;
+                }, this.GetType());
+            });
         }
         }
 
 
         private void ButtonHotKey_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) {
         private void ButtonHotKey_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) {

+ 5 - 2
src/AppViews0/packages.config

@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
-  <package id="LiveCharts" version="0.9.7" targetFramework="net40" />
-  <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net40" />
+  <package id="LiveCharts" version="0.9.7" targetFramework="net40" requireReinstallation="true" />
+  <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net40" requireReinstallation="true" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
 </packages>
 </packages>

+ 3 - 1
src/BlankWindow/BlankWindow.csproj

@@ -9,7 +9,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner.BlankWindow</RootNamespace>
     <RootNamespace>NTMiner.BlankWindow</RootNamespace>
     <AssemblyName>BlankWindow</AssemblyName>
     <AssemblyName>BlankWindow</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
@@ -23,6 +23,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -31,6 +32,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup>
   <PropertyGroup>
     <SignAssembly>false</SignAssembly>
     <SignAssembly>false</SignAssembly>

+ 1 - 1
src/BlankWindow/packages.config

@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
-  <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
+  <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" requireReinstallation="true" />
 </packages>
 </packages>

+ 1 - 3
src/CalcConfigUpdater/App.config

@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <configuration>
-    <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
-    </startup>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup>
   <runtime>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
       <dependentAssembly>

+ 14 - 1
src/CalcConfigUpdater/CalcConfigUpdater.csproj

@@ -44,6 +44,13 @@
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Compile Include="IncomeItem.cs" />
     <Compile Include="IncomeItem.cs" />
@@ -51,10 +58,14 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <None Include="App.config" />
+    <None Include="app.config" />
+    <None Include="FodyWeavers.xsd">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
+    <Content Include="FodyWeavers.xml" />
     <Content Include="pattern.txt">
     <Content Include="pattern.txt">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
@@ -92,6 +103,8 @@
     </PropertyGroup>
     </PropertyGroup>
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
   </Target>
   </Target>
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
 </Project>
 </Project>

+ 1 - 1
src/CalcConfigUpdater/FodyWeavers.xml

@@ -1,3 +1,3 @@
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <Costura />
+  <Costura IncludeDebugSymbols="false" DisableCompression="false" />
 </Weavers>
 </Weavers>

+ 3 - 0
src/CalcConfigUpdater/packages.config

@@ -2,4 +2,7 @@
 <packages>
 <packages>
   <package id="Costura.Fody" version="4.1.0" targetFramework="net452" />
   <package id="Costura.Fody" version="4.1.0" targetFramework="net452" />
   <package id="Fody" version="6.3.0" targetFramework="net452" developmentDependency="true" />
   <package id="Fody" version="6.3.0" targetFramework="net452" developmentDependency="true" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net452" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net452" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net452" />
 </packages>
 </packages>

+ 11 - 1
src/DevConsole/DevConsole.csproj

@@ -9,11 +9,12 @@
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>DevConsole</AssemblyName>
     <AssemblyName>DevConsole</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
     <NuGetPackageImportStamp>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -25,6 +26,7 @@
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -35,6 +37,7 @@
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup>
   <PropertyGroup>
     <StartupObject>NTMiner.Program</StartupObject>
     <StartupObject>NTMiner.Program</StartupObject>
@@ -69,6 +72,10 @@
     <EmbeddedResource Include="..\NTMinerNoDevFee\NoDevFee\WinDivert64.sys">
     <EmbeddedResource Include="..\NTMinerNoDevFee\NoDevFee\WinDivert64.sys">
       <Link>NoDevFee\WinDivert64.sys</Link>
       <Link>NoDevFee\WinDivert64.sys</Link>
     </EmbeddedResource>
     </EmbeddedResource>
+    <None Include="app.config" />
+    <None Include="FodyWeavers.xsd">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -76,6 +83,9 @@
       <Link>NoDevFee\WinDivert.dll</Link>
       <Link>NoDevFee\WinDivert.dll</Link>
     </EmbeddedResource>
     </EmbeddedResource>
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="FodyWeavers.xml" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
     <PropertyGroup>

+ 1 - 1
src/DevConsole/FodyWeavers.xml

@@ -1,3 +1,3 @@
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <Costura />
+  <Costura IncludeDebugSymbols="false" DisableCompression="false" />
 </Weavers>
 </Weavers>

+ 3 - 0
src/DevConsole/app.config

@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

+ 24 - 0
src/MinerClient/App.xaml.cs

@@ -15,6 +15,25 @@ using System.Threading.Tasks;
 using System.Windows;
 using System.Windows;
 
 
 namespace NTMiner {
 namespace NTMiner {
+    public class Program {
+        [System.STAThreadAttribute()]
+        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+        public static void Main() {
+            SplashScreen splashScreen = new SplashScreen("splashwindow.png");
+            splashScreen.Show(true);
+            if (AppUtil.IsDotNetVersionEG45) {
+                NTMiner.App app = new NTMiner.App();
+                app.InitializeComponent();
+                app.Run();
+            }
+            else {
+                Process.Start("https://ntminer.com/getDotNet.html");
+            }
+            // 这个机制在MinerClient程序起作用但在MinerStudio程序中会发生类型初始化错误不起作用,具体原因未知
+        }
+    }
+
     public partial class App : Application {
     public partial class App : Application {
         public static readonly string BlockWAUResourceName = "BlockWAU.bat";
         public static readonly string BlockWAUResourceName = "BlockWAU.bat";
         public static readonly string BlockWAUFileFullName = Path.Combine(TempPath.TempDirFullName, BlockWAUResourceName);
         public static readonly string BlockWAUFileFullName = Path.Combine(TempPath.TempDirFullName, BlockWAUResourceName);
@@ -89,6 +108,11 @@ namespace NTMiner {
                 }
                 }
                 BuildPaths();
                 BuildPaths();
                 NTMinerContext.Instance.Init(() => {
                 NTMinerContext.Instance.Init(() => {
+                    VirtualRoot.BuildCmdPath<ShowSignUpPageCommand>(path: message => {
+                        UIThread.Execute(() => {
+                            SignUpPage.ShowWindow();
+                        });
+                    }, location: this.GetType());
                     _appViewFactory.BuildPaths();
                     _appViewFactory.BuildPaths();
                     if (VirtualRoot.IsLTWin10) {
                     if (VirtualRoot.IsLTWin10) {
                         VirtualRoot.ThisLocalWarn(nameof(App), AppRoot.LowWinMessage, toConsole: true);
                         VirtualRoot.ThisLocalWarn(nameof(App), AppRoot.LowWinMessage, toConsole: true);

+ 8 - 0
src/MinerClient/Daemon/NTMinerRpcClient.dll.config

@@ -2,6 +2,14 @@
 <configuration>
 <configuration>
   <runtime>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Net.Http.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
+      </dependentAssembly>
       <dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
         <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />

+ 50 - 0
src/MinerClient/Daemon/System.Net.Http.Extensions.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>System.Net.Http.Extensions</name>
+    </assembly>
+    <members>
+        <member name="T:System.Net.Http.HttpClientHandlerExtensions">
+            <summary>
+            Extension methods for <see cref="T:System.Net.Http.HttpClientHandler"/> which expose differences in platform specific capabilities.
+            </summary>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsAllowAutoRedirect(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpClientHandler.AllowAutoRedirect">HttpClientHandler.AllowAutoRedirect</see> is supported by the handler.
+            When this property is true and <see cref="P:System.Net.Http.HttpClientHandler.SupportsRedirectConfiguration">HttpClientHandler.SupportsRedirectConfiguration</see> is false, setting <see cref="P:System.Net.Http.HttpClientHandler.AllowAutoRedirect">HttpClientHandler.AllowAutoRedirect</see> to true will cause the system default to be used for <see cref="P:System.Net.Http.HttpClientHandler.MaximumAutomaticRedirections">HttpClientHandler.MaximumAutomaticRedirections</see>.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports configuration settings for the <see cref="P:System.Net.Http.HttpClientHandler.AllowAutoRedirect" /> property; otherwise false.</returns>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsPreAuthenticate(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpClientHandler.PreAuthenticate" /> is supported by the handler.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports configuration settings for the <see cref="P:System.Net.Http.HttpClientHandler.PreAuthenticate" /> property; otherwise false.</returns>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsProtocolVersion(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpClientHandler.ProtocolVersion" />, <see cref="P:System.Net.Http.HttpRequestMessage.ProtocolVersion">HttpRequestMessage.ProtocolVersion</see>, and <see cref="P:System.Net.Http.HttpResponseMessage.ProtocolVersion">HttpResponseMessage.ProtocolVersion</see> are supported by the handler.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports configuration settings for the <see cref="P:System.Net.Http.HttpClientHandler.ProtocolVersion" />, <see cref="P:System.Net.Http.HttpRequestMessage.ProtocolVersion">HttpRequestMessage.ProtocolVersion</see>, and <see cref="P:System.Net.Http.HttpResponseMessage.ProtocolVersion">HttpResponseMessage.ProtocolVersion</see> properties; otherwise false.</returns>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsTransferEncodingChunked(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpRequestMessage.Headers">HttpRequestMessage.Headers</see> with <see cref="P:System.Net.Http.HttpRequestHeaders.TransferEncodingChunked"/> or <see cref="P:System.Net.Http.HttpRequestHeaders.TransferEncoding"/> header value of 'chunked' is supported by the handler.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports setting <see cref="P:System.Net.Http.HttpRequestMessage.Headers">HttpRequestMessage.Headers</see> with <see cref="P:System.Net.Http.HttpRequestHeaders.TransferEncodingChunked"/> or <see cref="P:System.Net.Http.HttpRequestHeaders.TransferEncoding"/> header value of 'chunked'; otherwise false.</returns>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsUseProxy(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpClientHandler.UseProxy" /> is supported by the handler.
+            When this property is true and <see cref="P:System.Net.Http.HttpClientHandler.SupportsProxy">HttpClientHandler.SupportsProxy</see> is false, setting <see cref="P:System.Net.Http.HttpClientHandler.UseProxy">HttpClientHandler.UseProxy</see> to true will cause the system default to be used for <see cref="P:System.Net.Http.HttpClientHandler.Proxy">HttpClientHandler.Proxy</see>.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports configuration settings for the <see cref="P:System.Net.Http.HttpClientHandler.UseProxy" /> property; otherwise false.</returns>
+        </member>
+    </members>
+</doc>

+ 8 - 0
src/MinerClient/Daemon/System.Net.Http.Primitives.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>System.Net.Http.Primitives</name>
+    </assembly>
+    <members>
+    </members>
+</doc>

+ 1 - 1
src/MinerClient/FodyWeavers.xml

@@ -1,3 +1,3 @@
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <Costura IncludeDebugSymbols="false" DisableCompression="true" />
+  <Costura IncludeDebugSymbols="false" DisableCompression="false" />
 </Weavers>
 </Weavers>

+ 23 - 13
src/MinerClient/MinerClient.csproj

@@ -11,7 +11,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>开源矿工</AssemblyName>
     <AssemblyName>开源矿工</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
     </TargetFrameworkProfile>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
@@ -48,7 +48,7 @@
     <ApplicationIcon>logo.ico</ApplicationIcon>
     <ApplicationIcon>logo.ico</ApplicationIcon>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup>
   <PropertyGroup>
-    <StartupObject>NTMiner.App</StartupObject>
+    <StartupObject>NTMiner.Program</StartupObject>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -87,23 +87,25 @@
       <HintPath>..\..\packages\LiveCharts.Wpf.0.9.7\lib\net40\LiveCharts.Wpf.dll</HintPath>
       <HintPath>..\..\packages\LiveCharts.Wpf.0.9.7\lib\net40\LiveCharts.Wpf.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
-    <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll</HintPath>
+    <Reference Include="System.Net.Http.WebRequest" />
+    <Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.4.0.30506.0\lib\net40\System.Web.Http.SelfHost.dll</HintPath>
+    <Reference Include="System.Web.Http.SelfHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.5.2.7\lib\net45\System.Web.Http.SelfHost.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System.Xaml">
     <Reference Include="System.Xaml">
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
@@ -132,6 +134,9 @@
     <EmbeddedResource Include="Daemon\sha1" />
     <EmbeddedResource Include="Daemon\sha1" />
     <EmbeddedResource Include="Brand\PoolBrandId" />
     <EmbeddedResource Include="Brand\PoolBrandId" />
     <EmbeddedResource Include="NoDevFee\sha1" />
     <EmbeddedResource Include="NoDevFee\sha1" />
+    <None Include="FodyWeavers.xsd">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="packages.config" />
     <None Include="packages.config" />
     <AppDesigner Include="Properties\" />
     <AppDesigner Include="Properties\" />
     <EmbeddedResource Include="Windows\BlockWAU.bat" />
     <EmbeddedResource Include="Windows\BlockWAU.bat" />
@@ -218,6 +223,9 @@
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
     </Page>
     </Page>
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="FodyWeavers.xml" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
     <PropertyGroup>
@@ -225,8 +233,10 @@
     </PropertyGroup>
     </PropertyGroup>
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
   </Target>
   </Target>
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
   <Target Name="BeforeBuild">

文件差异内容过多而无法显示
+ 1634 - 230
src/MinerClient/NoDevFee/Newtonsoft.Json.xml


+ 50 - 0
src/MinerClient/NoDevFee/System.Net.Http.Extensions.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>System.Net.Http.Extensions</name>
+    </assembly>
+    <members>
+        <member name="T:System.Net.Http.HttpClientHandlerExtensions">
+            <summary>
+            Extension methods for <see cref="T:System.Net.Http.HttpClientHandler"/> which expose differences in platform specific capabilities.
+            </summary>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsAllowAutoRedirect(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpClientHandler.AllowAutoRedirect">HttpClientHandler.AllowAutoRedirect</see> is supported by the handler.
+            When this property is true and <see cref="P:System.Net.Http.HttpClientHandler.SupportsRedirectConfiguration">HttpClientHandler.SupportsRedirectConfiguration</see> is false, setting <see cref="P:System.Net.Http.HttpClientHandler.AllowAutoRedirect">HttpClientHandler.AllowAutoRedirect</see> to true will cause the system default to be used for <see cref="P:System.Net.Http.HttpClientHandler.MaximumAutomaticRedirections">HttpClientHandler.MaximumAutomaticRedirections</see>.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports configuration settings for the <see cref="P:System.Net.Http.HttpClientHandler.AllowAutoRedirect" /> property; otherwise false.</returns>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsPreAuthenticate(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpClientHandler.PreAuthenticate" /> is supported by the handler.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports configuration settings for the <see cref="P:System.Net.Http.HttpClientHandler.PreAuthenticate" /> property; otherwise false.</returns>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsProtocolVersion(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpClientHandler.ProtocolVersion" />, <see cref="P:System.Net.Http.HttpRequestMessage.ProtocolVersion">HttpRequestMessage.ProtocolVersion</see>, and <see cref="P:System.Net.Http.HttpResponseMessage.ProtocolVersion">HttpResponseMessage.ProtocolVersion</see> are supported by the handler.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports configuration settings for the <see cref="P:System.Net.Http.HttpClientHandler.ProtocolVersion" />, <see cref="P:System.Net.Http.HttpRequestMessage.ProtocolVersion">HttpRequestMessage.ProtocolVersion</see>, and <see cref="P:System.Net.Http.HttpResponseMessage.ProtocolVersion">HttpResponseMessage.ProtocolVersion</see> properties; otherwise false.</returns>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsTransferEncodingChunked(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpRequestMessage.Headers">HttpRequestMessage.Headers</see> with <see cref="P:System.Net.Http.HttpRequestHeaders.TransferEncodingChunked"/> or <see cref="P:System.Net.Http.HttpRequestHeaders.TransferEncoding"/> header value of 'chunked' is supported by the handler.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports setting <see cref="P:System.Net.Http.HttpRequestMessage.Headers">HttpRequestMessage.Headers</see> with <see cref="P:System.Net.Http.HttpRequestHeaders.TransferEncodingChunked"/> or <see cref="P:System.Net.Http.HttpRequestHeaders.TransferEncoding"/> header value of 'chunked'; otherwise false.</returns>
+        </member>
+        <member name="M:System.Net.Http.HttpClientHandlerExtensions.SupportsUseProxy(System.Net.Http.HttpClientHandler)">
+            <summary>
+            Gets a value that indicates if <see cref="P:System.Net.Http.HttpClientHandler.UseProxy" /> is supported by the handler.
+            When this property is true and <see cref="P:System.Net.Http.HttpClientHandler.SupportsProxy">HttpClientHandler.SupportsProxy</see> is false, setting <see cref="P:System.Net.Http.HttpClientHandler.UseProxy">HttpClientHandler.UseProxy</see> to true will cause the system default to be used for <see cref="P:System.Net.Http.HttpClientHandler.Proxy">HttpClientHandler.Proxy</see>.
+            </summary>
+            <param name="handler">The <see cref="T:System.Net.Http.HttpClientHandler"/> to check.</param>
+            <returns>Returns <see cref="T:System.Boolean" />.true if the if the handler supports configuration settings for the <see cref="P:System.Net.Http.HttpClientHandler.UseProxy" /> property; otherwise false.</returns>
+        </member>
+    </members>
+</doc>

文件差异内容过多而无法显示
+ 594 - 109
src/MinerClient/NoDevFee/System.Net.Http.Formatting.xml


+ 8 - 0
src/MinerClient/NoDevFee/System.Net.Http.Primitives.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>System.Net.Http.Primitives</name>
+    </assembly>
+    <members>
+    </members>
+</doc>

+ 2 - 1
src/MinerClient/app.config

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
   <runtime>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
       <dependentAssembly>
@@ -8,4 +9,4 @@
       </dependentAssembly>
       </dependentAssembly>
     </assemblyBinding>
     </assemblyBinding>
   </runtime>
   </runtime>
-</configuration>
+</configuration>

+ 9 - 7
src/MinerClient/packages.config

@@ -2,11 +2,13 @@
 <packages>
 <packages>
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
-  <package id="LiveCharts" version="0.9.7" targetFramework="net40" />
-  <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.SelfHost" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
+  <package id="LiveCharts" version="0.9.7" targetFramework="net40" requireReinstallation="true" />
+  <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net40" requireReinstallation="true" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.SelfHost" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
 </packages>
 </packages>

+ 1 - 3
src/MinerClientFinder/App.config

@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <configuration>
-    <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
-    </startup>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
   <runtime>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
       <dependentAssembly>

+ 17 - 0
src/MinerClientFinder/App.xaml.cs

@@ -5,6 +5,23 @@ using System.Diagnostics;
 using System.Windows;
 using System.Windows;
 
 
 namespace NTMiner {
 namespace NTMiner {
+    public class Program {
+        [System.STAThreadAttribute()]
+        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+        public static void Main() {
+            if (AppUtil.IsDotNetVersionEG45) {
+                NTMiner.App app = new NTMiner.App();
+                app.InitializeComponent();
+                app.Run();
+            }
+            else {
+                Process.Start("https://ntminer.com/getDotNet.html");
+            }
+            // 这个机制在MinerClient程序起作用但在MinerStudio程序中会发生类型初始化错误不起作用,具体原因未知
+        }
+    }
+
     public partial class App : Application {
     public partial class App : Application {
         public App() {
         public App() {
             Logger.Disable();
             Logger.Disable();

+ 1 - 1
src/MinerClientFinder/FodyWeavers.xml

@@ -1,3 +1,3 @@
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <Costura />
+  <Costura IncludeDebugSymbols="false" DisableCompression="false" />
 </Weavers>
 </Weavers>

+ 20 - 2
src/MinerClientFinder/MinerClientFinder.csproj

@@ -9,7 +9,7 @@
     <OutputType>WinExe</OutputType>
     <OutputType>WinExe</OutputType>
     <RootNamespace>NTMner</RootNamespace>
     <RootNamespace>NTMner</RootNamespace>
     <AssemblyName>MinerClientFinder</AssemblyName>
     <AssemblyName>MinerClientFinder</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
@@ -27,6 +27,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -36,12 +37,13 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup>
   <PropertyGroup>
     <ApplicationIcon>logo.ico</ApplicationIcon>
     <ApplicationIcon>logo.ico</ApplicationIcon>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup>
   <PropertyGroup>
-    <StartupObject>NTMiner.App</StartupObject>
+    <StartupObject>NTMiner.Program</StartupObject>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
     <Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
@@ -50,6 +52,14 @@
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Core" />
     <Reference Include="System.Management" />
     <Reference Include="System.Management" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
     <Reference Include="System.Xaml">
     <Reference Include="System.Xaml">
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
     </Reference>
     </Reference>
@@ -84,6 +94,9 @@
     <Compile Include="Properties\AssemblyInfo.cs">
     <Compile Include="Properties\AssemblyInfo.cs">
       <SubType>Code</SubType>
       <SubType>Code</SubType>
     </Compile>
     </Compile>
+    <None Include="FodyWeavers.xsd">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -118,6 +131,9 @@
   <ItemGroup>
   <ItemGroup>
     <Resource Include="logo.ico" />
     <Resource Include="logo.ico" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="FodyWeavers.xml" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
     <PropertyGroup>
@@ -125,6 +141,8 @@
     </PropertyGroup>
     </PropertyGroup>
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
   </Target>
   </Target>
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
 </Project>
 </Project>

+ 3 - 0
src/MinerClientFinder/packages.config

@@ -2,4 +2,7 @@
 <packages>
 <packages>
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
 </packages>
 </packages>

+ 26 - 12
src/MinerClientSelfHost/MinerClientSelfHost.csproj

@@ -9,9 +9,12 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>MinerClientSelfHost</AssemblyName>
     <AssemblyName>MinerClientSelfHost</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
+    <TargetFrameworkProfile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -21,6 +24,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -29,26 +33,29 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
-    <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll</HintPath>
+    <Reference Include="System.Net.Http.WebRequest" />
+    <Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.4.0.30506.0\lib\net40\System.Web.Http.SelfHost.dll</HintPath>
+    <Reference Include="System.Web.Http.SelfHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.5.2.7\lib\net45\System.Web.Http.SelfHost.dll</HintPath>
     </Reference>
     </Reference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -87,4 +94,11 @@
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
+  </Target>
 </Project>
 </Project>

+ 7 - 5
src/MinerClientSelfHost/packages.config

@@ -1,8 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
-  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.SelfHost" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.SelfHost" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
 </packages>
 </packages>

+ 5 - 0
src/MinerStudio/App.xaml.cs

@@ -38,6 +38,11 @@ namespace NTMiner {
             VirtualRoot.BuildCmdPath<UpgradeCommand>(path: message => {
             VirtualRoot.BuildCmdPath<UpgradeCommand>(path: message => {
                 AppRoot.Upgrade(NTMinerAppType.MinerStudio, message.FileName, message.Callback);
                 AppRoot.Upgrade(NTMinerAppType.MinerStudio, message.FileName, message.Callback);
             }, location: this.GetType());
             }, location: this.GetType());
+            VirtualRoot.BuildCmdPath<ShowSignUpPageCommand>(path: message => {
+                UIThread.Execute(() => {
+                    SignUpPage.ShowWindow();
+                });
+            }, location: this.GetType());
             if (AppUtil.GetMutex(NTKeyword.MinerStudioAppMutex)) {
             if (AppUtil.GetMutex(NTKeyword.MinerStudioAppMutex)) {
                 this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
                 this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
                 // 因为登录窗口会用到VirtualRoot.Out,而Out的延迟自动关闭消息会用到倒计时
                 // 因为登录窗口会用到VirtualRoot.Out,而Out的延迟自动关闭消息会用到倒计时

+ 1 - 1
src/MinerStudio/FodyWeavers.xml

@@ -1,3 +1,3 @@
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <Costura IncludeDebugSymbols="false" DisableCompression="true" />
+  <Costura IncludeDebugSymbols="false" DisableCompression="false" />
 </Weavers>
 </Weavers>

+ 22 - 12
src/MinerStudio/MinerStudio.csproj

@@ -11,7 +11,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>开源矿工群控</AssemblyName>
     <AssemblyName>开源矿工群控</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
     </TargetFrameworkProfile>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
@@ -94,24 +94,26 @@
       <EmbedInteropTypes>False</EmbedInteropTypes>
       <EmbedInteropTypes>False</EmbedInteropTypes>
     </Reference>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Drawing" />
-    <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll</HintPath>
+    <Reference Include="System.Net.Http.WebRequest" />
+    <Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.4.0.30506.0\lib\net40\System.Web.Http.SelfHost.dll</HintPath>
+    <Reference Include="System.Web.Http.SelfHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.5.2.7\lib\net45\System.Web.Http.SelfHost.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xaml">
     <Reference Include="System.Xaml">
@@ -137,6 +139,9 @@
     <Compile Include="Ws\MinerStudioWsMessageHandler.cs" />
     <Compile Include="Ws\MinerStudioWsMessageHandler.cs" />
     <None Include="app.config" />
     <None Include="app.config" />
     <None Include="app.manifest" />
     <None Include="app.manifest" />
+    <None Include="FodyWeavers.xsd">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="packages.config" />
     <None Include="packages.config" />
     <AppDesigner Include="Properties\" />
     <AppDesigner Include="Properties\" />
   </ItemGroup>
   </ItemGroup>
@@ -193,6 +198,9 @@
   <ItemGroup>
   <ItemGroup>
     <Resource Include="logo.ico" />
     <Resource Include="logo.ico" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="FodyWeavers.xml" />
+  </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ApplicationDefinition Include="..\MinerClient\App.xaml">
     <ApplicationDefinition Include="..\MinerClient\App.xaml">
       <Link>App.xaml</Link>
       <Link>App.xaml</Link>
@@ -207,8 +215,10 @@
     </PropertyGroup>
     </PropertyGroup>
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
   </Target>
   </Target>
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
   <Target Name="BeforeBuild">

+ 2 - 1
src/MinerStudio/app.config

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
   <runtime>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
       <dependentAssembly>
@@ -8,4 +9,4 @@
       </dependentAssembly>
       </dependentAssembly>
     </assemblyBinding>
     </assemblyBinding>
   </runtime>
   </runtime>
-</configuration>
+</configuration>

+ 28 - 28
src/MinerStudio/app.manifest

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
 <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
-  <assemblyIdentity version="1.0.0.0" name="ClientApp.app"/>
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-    <security>
-      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
-        <!-- UAC 清单选项
+	<assemblyIdentity version="1.0.0.0" name="ClientApp.app"/>
+	<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+		<security>
+			<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+				<!-- UAC 清单选项
              如果想要更改 Windows 用户帐户控制级别,请使用
              如果想要更改 Windows 用户帐户控制级别,请使用
              以下节点之一替换 requestedExecutionLevel 节点。n
              以下节点之一替换 requestedExecutionLevel 节点。n
         <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
         <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
@@ -15,40 +15,40 @@
             如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
             如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
             元素。
             元素。
         -->
         -->
-        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
-      </requestedPrivileges>
-    </security>
-  </trustInfo>
+				<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+			</requestedPrivileges>
+		</security>
+	</trustInfo>
 
 
-  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-    <application>
-      <!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
+	<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+		<application>
+			<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
            Windows 版本的列表。取消评论适当的元素,
            Windows 版本的列表。取消评论适当的元素,
            Windows 将自动选择最兼容的环境。 -->
            Windows 将自动选择最兼容的环境。 -->
 
 
-      <!-- Windows Vista -->
-      <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
+			<!-- Windows Vista -->
+			<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
 
 
-      <!-- Windows 7 -->
-      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
+			<!-- Windows 7 -->
+			<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
 
 
-      <!-- Windows 8 -->
-      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
+			<!-- Windows 8 -->
+			<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
 
 
-      <!-- Windows 8.1 -->
-      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
+			<!-- Windows 8.1 -->
+			<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
 
 
-      <!-- Windows 10 -->
-      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
+			<!-- Windows 10 -->
+			<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
 
 
-    </application>
-  </compatibility>
+		</application>
+	</compatibility>
 
 
-  <!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
+	<!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
        自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
        自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
        选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
        选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
        在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
        在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
-  <!--
+	<!--
   <application xmlns="urn:schemas-microsoft-com:asm.v3">
   <application xmlns="urn:schemas-microsoft-com:asm.v3">
     <windowsSettings>
     <windowsSettings>
       <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
       <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
@@ -56,8 +56,8 @@
   </application>
   </application>
   -->
   -->
 
 
-  <!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
-  <!--
+	<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
+	<!--
   <dependency>
   <dependency>
     <dependentAssembly>
     <dependentAssembly>
       <assemblyIdentity
       <assemblyIdentity

+ 9 - 7
src/MinerStudio/packages.config

@@ -2,11 +2,13 @@
 <packages>
 <packages>
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
-  <package id="LiveCharts" version="0.9.7" targetFramework="net40" />
-  <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.SelfHost" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
+  <package id="LiveCharts" version="0.9.7" targetFramework="net40" requireReinstallation="true" />
+  <package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net40" requireReinstallation="true" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.SelfHost" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
 </packages>
 </packages>

+ 26 - 12
src/MinerStudioSelfHost/MinerStudioSelfHost.csproj

@@ -9,9 +9,12 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>MinerStudioSelfHost</AssemblyName>
     <AssemblyName>MinerStudioSelfHost</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
+    <TargetFrameworkProfile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -21,6 +24,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -29,26 +33,29 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
-    <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll</HintPath>
+    <Reference Include="System.Net.Http.WebRequest" />
+    <Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.4.0.30506.0\lib\net40\System.Web.Http.SelfHost.dll</HintPath>
+    <Reference Include="System.Web.Http.SelfHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.5.2.7\lib\net45\System.Web.Http.SelfHost.dll</HintPath>
     </Reference>
     </Reference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -89,4 +96,11 @@
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
+  </Target>
 </Project>
 </Project>

+ 7 - 5
src/MinerStudioSelfHost/packages.config

@@ -1,8 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
-  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.SelfHost" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.SelfHost" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
 </packages>
 </packages>

+ 4 - 1
src/NTMiner.Controllers/NTMiner.Controllers.csproj

@@ -9,9 +9,10 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner.Controllers</RootNamespace>
     <RootNamespace>NTMiner.Controllers</RootNamespace>
     <AssemblyName>NTMiner.Controllers</AssemblyName>
     <AssemblyName>NTMiner.Controllers</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -21,6 +22,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -29,6 +31,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System" />

+ 2 - 1
src/NTMinerClient/Core/Impl/ClientDataSet.cs

@@ -1,5 +1,6 @@
 using LiteDB;
 using LiteDB;
 using NTMiner.Core.MinerServer;
 using NTMiner.Core.MinerServer;
+using NTMiner.Report;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
@@ -112,7 +113,7 @@ namespace NTMiner.Core.Impl {
                         }
                         }
                         clientData.NetActiveOn = DateTime.Now;
                         clientData.NetActiveOn = DateTime.Now;
                         clientData.IsOnline = true;
                         clientData.IsOnline = true;
-                        clientData.Update(speedData, out _);
+                        clientData.Update(new SpeedData(speedData, DateTime.Now), out _);
                     }
                     }
                 });
                 });
             });
             });

+ 6 - 21
src/NTMinerClient/Core/Impl/CoinGroupSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    public class CoinGroupSet : ICoinGroupSet {
+    public class CoinGroupSet : SetBase, ICoinGroupSet {
         private readonly Dictionary<Guid, CoinGroupData> _dicById = new Dictionary<Guid, CoinGroupData>();
         private readonly Dictionary<Guid, CoinGroupData> _dicById = new Dictionary<Guid, CoinGroupData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -46,26 +46,11 @@ namespace NTMiner.Core.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<CoinGroupData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<CoinGroupData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 9 - 24
src/NTMinerClient/Core/Impl/CoinSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    internal class CoinSet : ICoinSet {
+    internal class CoinSet : SetBase, ICoinSet {
         private readonly Dictionary<string, CoinData> _dicByCode = new Dictionary<string, CoinData>(StringComparer.OrdinalIgnoreCase);
         private readonly Dictionary<string, CoinData> _dicByCode = new Dictionary<string, CoinData>(StringComparer.OrdinalIgnoreCase);
         private readonly Dictionary<Guid, CoinData> _dicById = new Dictionary<Guid, CoinData>();
         private readonly Dictionary<Guid, CoinData> _dicById = new Dictionary<Guid, CoinData>();
 
 
@@ -91,9 +91,6 @@ namespace NTMiner.Core.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
         public int Count {
         public int Count {
             get {
             get {
                 InitOnece();
                 InitOnece();
@@ -101,26 +98,14 @@ namespace NTMiner.Core.Impl {
             }
             }
         }
         }
 
 
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<CoinData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                        if (!_dicByCode.ContainsKey(item.Code)) {
-                            _dicByCode.Add(item.Code, item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<CoinData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
+                }
+                if (!_dicByCode.ContainsKey(item.Code)) {
+                    _dicByCode.Add(item.Code, item);
                 }
                 }
             }
             }
         }
         }

+ 6 - 21
src/NTMinerClient/Core/Impl/FileWriterSet.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    public class FileWriterSet : IFileWriterSet {
+    public class FileWriterSet : SetBase, IFileWriterSet {
         private readonly Dictionary<Guid, FileWriterData> _dicById = new Dictionary<Guid, FileWriterData>();
         private readonly Dictionary<Guid, FileWriterData> _dicById = new Dictionary<Guid, FileWriterData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -66,26 +66,11 @@ namespace NTMiner.Core.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<FileWriterData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<FileWriterData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 6 - 21
src/NTMinerClient/Core/Impl/FragmentWriterSet.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    public class FragmentWriterSet : IFragmentWriterSet {
+    public class FragmentWriterSet : SetBase, IFragmentWriterSet {
         private readonly Dictionary<Guid, FragmentWriterData> _dicById = new Dictionary<Guid, FragmentWriterData>();
         private readonly Dictionary<Guid, FragmentWriterData> _dicById = new Dictionary<Guid, FragmentWriterData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -66,26 +66,11 @@ namespace NTMiner.Core.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<FragmentWriterData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<FragmentWriterData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 6 - 21
src/NTMinerClient/Core/Impl/GroupSet.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    public class GroupSet : IGroupSet {
+    public class GroupSet : SetBase, IGroupSet {
         private readonly Dictionary<Guid, GroupData> _dicById = new Dictionary<Guid, GroupData>();
         private readonly Dictionary<Guid, GroupData> _dicById = new Dictionary<Guid, GroupData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -70,26 +70,11 @@ namespace NTMiner.Core.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<GroupData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<GroupData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 29 - 46
src/NTMinerClient/Core/Impl/LocalMessageSet.cs

@@ -4,7 +4,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    public class LocalMessageSet : ILocalMessageSet {
+    public class LocalMessageSet : SetBase, ILocalMessageSet {
         private readonly LinkedList<ILocalMessage> _records = new LinkedList<ILocalMessage>();
         private readonly LinkedList<ILocalMessage> _records = new LinkedList<ILocalMessage>();
         private readonly List<Guid> _dbToRemoveIds = new List<Guid>();
         private readonly List<Guid> _dbToRemoveIds = new List<Guid>();
         private readonly List<LocalMessageData> _dbToInserts = new List<LocalMessageData>();
         private readonly List<LocalMessageData> _dbToInserts = new List<LocalMessageData>();
@@ -25,7 +25,7 @@ namespace NTMiner.Core.Impl {
                 InitOnece();
                 InitOnece();
                 var data = LocalMessageData.Create(message.Input);
                 var data = LocalMessageData.Create(message.Input);
                 List<ILocalMessage> removeds = new List<ILocalMessage>();
                 List<ILocalMessage> removeds = new List<ILocalMessage>();
-                lock (_locker) {
+                lock (_dbToInserts) {
                     _records.AddFirst(data);
                     _records.AddFirst(data);
                     _dbToInserts.Add(data);
                     _dbToInserts.Add(data);
                     while (_records.Count > NTKeyword.LocalMessageSetCapacity) {
                     while (_records.Count > NTKeyword.LocalMessageSetCapacity) {
@@ -39,7 +39,7 @@ namespace NTMiner.Core.Impl {
                 VirtualRoot.RaiseEvent(new LocalMessageAddedEvent(message.MessageId, data, removeds));
                 VirtualRoot.RaiseEvent(new LocalMessageAddedEvent(message.MessageId, data, removeds));
             }, location: this.GetType());
             }, location: this.GetType());
             VirtualRoot.BuildCmdPath<ClearLocalMessageSetCommand>(path: message => {
             VirtualRoot.BuildCmdPath<ClearLocalMessageSetCommand>(path: message => {
-                lock (_locker) {
+                lock (_dbToInserts) {
                     _records.Clear();
                     _records.Clear();
                     _dbToRemoveIds.Clear();
                     _dbToRemoveIds.Clear();
                     _dbToInserts.Clear();
                     _dbToInserts.Clear();
@@ -64,16 +64,14 @@ namespace NTMiner.Core.Impl {
 
 
         private void SaveToDb() {
         private void SaveToDb() {
             if (_dbToInserts.Count > 0) {
             if (_dbToInserts.Count > 0) {
-                lock (_locker) {
+                lock (_dbToInserts) {
                     if (_dbToInserts.Count > 0) {
                     if (_dbToInserts.Count > 0) {
                         List<Guid> toRemoveIds = new List<Guid>();
                         List<Guid> toRemoveIds = new List<Guid>();
                         List<LocalMessageData> toInserts = new List<LocalMessageData>();
                         List<LocalMessageData> toInserts = new List<LocalMessageData>();
-                        lock (_locker) {
-                            toRemoveIds.AddRange(_dbToRemoveIds);
-                            toInserts.AddRange(_dbToInserts);
-                            _dbToRemoveIds.Clear();
-                            _dbToInserts.Clear();
-                        }
+                        toRemoveIds.AddRange(_dbToRemoveIds);
+                        toInserts.AddRange(_dbToInserts);
+                        _dbToRemoveIds.Clear();
+                        _dbToInserts.Clear();
                         try {
                         try {
                             using (LiteDatabase db = new LiteDatabase(ConnString)) {
                             using (LiteDatabase db = new LiteDatabase(ConnString)) {
                                 var col = db.GetCollection<LocalMessageData>();
                                 var col = db.GetCollection<LocalMessageData>();
@@ -92,47 +90,32 @@ namespace NTMiner.Core.Impl {
             }
             }
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    try {
-                        using (LiteDatabase db = new LiteDatabase(ConnString)) {
-                            var col = db.GetCollection<LocalMessageData>();
-                            foreach (var item in col.FindAll().OrderBy(a => a.Timestamp)) {
-                                if (_records.Count < NTKeyword.LocalMessageSetCapacity) {
-                                    _records.AddFirst(item);
-                                }
-                                else {
-                                    col.Delete(item.Id);
-                                }
-                            }
+        protected override void Init() {
+            try {
+                using (LiteDatabase db = new LiteDatabase(ConnString)) {
+                    var col = db.GetCollection<LocalMessageData>();
+                    foreach (var item in col.FindAll().OrderBy(a => a.Timestamp)) {
+                        if (_records.Count < NTKeyword.LocalMessageSetCapacity) {
+                            _records.AddFirst(item);
                         }
                         }
-                    }
-                    catch (Exception e) {
-                        Logger.ErrorDebugLine(e);
-                        try {
-                            using (LiteDatabase db = new LiteDatabase(ConnString)) {
-                                db.DropCollection(nameof(LocalMessageData));
-                            }
-                        }
-                        catch {
+                        else {
+                            col.Delete(item.Id);
                         }
                         }
                     }
                     }
-                    foreach (var item in _records.Take(50).Reverse()) {
-                        LocalMessageDtoSet.Add(item.ToDto());
+                }
+            }
+            catch (Exception e) {
+                Logger.ErrorDebugLine(e);
+                try {
+                    using (LiteDatabase db = new LiteDatabase(ConnString)) {
+                        db.DropCollection(nameof(LocalMessageData));
                     }
                     }
-                    _isInited = true;
                 }
                 }
+                catch {
+                }
+            }
+            foreach (var item in _records.Take(50).Reverse()) {
+                LocalMessageDtoSet.Add(item.ToDto());
             }
             }
         }
         }
 
 

+ 17 - 21
src/NTMinerClient/Core/Impl/OverClockDataSet.cs

@@ -5,7 +5,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    public class OverClockDataSet : IOverClockDataSet {
+    public class OverClockDataSet : SetBase, IOverClockDataSet {
         private readonly Dictionary<Guid, OverClockData> _dicById = new Dictionary<Guid, OverClockData>();
         private readonly Dictionary<Guid, OverClockData> _dicById = new Dictionary<Guid, OverClockData>();
         private readonly INTMinerContext _root;
         private readonly INTMinerContext _root;
 
 
@@ -73,28 +73,24 @@ namespace NTMiner.Core.Impl {
             }, location: this.GetType());
             }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private void InitOnece() {
-            if (!_isInited) {
-                RpcRoot.OfficialServer.OverClockDataService.GetOverClockDatasAsync((response, e) => {
-                    if (response.IsSuccess()) {
-                        IEnumerable<OverClockData> query;
-                        if (_root.GpuSet.GpuType == GpuType.Empty) {
-                            query = response.Data;
-                        }
-                        else {
-                            query = response.Data.Where(a => a.GpuType == _root.GpuSet.GpuType);
-                        }
-                        foreach (var item in query) {
-                            if (!_dicById.ContainsKey(item.GetId())) {
-                                _dicById.Add(item.GetId(), item);
-                            }
+        protected override void Init() {
+            RpcRoot.OfficialServer.OverClockDataService.GetOverClockDatasAsync((response, e) => {
+                if (response.IsSuccess()) {
+                    IEnumerable<OverClockData> query;
+                    if (_root.GpuSet.GpuType == GpuType.Empty) {
+                        query = response.Data;
+                    }
+                    else {
+                        query = response.Data.Where(a => a.GpuType == _root.GpuSet.GpuType);
+                    }
+                    foreach (var item in query) {
+                        if (!_dicById.ContainsKey(item.GetId())) {
+                            _dicById.Add(item.GetId(), item);
                         }
                         }
                     }
                     }
-                    VirtualRoot.RaiseEvent(new OverClockDataSetInitedEvent());
-                });
-                _isInited = true;
-            }
+                }
+                VirtualRoot.RaiseEvent(new OverClockDataSetInitedEvent());
+            });
         }
         }
 
 
         public bool TryGetOverClockData(Guid id, out IOverClockData data) {
         public bool TryGetOverClockData(Guid id, out IOverClockData data) {

+ 7 - 22
src/NTMinerClient/Core/Impl/PoolSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    internal class PoolSet : IPoolSet {
+    internal class PoolSet : SetBase, IPoolSet {
         private class PoolDelay {
         private class PoolDelay {
             public string MainCoinPoolDelayText;
             public string MainCoinPoolDelayText;
             public string DualCoinPoolDelayText;
             public string DualCoinPoolDelayText;
@@ -126,27 +126,12 @@ namespace NTMiner.Core.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateCompositeRepository<PoolData>();
-                    List<PoolData> data = repository.GetAll().ToList();
-                    foreach (var item in data) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateCompositeRepository<PoolData>();
+            List<PoolData> data = repository.GetAll().ToList();
+            foreach (var item in data) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 12 - 27
src/NTMinerClient/Core/Impl/SysDicItemSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    internal class SysDicItemSet : ISysDicItemSet {
+    internal class SysDicItemSet : SetBase, ISysDicItemSet {
         private readonly IServerContext _context;
         private readonly IServerContext _context;
         private readonly Dictionary<Guid, Dictionary<string, SysDicItemData>> _dicByDicId = new Dictionary<Guid, Dictionary<string, SysDicItemData>>();
         private readonly Dictionary<Guid, Dictionary<string, SysDicItemData>> _dicByDicId = new Dictionary<Guid, Dictionary<string, SysDicItemData>>();
         private readonly Dictionary<Guid, SysDicItemData> _dicById = new Dictionary<Guid, SysDicItemData>();
         private readonly Dictionary<Guid, SysDicItemData> _dicById = new Dictionary<Guid, SysDicItemData>();
@@ -87,32 +87,17 @@ namespace NTMiner.Core.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateCompositeRepository<SysDicItemData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                        if (!_dicByDicId.ContainsKey(item.DicId)) {
-                            _dicByDicId.Add(item.DicId, new Dictionary<string, SysDicItemData>(StringComparer.OrdinalIgnoreCase));
-                        }
-                        if (!_dicByDicId[item.DicId].ContainsKey(item.Code)) {
-                            _dicByDicId[item.DicId].Add(item.Code, item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateCompositeRepository<SysDicItemData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
+                }
+                if (!_dicByDicId.ContainsKey(item.DicId)) {
+                    _dicByDicId.Add(item.DicId, new Dictionary<string, SysDicItemData>(StringComparer.OrdinalIgnoreCase));
+                }
+                if (!_dicByDicId[item.DicId].ContainsKey(item.Code)) {
+                    _dicByDicId[item.DicId].Add(item.Code, item);
                 }
                 }
             }
             }
         }
         }

+ 9 - 24
src/NTMinerClient/Core/Impl/SysDicSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    internal class SysDicSet : ISysDicSet {
+    internal class SysDicSet : SetBase, ISysDicSet {
         private readonly Dictionary<string, SysDicData> _dicByCode = new Dictionary<string, SysDicData>(StringComparer.OrdinalIgnoreCase);
         private readonly Dictionary<string, SysDicData> _dicByCode = new Dictionary<string, SysDicData>(StringComparer.OrdinalIgnoreCase);
         private readonly Dictionary<Guid, SysDicData> _dicById = new Dictionary<Guid, SysDicData>();
         private readonly Dictionary<Guid, SysDicData> _dicById = new Dictionary<Guid, SysDicData>();
 
 
@@ -79,29 +79,14 @@ namespace NTMiner.Core.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<SysDicData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                        if (!_dicByCode.ContainsKey(item.Code)) {
-                            _dicByCode.Add(item.Code, item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<SysDicData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
+                }
+                if (!_dicByCode.ContainsKey(item.Code)) {
+                    _dicByCode.Add(item.Code, item);
                 }
                 }
             }
             }
         }
         }

+ 6 - 21
src/NTMinerClient/Core/Kernels/Impl/CoinKernelSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Kernels.Impl {
 namespace NTMiner.Core.Kernels.Impl {
-    internal class CoinKernelSet : ICoinKernelSet {
+    internal class CoinKernelSet : SetBase, ICoinKernelSet {
         private readonly Dictionary<Guid, CoinKernelData> _dicById = new Dictionary<Guid, CoinKernelData>();
         private readonly Dictionary<Guid, CoinKernelData> _dicById = new Dictionary<Guid, CoinKernelData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -116,9 +116,6 @@ namespace NTMiner.Core.Kernels.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
         public int Count {
         public int Count {
             get {
             get {
                 InitOnece();
                 InitOnece();
@@ -126,23 +123,11 @@ namespace NTMiner.Core.Kernels.Impl {
             }
             }
         }
         }
 
 
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<CoinKernelData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<CoinKernelData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 6 - 21
src/NTMinerClient/Core/Kernels/Impl/KernelInputSet.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace NTMiner.Core.Kernels.Impl {
 namespace NTMiner.Core.Kernels.Impl {
-    public class KernelInputSet : IKernelInputSet {
+    public class KernelInputSet : SetBase, IKernelInputSet {
         private readonly Dictionary<Guid, KernelInputData> _dicById = new Dictionary<Guid, KernelInputData>();
         private readonly Dictionary<Guid, KernelInputData> _dicById = new Dictionary<Guid, KernelInputData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -63,26 +63,11 @@ namespace NTMiner.Core.Kernels.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<KernelInputData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<KernelInputData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 6 - 21
src/NTMinerClient/Core/Kernels/Impl/KernelOutputSet.cs

@@ -6,7 +6,7 @@ using System.Linq;
 using System.Text.RegularExpressions;
 using System.Text.RegularExpressions;
 
 
 namespace NTMiner.Core.Kernels.Impl {
 namespace NTMiner.Core.Kernels.Impl {
-    public class KernelOutputSet : IKernelOutputSet {
+    public class KernelOutputSet : SetBase, IKernelOutputSet {
         private readonly Dictionary<Guid, KernelOutputData> _dicById = new Dictionary<Guid, KernelOutputData>();
         private readonly Dictionary<Guid, KernelOutputData> _dicById = new Dictionary<Guid, KernelOutputData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -77,27 +77,12 @@ namespace NTMiner.Core.Kernels.Impl {
             #endregion
             #endregion
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
         // 填充空间
         // 填充空间
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<KernelOutputData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<KernelOutputData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 15 - 30
src/NTMinerClient/Core/Kernels/Impl/KernelOutputTranslaterSet.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text.RegularExpressions;
 using System.Text.RegularExpressions;
 
 
 namespace NTMiner.Core.Kernels.Impl {
 namespace NTMiner.Core.Kernels.Impl {
-    internal class KernelOutputTranslaterSet : IKernelOutputTranslaterSet {
+    internal class KernelOutputTranslaterSet : SetBase, IKernelOutputTranslaterSet {
         public class SortNumberComparer : IComparer<ISortable> {
         public class SortNumberComparer : IComparer<ISortable> {
             public int Compare(ISortable x, ISortable y) {
             public int Compare(ISortable x, ISortable y) {
                 if (x == null || y == null) {
                 if (x == null || y == null) {
@@ -85,36 +85,21 @@ namespace NTMiner.Core.Kernels.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<KernelOutputTranslaterData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                        if (!_dicByKernelOutputId.ContainsKey(item.KernelOutputId)) {
-                            _dicByKernelOutputId.Add(item.KernelOutputId, new List<KernelOutputTranslaterData>());
-                        }
-                        if (_dicByKernelOutputId[item.KernelOutputId].All(a => a.GetId() != item.GetId())) {
-                            _dicByKernelOutputId[item.KernelOutputId].Add(item);
-                        }
-                    }
-                    foreach (var item in _dicByKernelOutputId.Values) {
-                        item.Sort(new SortNumberComparer());
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<KernelOutputTranslaterData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
+                }
+                if (!_dicByKernelOutputId.ContainsKey(item.KernelOutputId)) {
+                    _dicByKernelOutputId.Add(item.KernelOutputId, new List<KernelOutputTranslaterData>());
                 }
                 }
+                if (_dicByKernelOutputId[item.KernelOutputId].All(a => a.GetId() != item.GetId())) {
+                    _dicByKernelOutputId[item.KernelOutputId].Add(item);
+                }
+            }
+            foreach (var item in _dicByKernelOutputId.Values) {
+                item.Sort(new SortNumberComparer());
             }
             }
         }
         }
 
 

+ 6 - 21
src/NTMinerClient/Core/Kernels/Impl/KernelSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Kernels.Impl {
 namespace NTMiner.Core.Kernels.Impl {
-    internal class KernelSet : IKernelSet {
+    internal class KernelSet : SetBase, IKernelSet {
         private readonly Dictionary<Guid, KernelData> _dicById = new Dictionary<Guid, KernelData>();
         private readonly Dictionary<Guid, KernelData> _dicById = new Dictionary<Guid, KernelData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -71,9 +71,6 @@ namespace NTMiner.Core.Kernels.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
         public int Count {
         public int Count {
             get {
             get {
                 InitOnece();
                 InitOnece();
@@ -81,23 +78,11 @@ namespace NTMiner.Core.Kernels.Impl {
             }
             }
         }
         }
 
 
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<KernelData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<KernelData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 6 - 21
src/NTMinerClient/Core/Kernels/Impl/PackageSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Kernels.Impl {
 namespace NTMiner.Core.Kernels.Impl {
-    public class PackageSet : IPackageSet {
+    public class PackageSet : SetBase, IPackageSet {
         private readonly Dictionary<Guid, PackageData> _dicById = new Dictionary<Guid, PackageData>();
         private readonly Dictionary<Guid, PackageData> _dicById = new Dictionary<Guid, PackageData>();
 
 
         private readonly IServerContext _context;
         private readonly IServerContext _context;
@@ -73,9 +73,6 @@ namespace NTMiner.Core.Kernels.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
         public int Count {
         public int Count {
             get {
             get {
                 InitOnece();
                 InitOnece();
@@ -83,23 +80,11 @@ namespace NTMiner.Core.Kernels.Impl {
             }
             }
         }
         }
 
 
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<PackageData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.GetId())) {
-                            _dicById.Add(item.GetId(), item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<PackageData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.GetId())) {
+                    _dicById.Add(item.GetId(), item);
                 }
                 }
             }
             }
         }
         }

+ 18 - 33
src/NTMinerClient/Core/Kernels/Impl/PoolKernelSet.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Kernels.Impl {
 namespace NTMiner.Core.Kernels.Impl {
-    public class PoolKernelSet : IPoolKernelSet {
+    public class PoolKernelSet : SetBase, IPoolKernelSet {
         private readonly IServerContext _context;
         private readonly IServerContext _context;
         private readonly Dictionary<Guid, PoolKernelData> _dicById = new Dictionary<Guid, PoolKernelData>();
         private readonly Dictionary<Guid, PoolKernelData> _dicById = new Dictionary<Guid, PoolKernelData>();
 
 
@@ -52,9 +52,6 @@ namespace NTMiner.Core.Kernels.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
         public int Count {
         public int Count {
             get {
             get {
                 InitOnece();
                 InitOnece();
@@ -62,36 +59,24 @@ namespace NTMiner.Core.Kernels.Impl {
             }
             }
         }
         }
 
 
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _context.CreateServerRepository<PoolKernelData>();
-                    List<PoolKernelData> list = repository.GetAll().ToList();
-                    foreach (IPool pool in _context.PoolSet.AsEnumerable()) {
-                        foreach (ICoinKernel coinKernel in _context.CoinKernelSet.AsEnumerable().Where(a => a.CoinId == pool.CoinId)) {
-                            PoolKernelData poolKernel = list.FirstOrDefault(a => a.PoolId == pool.GetId() && a.KernelId == coinKernel.KernelId);
-                            if (poolKernel != null) {
-                                _dicById.Add(poolKernel.GetId(), poolKernel);
-                            }
-                            else {
-                                Guid poolKernelId = Guid.NewGuid();
-                                _dicById.Add(poolKernelId, new PoolKernelData() {
-                                    Id = poolKernelId,
-                                    Args = string.Empty,
-                                    KernelId = coinKernel.KernelId,
-                                    PoolId = pool.GetId()
-                                });
-                            }
-                        }
+        protected override void Init() {
+            var repository = _context.CreateServerRepository<PoolKernelData>();
+            List<PoolKernelData> list = repository.GetAll().ToList();
+            foreach (IPool pool in _context.PoolSet.AsEnumerable()) {
+                foreach (ICoinKernel coinKernel in _context.CoinKernelSet.AsEnumerable().Where(a => a.CoinId == pool.CoinId)) {
+                    PoolKernelData poolKernel = list.FirstOrDefault(a => a.PoolId == pool.GetId() && a.KernelId == coinKernel.KernelId);
+                    if (poolKernel != null) {
+                        _dicById.Add(poolKernel.GetId(), poolKernel);
+                    }
+                    else {
+                        Guid poolKernelId = Guid.NewGuid();
+                        _dicById.Add(poolKernelId, new PoolKernelData() {
+                            Id = poolKernelId,
+                            Args = string.Empty,
+                            KernelId = coinKernel.KernelId,
+                            PoolId = pool.GetId()
+                        });
                     }
                     }
-                    _isInited = true;
                 }
                 }
             }
             }
         }
         }

+ 11 - 26
src/NTMinerClient/Core/MinerStudio/Impl/ColumnsShowSet.cs

@@ -3,36 +3,21 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.MinerStudio.Impl {
 namespace NTMiner.Core.MinerStudio.Impl {
-    public class ColumnsShowSet : IColumnsShowSet {
+    public class ColumnsShowSet : SetBase, IColumnsShowSet {
         private readonly Dictionary<Guid, ColumnsShowData> _dicById = new Dictionary<Guid, ColumnsShowData>();
         private readonly Dictionary<Guid, ColumnsShowData> _dicById = new Dictionary<Guid, ColumnsShowData>();
 
 
         public ColumnsShowSet() {
         public ColumnsShowSet() {
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
+        protected override void Init() {
+            var repository = VirtualRoot.CreateLocalRepository<ColumnsShowData>();
+            var columnsList = repository.GetAll();
+            foreach (var item in columnsList) {
+                _dicById.Add(item.Id, item);
             }
             }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = VirtualRoot.CreateLocalRepository<ColumnsShowData>();
-                    var columnsList = repository.GetAll();
-                    foreach (var item in columnsList) {
-                        _dicById.Add(item.Id, item);
-                    }
-                    if (!_dicById.ContainsKey(ColumnsShowData.PleaseSelect.Id)) {
-                        _dicById.Add(ColumnsShowData.PleaseSelect.Id, ColumnsShowData.PleaseSelect);
-                        repository.Add(ColumnsShowData.PleaseSelect);
-                    }
-                    _isInited = true;
-                }
+            if (!_dicById.ContainsKey(ColumnsShowData.PleaseSelect.Id)) {
+                _dicById.Add(ColumnsShowData.PleaseSelect.Id, ColumnsShowData.PleaseSelect);
+                repository.Add(ColumnsShowData.PleaseSelect);
             }
             }
         }
         }
 
 
@@ -43,7 +28,7 @@ namespace NTMiner.Core.MinerStudio.Impl {
 
 
         public void AddOrUpdate(ColumnsShowData data) {
         public void AddOrUpdate(ColumnsShowData data) {
             InitOnece();
             InitOnece();
-            lock (_locker) {
+            lock (_dicById) {
                 var repository = VirtualRoot.CreateLocalRepository<ColumnsShowData>();
                 var repository = VirtualRoot.CreateLocalRepository<ColumnsShowData>();
                 if (_dicById.TryGetValue(data.Id, out ColumnsShowData entity)) {
                 if (_dicById.TryGetValue(data.Id, out ColumnsShowData entity)) {
                     entity.Update(data);
                     entity.Update(data);
@@ -60,7 +45,7 @@ namespace NTMiner.Core.MinerStudio.Impl {
         public void Remove(Guid id) {
         public void Remove(Guid id) {
             InitOnece();
             InitOnece();
             ColumnsShowData entity;
             ColumnsShowData entity;
-            lock (_locker) {
+            lock (_dicById) {
                 if (_dicById.TryGetValue(id, out entity)) {
                 if (_dicById.TryGetValue(id, out entity)) {
                     _dicById.Remove(id);
                     _dicById.Remove(id);
                     var repository = VirtualRoot.CreateLocalRepository<ColumnsShowData>();
                     var repository = VirtualRoot.CreateLocalRepository<ColumnsShowData>();

+ 15 - 31
src/NTMinerClient/Core/MinerStudio/Impl/MineWorkSet.cs

@@ -2,13 +2,13 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace NTMiner.Core.MinerStudio.Impl {
 namespace NTMiner.Core.MinerStudio.Impl {
-    public class MineWorkSet : IMineWorkSet {
+    public class MineWorkSet : SetBase, IMineWorkSet {
         private readonly Dictionary<Guid, MineWorkData> _dicById = new Dictionary<Guid, MineWorkData>();
         private readonly Dictionary<Guid, MineWorkData> _dicById = new Dictionary<Guid, MineWorkData>();
 
 
         public MineWorkSet() {
         public MineWorkSet() {
             VirtualRoot.BuildEventPath<MinerStudioServiceSwitchedEvent>("切换了群口后台服务类型后刷新内存", LogEnum.DevConsole, path: message => {
             VirtualRoot.BuildEventPath<MinerStudioServiceSwitchedEvent>("切换了群口后台服务类型后刷新内存", LogEnum.DevConsole, path: message => {
                 _dicById.Clear();
                 _dicById.Clear();
-                _isInited = false;
+                base.Refresh();
                 // 初始化以触发MineWorkSetInitedEvent事件
                 // 初始化以触发MineWorkSetInitedEvent事件
                 InitOnece();
                 InitOnece();
             }, this.GetType());
             }, this.GetType());
@@ -45,39 +45,23 @@ namespace NTMiner.Core.MinerStudio.Impl {
             }, this.GetType());
             }, this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    if (RpcRoot.IsOuterNet) {
-                        RpcRoot.OfficialServer.UserMineWorkService.GetMineWorksAsync((response, e) => {
-                            if (response.IsSuccess()) {
-                                foreach (var item in response.Data) {
-                                    _dicById.Add(item.Id, item);
-                                }
-                            }
-                            _isInited = true;
-                            VirtualRoot.RaiseEvent(new MineWorkSetInitedEvent());
-                        });
-                    }
-                    else {
-                        var repository = VirtualRoot.CreateLocalRepository<MineWorkData>();
-                        foreach (var item in repository.GetAll()) {
+        protected override void Init() {
+            if (RpcRoot.IsOuterNet) {
+                RpcRoot.OfficialServer.UserMineWorkService.GetMineWorksAsync((response, e) => {
+                    if (response.IsSuccess()) {
+                        foreach (var item in response.Data) {
                             _dicById.Add(item.Id, item);
                             _dicById.Add(item.Id, item);
                         }
                         }
-                        _isInited = true;
-                        VirtualRoot.RaiseEvent(new MineWorkSetInitedEvent());
                     }
                     }
+                    VirtualRoot.RaiseEvent(new MineWorkSetInitedEvent());
+                });
+            }
+            else {
+                var repository = VirtualRoot.CreateLocalRepository<MineWorkData>();
+                foreach (var item in repository.GetAll()) {
+                    _dicById.Add(item.Id, item);
                 }
                 }
+                VirtualRoot.RaiseEvent(new MineWorkSetInitedEvent());
             }
             }
         }
         }
 
 

+ 15 - 31
src/NTMinerClient/Core/MinerStudio/Impl/MinerGroupSet.cs

@@ -2,13 +2,13 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace NTMiner.Core.MinerStudio.Impl {
 namespace NTMiner.Core.MinerStudio.Impl {
-    public class MinerGroupSet : IMinerGroupSet {
+    public class MinerGroupSet : SetBase, IMinerGroupSet {
         private readonly Dictionary<Guid, MinerGroupData> _dicById = new Dictionary<Guid, MinerGroupData>();
         private readonly Dictionary<Guid, MinerGroupData> _dicById = new Dictionary<Guid, MinerGroupData>();
 
 
         public MinerGroupSet() {
         public MinerGroupSet() {
             VirtualRoot.BuildEventPath<MinerStudioServiceSwitchedEvent>("切换了群口后台服务类型后刷新内存", LogEnum.DevConsole, path: message => {
             VirtualRoot.BuildEventPath<MinerStudioServiceSwitchedEvent>("切换了群口后台服务类型后刷新内存", LogEnum.DevConsole, path: message => {
                 _dicById.Clear();
                 _dicById.Clear();
-                _isInited = false;
+                base.Refresh();
                 // 初始化以触发MinerGroupSetInitedEvent事件
                 // 初始化以触发MinerGroupSetInitedEvent事件
                 InitOnece();
                 InitOnece();
             }, this.GetType());
             }, this.GetType());
@@ -44,39 +44,23 @@ namespace NTMiner.Core.MinerStudio.Impl {
             }, this.GetType());
             }, this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    if (RpcRoot.IsOuterNet) {
-                        RpcRoot.OfficialServer.UserMinerGroupService.GetMinerGroupsAsync((response, e) => {
-                            if (response.IsSuccess()) {
-                                foreach (var item in response.Data) {
-                                    _dicById.Add(item.Id, item);
-                                }
-                            }
-                            _isInited = true;
-                            VirtualRoot.RaiseEvent(new MinerGroupSetInitedEvent());
-                        });
-                    }
-                    else {
-                        var repository = VirtualRoot.CreateLocalRepository<MinerGroupData>();
-                        foreach (var item in repository.GetAll()) {
+        protected override void Init() {
+            if (RpcRoot.IsOuterNet) {
+                RpcRoot.OfficialServer.UserMinerGroupService.GetMinerGroupsAsync((response, e) => {
+                    if (response.IsSuccess()) {
+                        foreach (var item in response.Data) {
                             _dicById.Add(item.Id, item);
                             _dicById.Add(item.Id, item);
                         }
                         }
-                        _isInited = true;
-                        VirtualRoot.RaiseEvent(new MinerGroupSetInitedEvent());
                     }
                     }
+                    VirtualRoot.RaiseEvent(new MinerGroupSetInitedEvent());
+                });
+            }
+            else {
+                var repository = VirtualRoot.CreateLocalRepository<MinerGroupData>();
+                foreach (var item in repository.GetAll()) {
+                    _dicById.Add(item.Id, item);
                 }
                 }
+                VirtualRoot.RaiseEvent(new MinerGroupSetInitedEvent());
             }
             }
         }
         }
 
 

+ 2 - 15
src/NTMinerClient/Core/MinerStudio/Impl/NTMinerWalletSet.cs

@@ -3,7 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace NTMiner.Core.MinerStudio.Impl {
 namespace NTMiner.Core.MinerStudio.Impl {
-    public class NTMinerWalletSet : INTMinerWalletSet {
+    public class NTMinerWalletSet : SetBase, INTMinerWalletSet {
         private readonly Dictionary<Guid, NTMinerWalletData> _dicById = new Dictionary<Guid, NTMinerWalletData>();
         private readonly Dictionary<Guid, NTMinerWalletData> _dicById = new Dictionary<Guid, NTMinerWalletData>();
 
 
         public NTMinerWalletSet() {
         public NTMinerWalletSet() {
@@ -69,20 +69,7 @@ namespace NTMiner.Core.MinerStudio.Impl {
             }, location: this.GetType());
             }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            if (_isInited) {
-                return;
-            }
-            _isInited = true;
+        protected override void Init() {
             RpcRoot.OfficialServer.NTMinerWalletService.GetNTMinerWalletsAsync((response, e) => {
             RpcRoot.OfficialServer.NTMinerWalletService.GetNTMinerWalletsAsync((response, e) => {
                 if (response.IsSuccess()) {
                 if (response.IsSuccess()) {
                     foreach (var item in response.Data) {
                     foreach (var item in response.Data) {

+ 19 - 34
src/NTMinerClient/Core/Profiles/Impl/GpuProfileSet.cs

@@ -7,7 +7,7 @@ using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 
 
 namespace NTMiner.Core.Profiles.Impl {
 namespace NTMiner.Core.Profiles.Impl {
-    public class GpuProfileSet : IGpuProfileSet {
+    public class GpuProfileSet : SetBase, IGpuProfileSet {
         private GpuProfilesJsonDb _data = new GpuProfilesJsonDb();
         private GpuProfilesJsonDb _data = new GpuProfilesJsonDb();
 
 
         public GpuProfileSet(INTMinerContext root) {
         public GpuProfileSet(INTMinerContext root) {
@@ -32,8 +32,24 @@ namespace NTMiner.Core.Profiles.Impl {
             }, location: this.GetType());
             }, location: this.GetType());
         }
         }
 
 
-        public void Refresh() {
-            _isInited = false;
+        protected override void Init() {
+            string json = HomePath.ReadGpuProfilesJsonFile();
+            if (!string.IsNullOrEmpty(json)) {
+                GpuProfilesJsonDb data = VirtualRoot.JsonSerializer.Deserialize<GpuProfilesJsonDb>(json);
+                if (data != null) {
+                    _data = data;
+                }
+                else {
+                    Save();
+                }
+            }
+            else {
+                Save();
+            }
+        }
+
+        public new void Refresh() {
+            base.Refresh();
             VirtualRoot.RaiseEvent(new GpuProfileSetRefreshedEvent());
             VirtualRoot.RaiseEvent(new GpuProfileSetRefreshedEvent());
         }
         }
 
 
@@ -176,37 +192,6 @@ namespace NTMiner.Core.Profiles.Impl {
             string json = VirtualRoot.JsonSerializer.Serialize(_data);
             string json = VirtualRoot.JsonSerializer.Serialize(_data);
             HomePath.WriteGpuProfilesJsonFile(json);
             HomePath.WriteGpuProfilesJsonFile(json);
         }
         }
-
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    string json = HomePath.ReadGpuProfilesJsonFile();
-                    if (!string.IsNullOrEmpty(json)) {
-                        GpuProfilesJsonDb data = VirtualRoot.JsonSerializer.Deserialize<GpuProfilesJsonDb>(json);
-                        if (data != null) {
-                            _data = data;
-                        }
-                        else {
-                            Save();
-                        }
-                    }
-                    else {
-                        Save();
-                    }
-                    _isInited = true;
-                }
-            }
-        }
         #endregion
         #endregion
     }
     }
 }
 }

+ 8 - 23
src/NTMinerClient/Core/Profiles/Impl/WalletSet.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace NTMiner.Core.Profiles.Impl {
 namespace NTMiner.Core.Profiles.Impl {
-    public class WalletSet {
+    public class WalletSet : SetBase {
         private readonly Dictionary<Guid, WalletData> _dicById = new Dictionary<Guid, WalletData>();
         private readonly Dictionary<Guid, WalletData> _dicById = new Dictionary<Guid, WalletData>();
 
 
         private readonly INTMinerContext _root;
         private readonly INTMinerContext _root;
@@ -69,31 +69,16 @@ namespace NTMiner.Core.Profiles.Impl {
             }, location: this.GetType());
             }, location: this.GetType());
         }
         }
 
 
-        public void Refresh() {
+        public new void Refresh() {
             _dicById.Clear();
             _dicById.Clear();
-            _isInited = false;
+            base.Refresh();
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    var repository = _root.ServerContext.CreateLocalRepository<WalletData>();
-                    foreach (var item in repository.GetAll()) {
-                        if (!_dicById.ContainsKey(item.Id)) {
-                            _dicById.Add(item.Id, item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            var repository = _root.ServerContext.CreateLocalRepository<WalletData>();
+            foreach (var item in repository.GetAll()) {
+                if (!_dicById.ContainsKey(item.Id)) {
+                    _dicById.Add(item.Id, item);
                 }
                 }
             }
             }
         }
         }

+ 9 - 18
src/NTMinerClient/Gpus/Impl/GpusSpeed.cs

@@ -6,7 +6,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Gpus.Impl {
 namespace NTMiner.Gpus.Impl {
-    internal class GpusSpeed : IGpusSpeed {
+    internal class GpusSpeed : SetBase, IGpusSpeed {
         private readonly Dictionary<int, GpuSpeed> _currentGpuSpeed = new Dictionary<int, GpuSpeed>();
         private readonly Dictionary<int, GpuSpeed> _currentGpuSpeed = new Dictionary<int, GpuSpeed>();
         private readonly Dictionary<int, List<IGpuSpeed>> _gpuSpeedHistory = new Dictionary<int, List<IGpuSpeed>>();
         private readonly Dictionary<int, List<IGpuSpeed>> _gpuSpeedHistory = new Dictionary<int, List<IGpuSpeed>>();
         private readonly Dictionary<int, AverageSpeedWithHistory> _averageGpuSpeed = new Dictionary<int, AverageSpeedWithHistory>();
         private readonly Dictionary<int, AverageSpeedWithHistory> _averageGpuSpeed = new Dictionary<int, AverageSpeedWithHistory>();
@@ -47,27 +47,18 @@ namespace NTMiner.Gpus.Impl {
                 }, location: this.GetType());
                 }, location: this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-        private void InitOnece() {
-            if (!_isInited) {
-                lock (_locker) {
-                    if (!_isInited) {
-                        foreach (var gpu in _root.GpuSet.AsEnumerable()) {
-                            _currentGpuSpeed.Add(gpu.Index, new GpuSpeed(gpu, mainCoinSpeed: new Speed(), dualCoinSpeed: new Speed()));
-                            _gpuSpeedHistory.Add(gpu.Index, new List<IGpuSpeed>());
-                            _averageGpuSpeed.Add(gpu.Index, new AverageSpeedWithHistory());
-                        }
-                        _isInited = true;
-                    }
-                }
+        protected override void Init() {
+            foreach (var gpu in _root.GpuSet.AsEnumerable()) {
+                _currentGpuSpeed.Add(gpu.Index, new GpuSpeed(gpu, mainCoinSpeed: new Speed(), dualCoinSpeed: new Speed()));
+                _gpuSpeedHistory.Add(gpu.Index, new List<IGpuSpeed>());
+                _averageGpuSpeed.Add(gpu.Index, new AverageSpeedWithHistory());
             }
             }
         }
         }
 
 
         private void ClearOutOfDateHistory() {
         private void ClearOutOfDateHistory() {
             InitOnece();
             InitOnece();
             DateTime now = DateTime.Now;
             DateTime now = DateTime.Now;
-            lock (_locker) {
+            lock (_gpuSpeedHistory) {
                 foreach (var averageSpeed in _averageGpuSpeed.Values) {
                 foreach (var averageSpeed in _averageGpuSpeed.Values) {
                     averageSpeed.SpeedHistory.Add(averageSpeed.Speed);
                     averageSpeed.SpeedHistory.Add(averageSpeed.Speed);
                     averageSpeed.DualSpeedHistory.Add(averageSpeed.DualSpeed);
                     averageSpeed.DualSpeedHistory.Add(averageSpeed.DualSpeed);
@@ -157,7 +148,7 @@ namespace NTMiner.Gpus.Impl {
             if (this._mainCoinId != mainCoinId) {
             if (this._mainCoinId != mainCoinId) {
                 this._mainCoinId = mainCoinId;
                 this._mainCoinId = mainCoinId;
                 // 切换币种了,清空历史算力
                 // 切换币种了,清空历史算力
-                lock (_locker) {
+                lock (_gpuSpeedHistory) {
                     foreach (var item in _gpuSpeedHistory) {
                     foreach (var item in _gpuSpeedHistory) {
                         item.Value.Clear();
                         item.Value.Clear();
                     }
                     }
@@ -178,7 +169,7 @@ namespace NTMiner.Gpus.Impl {
                 return;
                 return;
             }
             }
             CheckReset();
             CheckReset();
-            lock (_locker) {
+            lock (_gpuSpeedHistory) {
                 // 将当前的旧算力加入历史列表
                 // 将当前的旧算力加入历史列表
                 if (_gpuSpeedHistory.TryGetValue(gpuSpeed.Gpu.Index, out List<IGpuSpeed> list)) {
                 if (_gpuSpeedHistory.TryGetValue(gpuSpeed.Gpu.Index, out List<IGpuSpeed> list)) {
                     list.Add(gpuSpeed.Clone());
                     list.Add(gpuSpeed.Clone());

+ 1 - 1
src/NTMinerClient/Messages.cs

@@ -86,7 +86,7 @@ namespace NTMiner {
             if (!string.IsNullOrEmpty(serverVersion) && serverVersion != EntryAssemblyInfo.CurrentVersionStr) {
             if (!string.IsNullOrEmpty(serverVersion) && serverVersion != EntryAssemblyInfo.CurrentVersionStr) {
                 if (Version.TryParse(serverVersion, out Version v)) {
                 if (Version.TryParse(serverVersion, out Version v)) {
                     if (v > EntryAssemblyInfo.CurrentVersion) {
                     if (v > EntryAssemblyInfo.CurrentVersion) {
-                        NTMinerContext.ServerVersion = v;
+                        NTMinerContext.SetServerVersion(v);
                         VirtualRoot.RaiseEvent(new AppVersionChangedEvent());
                         VirtualRoot.RaiseEvent(new AppVersionChangedEvent());
                     }
                     }
                 }
                 }

+ 31 - 15
src/NTMinerClient/NTMinerClient.csproj

@@ -9,8 +9,11 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>NTMinerClient</AssemblyName>
     <AssemblyName>NTMinerClient</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -22,6 +25,7 @@
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -31,6 +35,7 @@
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -40,6 +45,7 @@
     <PlatformTarget>x86</PlatformTarget>
     <PlatformTarget>x86</PlatformTarget>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
     <OutputPath>bin\x86\Release\</OutputPath>
     <OutputPath>bin\x86\Release\</OutputPath>
@@ -49,37 +55,40 @@
     <PlatformTarget>x86</PlatformTarget>
     <PlatformTarget>x86</PlatformTarget>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
-    <Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
+    <Reference Include="ICSharpCode.SharpZipLib, Version=1.3.1.9, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\SharpZipLib.1.3.1\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="LiteDB, Version=4.1.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
     <Reference Include="LiteDB, Version=4.1.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
       <HintPath>..\..\packages\LiteDB.4.1.4\lib\net40\LiteDB.dll</HintPath>
       <HintPath>..\..\packages\LiteDB.4.1.4\lib\net40\LiteDB.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="OpenHardwareMonitorLib">
     <Reference Include="OpenHardwareMonitorLib">
       <HintPath>..\ThirdPartyDlls\OpenHardwareMonitorLib.dll</HintPath>
       <HintPath>..\ThirdPartyDlls\OpenHardwareMonitorLib.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Management" />
     <Reference Include="System.Management" />
-    <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
     </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
     <Reference Include="System.ServiceProcess" />
     <Reference Include="System.ServiceProcess" />
-    <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll</HintPath>
+    <Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.4.0.30506.0\lib\net40\System.Web.Http.SelfHost.dll</HintPath>
+    <Reference Include="System.Web.Http.SelfHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.5.2.7\lib\net45\System.Web.Http.SelfHost.dll</HintPath>
     </Reference>
     </Reference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -229,8 +238,8 @@
     <Compile Include="ZipUtil.cs" />
     <Compile Include="ZipUtil.cs" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <None Include="app.config" />
     <Compile Include="Core\Profiles\Impl\WalletSet.cs" />
     <Compile Include="Core\Profiles\Impl\WalletSet.cs" />
+    <None Include="app.config" />
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -275,4 +284,11 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup />
   <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
+  </Target>
 </Project>
 </Project>

+ 30 - 21
src/NTMinerClient/NTMinerContext.partials.CreateMineContext.cs

@@ -276,33 +276,40 @@ namespace NTMiner {
             return devicesArgs;
             return devicesArgs;
         }
         }
 
 
+        private static readonly HashSet<string> _mainParameterNames = new HashSet<string> {
+            NTKeyword.MainCoinParameterName,
+            NTKeyword.WalletParameterName,
+            NTKeyword.UserNameParameterName,
+            NTKeyword.PasswordParameterName,
+            NTKeyword.HostParameterName,
+            NTKeyword.PortParameterName,
+            NTKeyword.PoolParameterName
+        };
+        private static readonly HashSet<string> _dualParameterNames = new HashSet<string> {
+            NTKeyword.DualCoinParameterName,
+            NTKeyword.DualWalletParameterName,
+            NTKeyword.DualUserNameParameterName,
+            NTKeyword.DualPasswordParameterName,
+            NTKeyword.DualHostParameterName,
+            NTKeyword.DualPortParameterName,
+            NTKeyword.DualPoolParameterName
+        };
         private static void AssembleArgs(Dictionary<string, string> prms, ref string args, bool isDual) {
         private static void AssembleArgs(Dictionary<string, string> prms, ref string args, bool isDual) {
             if (string.IsNullOrEmpty(args)) {
             if (string.IsNullOrEmpty(args)) {
                 args = string.Empty;
                 args = string.Empty;
                 return;
                 return;
             }
             }
-            args = args.Replace("{" + NTKeyword.MainCoinParameterName + "}", prms[NTKeyword.MainCoinParameterName]);
-            if (prms.ContainsKey(NTKeyword.WalletParameterName)) {
-                args = args.Replace("{" + NTKeyword.WalletParameterName + "}", prms[NTKeyword.WalletParameterName]);
-            }
-            if (prms.ContainsKey(NTKeyword.UserNameParameterName)) {
-                args = args.Replace("{" + NTKeyword.UserNameParameterName + "}", prms[NTKeyword.UserNameParameterName]);
-            }
-            if (prms.ContainsKey(NTKeyword.PasswordParameterName)) {
-                args = args.Replace("{" + NTKeyword.PasswordParameterName + "}", prms[NTKeyword.PasswordParameterName]);
+            foreach (var parameterName in _mainParameterNames) {
+                if (prms.ContainsKey(parameterName)) {
+                    args = args.Replace("{" + parameterName + "}", prms[parameterName]);
+                }
             }
             }
-            args = args.Replace("{" + NTKeyword.HostParameterName + "}", prms[NTKeyword.HostParameterName]);
-            args = args.Replace("{" + NTKeyword.PortParameterName + "}", prms[NTKeyword.PortParameterName]);
-            args = args.Replace("{" + NTKeyword.PoolParameterName + "}", prms[NTKeyword.PoolParameterName]);
-            args = args.Replace("{" + NTKeyword.WorkerParameterName + "}", prms[NTKeyword.WorkerParameterName]);
             if (isDual) {
             if (isDual) {
-                args = args.Replace("{" + NTKeyword.DualCoinParameterName + "}", prms[NTKeyword.DualCoinParameterName]);
-                args = args.Replace("{" + NTKeyword.DualWalletParameterName + "}", prms[NTKeyword.DualWalletParameterName]);
-                args = args.Replace("{" + NTKeyword.DualUserNameParameterName + "}", prms[NTKeyword.DualUserNameParameterName]);
-                args = args.Replace("{" + NTKeyword.DualPasswordParameterName + "}", prms[NTKeyword.DualPasswordParameterName]);
-                args = args.Replace("{" + NTKeyword.DualHostParameterName + "}", prms[NTKeyword.DualHostParameterName]);
-                args = args.Replace("{" + NTKeyword.DualPortParameterName + "}", prms[NTKeyword.DualPortParameterName]);
-                args = args.Replace("{" + NTKeyword.DualPoolParameterName + "}", prms[NTKeyword.DualPoolParameterName]);
+                foreach (var parameterName in _dualParameterNames) {
+                    if (prms.ContainsKey(parameterName)) {
+                        args = args.Replace("{" + parameterName + "}", prms[parameterName]);
+                    }
+                }
             }
             }
             // 这里不要考虑{logfile},{logfile}往后推迟
             // 这里不要考虑{logfile},{logfile}往后推迟
         }
         }
@@ -371,7 +378,9 @@ namespace NTMiner {
                 }
                 }
                 string content = writer.Body;
                 string content = writer.Body;
                 foreach (var parameterName in parameterNames.Names) {
                 foreach (var parameterName in parameterNames.Names) {
-                    content = content.Replace($"{{{parameterName}}}", parameters[parameterName]);
+                    if (parameters.ContainsKey(parameterName)) {
+                        content = content.Replace($"{{{parameterName}}}", parameters[parameterName]);
+                    }
                 }
                 }
                 if (writer is IFileWriter) {
                 if (writer is IFileWriter) {
                     if (fileWriters.ContainsKey(writer.GetId())) {
                     if (fileWriters.ContainsKey(writer.GetId())) {

+ 8 - 3
src/NTMinerClient/NTMinerContext.partials.static.cs

@@ -9,8 +9,14 @@ using System.Linq;
 
 
 namespace NTMiner {
 namespace NTMiner {
     public partial class NTMinerContext {
     public partial class NTMinerContext {
-        static NTMinerContext() {
-            ServerVersion = EntryAssemblyInfo.CurrentVersion;
+        private static Version _serverVersion = EntryAssemblyInfo.CurrentVersion;
+        public static Version ServerVersion {
+            get {
+                return _serverVersion;
+            }
+        }
+        public static void SetServerVersion(Version serverVersion) {
+            _serverVersion = serverVersion;
         }
         }
 
 
         public const int SpeedHistoryLengthByMinute = 10;
         public const int SpeedHistoryLengthByMinute = 10;
@@ -34,7 +40,6 @@ namespace NTMiner {
             }
             }
         }
         }
 
 
-        public static Version ServerVersion;
         /// <summary>
         /// <summary>
         /// 表示是否是使用server.json只读数据库文件。
         /// 表示是否是使用server.json只读数据库文件。
         /// 只有DevMode模式的挖矿端才会返回False,否则都是True。
         /// 只有DevMode模式的挖矿端才会返回False,否则都是True。

+ 8 - 6
src/NTMinerClient/packages.config

@@ -1,10 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
   <package id="LiteDB" version="4.1.4" targetFramework="net40" />
   <package id="LiteDB" version="4.1.4" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.SelfHost" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
-  <package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.SelfHost" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
+  <package id="SharpZipLib" version="1.3.1" targetFramework="net45" />
 </packages>
 </packages>

+ 8 - 23
src/NTMinerDaemon/Core/Impl/OperationResultSet.cs

@@ -4,7 +4,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
 namespace NTMiner.Core.Impl {
 namespace NTMiner.Core.Impl {
-    public class OperationResultSet : IOperationResultSet {
+    public class OperationResultSet : SetBase, IOperationResultSet {
         private const int _capacityCount = 50;
         private const int _capacityCount = 50;
 
 
         // 新的在队尾,旧的在队头
         // 新的在队尾,旧的在队头
@@ -30,26 +30,11 @@ namespace NTMiner.Core.Impl {
             }, this.GetType());
             }, this.GetType());
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    using (var db = VirtualRoot.CreateLocalDb()) {
-                        var col = db.GetCollection<OperationResultData>();
-                        foreach (var item in col.FindAll().OrderBy(a => a.Timestamp)) {
-                            _list.Add(item);
-                        }
-                    }
-                    _isInited = true;
+        protected override void Init() {
+            using (var db = VirtualRoot.CreateLocalDb()) {
+                var col = db.GetCollection<OperationResultData>();
+                foreach (var item in col.FindAll().OrderBy(a => a.Timestamp)) {
+                    _list.Add(item);
                 }
                 }
             }
             }
         }
         }
@@ -61,7 +46,7 @@ namespace NTMiner.Core.Impl {
             }
             }
             var data = OperationResultData.Create(operationResult);
             var data = OperationResultData.Create(operationResult);
             List<OperationResultData> toRemoves = new List<OperationResultData>();
             List<OperationResultData> toRemoves = new List<OperationResultData>();
-            lock (_locker) {
+            lock (_list) {
                 // 新的在队尾,旧的在队头
                 // 新的在队尾,旧的在队头
                 _list.Add(data);
                 _list.Add(data);
                 while (_list.Count > _capacityCount) {
                 while (_list.Count > _capacityCount) {
@@ -81,7 +66,7 @@ namespace NTMiner.Core.Impl {
 
 
         public List<OperationResultDto> Gets(long afterTime) {
         public List<OperationResultDto> Gets(long afterTime) {
             InitOnece();
             InitOnece();
-            lock (_locker) {
+            lock (_list) {
                 if (afterTime <= 0) {
                 if (afterTime <= 0) {
                     if (_list.Count > 20) {
                     if (_list.Count > 20) {
                         return _list.Skip(_list.Count - 20).Cast<OperationResultDto>().ToList();
                         return _list.Skip(_list.Count - 20).Cast<OperationResultDto>().ToList();

+ 1 - 1
src/NTMinerDaemon/FodyWeavers.xml

@@ -1,3 +1,3 @@
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <Costura />
+  <Costura IncludeDebugSymbols="false" DisableCompression="false" />
 </Weavers>
 </Weavers>

+ 25 - 13
src/NTMinerDaemon/NTMinerDaemon.csproj

@@ -9,11 +9,12 @@
     <OutputType>WinExe</OutputType>
     <OutputType>WinExe</OutputType>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>NTMinerDaemon</AssemblyName>
     <AssemblyName>NTMinerDaemon</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
     <NuGetPackageImportStamp>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -25,6 +26,7 @@
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -35,6 +37,7 @@
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup />
   <PropertyGroup />
   <PropertyGroup>
   <PropertyGroup>
@@ -58,26 +61,28 @@
       <HintPath>..\..\packages\log4net.2.0.12\lib\net40\log4net.dll</HintPath>
       <HintPath>..\..\packages\log4net.2.0.12\lib\net40\log4net.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Management" />
     <Reference Include="System.Management" />
-    <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
     </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web" />
-    <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll</HintPath>
+    <Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.4.0.30506.0\lib\net40\System.Web.Http.SelfHost.dll</HintPath>
+    <Reference Include="System.Web.Http.SelfHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.SelfHost.5.2.7\lib\net45\System.Web.Http.SelfHost.dll</HintPath>
     </Reference>
     </Reference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -176,6 +181,9 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <None Include="app.config" />
     <None Include="app.config" />
+    <None Include="FodyWeavers.xsd">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -207,7 +215,9 @@
   <ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="logo.ico" />
     <EmbeddedResource Include="logo.ico" />
   </ItemGroup>
   </ItemGroup>
-  <ItemGroup />
+  <ItemGroup>
+    <Content Include="FodyWeavers.xml" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
   <PropertyGroup>
     <PostBuildEvent>$(TargetName) --sha1</PostBuildEvent>
     <PostBuildEvent>$(TargetName) --sha1</PostBuildEvent>
@@ -218,6 +228,8 @@
     </PropertyGroup>
     </PropertyGroup>
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
   </Target>
   </Target>
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
 </Project>
 </Project>

+ 2 - 1
src/NTMinerDaemon/app.config

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
   <runtime>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
       <dependentAssembly>
@@ -8,4 +9,4 @@
       </dependentAssembly>
       </dependentAssembly>
     </assemblyBinding>
     </assemblyBinding>
   </runtime>
   </runtime>
-</configuration>
+</configuration>

+ 8 - 6
src/NTMinerDaemon/packages.config

@@ -3,10 +3,12 @@
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
   <package id="LiteDB" version="4.1.4" targetFramework="net40" />
   <package id="LiteDB" version="4.1.4" targetFramework="net40" />
-  <package id="log4net" version="2.0.12" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Core" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.SelfHost" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
+  <package id="log4net" version="2.0.12" targetFramework="net40" requireReinstallation="true" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.SelfHost" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
 </packages>
 </packages>

+ 11 - 27
src/NTMinerDataSchemas/Core/MinerServer/ClientData.cs

@@ -548,6 +548,7 @@ namespace NTMiner.Core.MinerServer {
         /// <param name="isMinerDataChanged"></param>
         /// <param name="isMinerDataChanged"></param>
         public void Update(ISpeedDto speedDto, string minerIp, out bool isMinerDataChanged) {
         public void Update(ISpeedDto speedDto, string minerIp, out bool isMinerDataChanged) {
             Update(speedDto, out isMinerDataChanged);
             Update(speedDto, out isMinerDataChanged);
+            this.MinerActiveOn = DateTime.Now;
             if (!isMinerDataChanged && minerIp != this.MinerIp) {
             if (!isMinerDataChanged && minerIp != this.MinerIp) {
                 isMinerDataChanged = true;
                 isMinerDataChanged = true;
             }
             }
@@ -570,44 +571,28 @@ namespace NTMiner.Core.MinerServer {
             this.MinerIp = minerIp;
             this.MinerIp = minerIp;
         }
         }
 
 
-        private DateTime _preUpdateOn = DateTime.Now;
-        private int _preMainCoinShare = 0;
-        private int _preDualCoinShare = 0;
-        private int _preMainCoinRejectShare = 0;
-        private int _preDualCoinRejectShare = 0;
-        private string _preMainCoin;
-        private string _preDualCoin;
         /// <summary>
         /// <summary>
         /// 上报算力时和拉取算力时。
         /// 上报算力时和拉取算力时。
         /// 因为只有MinerData具有的成员发生了变化时才需要持久化所以该非法输出isMinerDataChanged参数以表示MinerData的成员是否发生了变化。
         /// 因为只有MinerData具有的成员发生了变化时才需要持久化所以该非法输出isMinerDataChanged参数以表示MinerData的成员是否发生了变化。
         /// </summary>
         /// </summary>
         /// <param name="speedDto"></param>
         /// <param name="speedDto"></param>
         /// <param name="isMinerDataChanged"></param>
         /// <param name="isMinerDataChanged"></param>
+        public void Update(ISpeedData speedData, out bool isMinerDataChanged) {
+            this.Update((ISpeedDto)speedData, out isMinerDataChanged);
+            this.MinerActiveOn = speedData.SpeedOn;
+        }
+
+        /// <summary>
+        /// 不更新MinerActiveOn
+        /// </summary>
+        /// <param name="speedDto"></param>
+        /// <param name="isMinerDataChanged"></param>
         public void Update(ISpeedDto speedDto, out bool isMinerDataChanged) {
         public void Update(ISpeedDto speedDto, out bool isMinerDataChanged) {
             #region
             #region
             isMinerDataChanged = false;
             isMinerDataChanged = false;
             if (speedDto == null) {
             if (speedDto == null) {
                 return;
                 return;
             }
             }
-            _preUpdateOn = DateTime.Now;
-            if (_preMainCoin != this.MainCoinCode) {
-                _preMainCoinShare = 0;
-                _preMainCoinRejectShare = 0;
-            }
-            else {
-                _preMainCoinShare = this.MainCoinTotalShare;
-                _preMainCoinRejectShare = this.MainCoinRejectShare;
-            }
-            _preMainCoin = this.MainCoinCode;
-            if (_preDualCoin != this.DualCoinCode) {
-                _preDualCoinShare = 0;
-                _preDualCoinRejectShare = 0;
-            }
-            else {
-                _preDualCoinShare = this.DualCoinTotalShare;
-                _preDualCoinRejectShare = this.DualCoinRejectShare;
-            }
-            _preDualCoin = this.DualCoinCode;
             #region MinerData
             #region MinerData
             if (!isMinerDataChanged) {
             if (!isMinerDataChanged) {
                 isMinerDataChanged = this.ClientId != speedDto.ClientId;
                 isMinerDataChanged = this.ClientId != speedDto.ClientId;
@@ -697,7 +682,6 @@ namespace NTMiner.Core.MinerServer {
             this.KernelSelfRestartCount = speedDto.KernelSelfRestartCount - 1;// 需要减1
             this.KernelSelfRestartCount = speedDto.KernelSelfRestartCount - 1;// 需要减1
             this.LocalServerMessageTimestamp = speedDto.LocalServerMessageTimestamp;
             this.LocalServerMessageTimestamp = speedDto.LocalServerMessageTimestamp;
             this.TotalPhysicalMemoryMb = speedDto.TotalPhysicalMemoryMb;
             this.TotalPhysicalMemoryMb = speedDto.TotalPhysicalMemoryMb;
-            this.MinerActiveOn = DateTime.Now;// 现在时间
             this.IsAutoDisableWindowsFirewall = speedDto.IsAutoDisableWindowsFirewall;
             this.IsAutoDisableWindowsFirewall = speedDto.IsAutoDisableWindowsFirewall;
             this.IsDisableAntiSpyware = speedDto.IsDisableAntiSpyware;
             this.IsDisableAntiSpyware = speedDto.IsDisableAntiSpyware;
             this.IsDisableUAC = speedDto.IsDisableUAC;
             this.IsDisableUAC = speedDto.IsDisableUAC;

+ 1 - 0
src/NTMinerDataSchemas/Core/MinerServer/IMinerData.cs

@@ -4,6 +4,7 @@ namespace NTMiner.Core.MinerServer {
     public interface IMinerData : IMinerSign, IMinerIp {
     public interface IMinerData : IMinerSign, IMinerIp {
         string WorkerName { get; }
         string WorkerName { get; }
         DateTime CreatedOn { get; }
         DateTime CreatedOn { get; }
+        // TODO:考虑增加MinerActiveOn和NetActiveOn属性持久跟踪挖矿端和挖矿端群控的活动状态以实现周期清楚7天不活跃的矿机的逻辑
         Guid GroupId { get; }
         Guid GroupId { get; }
         string CpuId { get; }
         string CpuId { get; }
         string MACAddress { get; }
         string MACAddress { get; }

+ 0 - 21
src/NTMinerDataSchemas/Gpus/GpuNameCountExtensions.cs

@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace NTMiner.Gpus {
-    public static class GpuNameCountExtensions {
-        public static IGpuName GetMatchGpuName(this IGpuNameCount gpuNameCount, IEnumerable<IGpuName> gpuNames) {
-            if (gpuNames == null) {
-                return null;
-            }
-            gpuNames = gpuNames.OrderByDescending(a => a.Name);
-            foreach (var gpuName in gpuNames) {
-                if (GpuName.ConvertToGb(gpuName.TotalMemory) == GpuName.ConvertToGb(gpuNameCount.TotalMemory) 
-                    && gpuNameCount.Name.IndexOf(gpuName.Name, StringComparison.OrdinalIgnoreCase) != -1) {
-                    return gpuName;
-                }
-            }
-            return null;
-        }
-    }
-}

+ 6 - 3
src/NTMinerDataSchemas/NTMinerDataSchemas.csproj

@@ -9,9 +9,10 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>NTMinerDataSchemas</AssemblyName>
     <AssemblyName>NTMinerDataSchemas</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -21,6 +22,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -29,13 +31,14 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="LiteDB, Version=4.1.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
     <Reference Include="LiteDB, Version=4.1.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
       <HintPath>..\..\packages\LiteDB.4.1.4\lib\net40\LiteDB.dll</HintPath>
       <HintPath>..\..\packages\LiteDB.4.1.4\lib\net40\LiteDB.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
   </ItemGroup>
   </ItemGroup>
@@ -46,7 +49,6 @@
     <Compile Include="Gpus\GpuExtensions.cs" />
     <Compile Include="Gpus\GpuExtensions.cs" />
     <Compile Include="Gpus\GpuName.cs" />
     <Compile Include="Gpus\GpuName.cs" />
     <Compile Include="Gpus\GpuNameCount.cs" />
     <Compile Include="Gpus\GpuNameCount.cs" />
-    <Compile Include="Gpus\GpuNameCountExtensions.cs" />
     <Compile Include="Gpus\IGpu.cs" />
     <Compile Include="Gpus\IGpu.cs" />
     <Compile Include="Gpus\IGpuName.cs" />
     <Compile Include="Gpus\IGpuName.cs" />
     <Compile Include="Gpus\IGpuNameCount.cs" />
     <Compile Include="Gpus\IGpuNameCount.cs" />
@@ -92,6 +94,7 @@
     <Compile Include="Core\OperationResultDto.cs" />
     <Compile Include="Core\OperationResultDto.cs" />
     <Compile Include="Core\OperationResultData.cs" />
     <Compile Include="Core\OperationResultData.cs" />
     <Compile Include="Core\Profile\WorkIgnoreAttribute.cs" />
     <Compile Include="Core\Profile\WorkIgnoreAttribute.cs" />
+    <Compile Include="SetBase.cs" />
     <Compile Include="TypeExtensions.cs" />
     <Compile Include="TypeExtensions.cs" />
     <Compile Include="User\ITryLoginTimes.cs" />
     <Compile Include="User\ITryLoginTimes.cs" />
     <Compile Include="User\IWsUserName.cs" />
     <Compile Include="User\IWsUserName.cs" />

+ 22 - 0
src/NTMinerDataSchemas/SetBase.cs

@@ -0,0 +1,22 @@
+namespace NTMiner {
+    public abstract class SetBase {
+        private bool _isInited = false;
+        private readonly object _locker = new object();
+        protected void InitOnece() {
+            if (!_isInited) {
+                lock (_locker) {
+                    if (!_isInited) {
+                        Init();
+                        _isInited = true;
+                    }
+                }
+            }
+        }
+
+        protected void Refresh() {
+            _isInited = false;
+        }
+
+        protected abstract void Init();
+    }
+}

+ 1 - 1
src/NTMinerDataSchemas/packages.config

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
   <package id="LiteDB" version="4.1.4" targetFramework="net40" />
   <package id="LiteDB" version="4.1.4" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
 </packages>
 </packages>

+ 4 - 1
src/NTMinerGpus/NTMinerGpus.csproj

@@ -9,9 +9,10 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>NTMinerGpus</AssemblyName>
     <AssemblyName>NTMinerGpus</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -21,6 +22,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -29,6 +31,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System" />

+ 4 - 1
src/NTMinerHub/NTMinerHub.csproj

@@ -9,9 +9,10 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>NTMinerHub</AssemblyName>
     <AssemblyName>NTMinerHub</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -21,6 +22,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -29,6 +31,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System" />

+ 5 - 2
src/NTMinerLogging/NTMinerLogging.csproj

@@ -9,9 +9,10 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>NTMinerLogging</AssemblyName>
     <AssemblyName>NTMinerLogging</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -21,6 +22,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <DebugType>pdbonly</DebugType>
@@ -29,10 +31,11 @@
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
     <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\log4net.2.0.12\lib\net40\log4net.dll</HintPath>
+      <HintPath>..\..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Configuration" />

+ 1 - 1
src/NTMinerLogging/packages.config

@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
-  <package id="log4net" version="2.0.12" targetFramework="net40" />
+  <package id="log4net" version="2.0.12" targetFramework="net45" />
 </packages>
 </packages>

+ 1 - 1
src/NTMinerNoDevFee/FodyWeavers.xml

@@ -1,3 +1,3 @@
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
 <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <Costura />
+  <Costura IncludeDebugSymbols="false" DisableCompression="false" />
 </Weavers>
 </Weavers>

+ 22 - 10
src/NTMinerNoDevFee/NTMinerNoDevFee.csproj

@@ -9,11 +9,12 @@
     <OutputType>WinExe</OutputType>
     <OutputType>WinExe</OutputType>
     <RootNamespace>NTMiner</RootNamespace>
     <RootNamespace>NTMiner</RootNamespace>
     <AssemblyName>NTMinerNoDevFee</AssemblyName>
     <AssemblyName>NTMinerNoDevFee</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>false</Deterministic>
     <Deterministic>false</Deterministic>
     <NuGetPackageImportStamp>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -25,6 +26,7 @@
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -35,6 +37,7 @@
     <ErrorReport>prompt</ErrorReport>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup />
   <PropertyGroup />
   <PropertyGroup>
   <PropertyGroup>
@@ -49,23 +52,25 @@
       <HintPath>..\..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
       <HintPath>..\..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
     <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\log4net.2.0.12\lib\net40\log4net.dll</HintPath>
+      <HintPath>..\..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Management" />
     <Reference Include="System.Management" />
-    <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+    <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
     </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -160,6 +165,9 @@
   <ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="NoDevFee\WinDivert64.sys" />
     <EmbeddedResource Include="NoDevFee\WinDivert64.sys" />
     <None Include="app.config" />
     <None Include="app.config" />
+    <None Include="FodyWeavers.xsd">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="packages.config" />
     <None Include="packages.config" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
@@ -175,7 +183,9 @@
       <Name>NTMinerLogging</Name>
       <Name>NTMinerLogging</Name>
     </ProjectReference>
     </ProjectReference>
   </ItemGroup>
   </ItemGroup>
-  <ItemGroup />
+  <ItemGroup>
+    <Content Include="FodyWeavers.xml" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
   <PropertyGroup>
     <PostBuildEvent>$(TargetName) --sha1</PostBuildEvent>
     <PostBuildEvent>$(TargetName) --sha1</PostBuildEvent>
@@ -186,6 +196,8 @@
     </PropertyGroup>
     </PropertyGroup>
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Fody.6.3.0\build\Fody.targets'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
     <Error Condition="!Exists('..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
+    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
   </Target>
   </Target>
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
   <Import Project="..\..\packages\Fody.6.3.0\build\Fody.targets" Condition="Exists('..\..\packages\Fody.6.3.0\build\Fody.targets')" />
+  <Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
 </Project>
 </Project>

+ 2 - 1
src/NTMinerNoDevFee/app.config

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
   <runtime>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
       <dependentAssembly>
@@ -8,4 +9,4 @@
       </dependentAssembly>
       </dependentAssembly>
     </assemblyBinding>
     </assemblyBinding>
   </runtime>
   </runtime>
-</configuration>
+</configuration>

+ 6 - 4
src/NTMinerNoDevFee/packages.config

@@ -2,8 +2,10 @@
 <packages>
 <packages>
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Costura.Fody" version="4.1.0" targetFramework="net40" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
   <package id="Fody" version="6.3.0" targetFramework="net40" developmentDependency="true" />
-  <package id="log4net" version="2.0.12" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" />
+  <package id="log4net" version="2.0.12" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net45" />
+  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
+  <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
 </packages>
 </packages>

+ 24 - 39
src/NTMinerRpcClient/Impl/KernelOutputKeywordSet.cs

@@ -7,7 +7,7 @@ using System.Linq;
 using System.Text;
 using System.Text;
 
 
 namespace NTMiner.Impl {
 namespace NTMiner.Impl {
-    public class KernelOutputKeywordSet : IKernelOutputKeywordSet {
+    public class KernelOutputKeywordSet : SetBase, IKernelOutputKeywordSet {
         private readonly Dictionary<Guid, KernelOutputKeywordData> _dicById = new Dictionary<Guid, KernelOutputKeywordData>();
         private readonly Dictionary<Guid, KernelOutputKeywordData> _dicById = new Dictionary<Guid, KernelOutputKeywordData>();
         private readonly Dictionary<Guid, List<IKernelOutputKeyword>> _dicByKernelOutputId = new Dictionary<Guid, List<IKernelOutputKeyword>>();
         private readonly Dictionary<Guid, List<IKernelOutputKeyword>> _dicByKernelOutputId = new Dictionary<Guid, List<IKernelOutputKeyword>>();
         private readonly string _connectionString;
         private readonly string _connectionString;
@@ -172,49 +172,34 @@ namespace NTMiner.Impl {
             }
             }
         }
         }
 
 
-        private bool _isInited = false;
-        private readonly object _locker = new object();
-
-        private void InitOnece() {
-            if (_isInited) {
-                return;
-            }
-            Init();
-        }
-
-        private void Init() {
-            lock (_locker) {
-                if (!_isInited) {
-                    if (!_isServer) {
-                        foreach (var item in GetServerKernelOutputKeywordsFromCache()) {
-                            if (!_dicById.ContainsKey(item.GetId())) {
-                                item.SetDataLevel(DataLevel.Global);
-                                _dicById.Add(item.GetId(), item);
-                                if (!_dicByKernelOutputId.TryGetValue(item.KernelOutputId, out List<IKernelOutputKeyword> list)) {
-                                    list = new List<IKernelOutputKeyword>();
-                                    _dicByKernelOutputId.Add(item.KernelOutputId, list);
-                                }
-                                list.Add(item);
-                            }
+        protected override void Init() {
+            if (!_isServer) {
+                foreach (var item in GetServerKernelOutputKeywordsFromCache()) {
+                    if (!_dicById.ContainsKey(item.GetId())) {
+                        item.SetDataLevel(DataLevel.Global);
+                        _dicById.Add(item.GetId(), item);
+                        if (!_dicByKernelOutputId.TryGetValue(item.KernelOutputId, out List<IKernelOutputKeyword> list)) {
+                            list = new List<IKernelOutputKeyword>();
+                            _dicByKernelOutputId.Add(item.KernelOutputId, list);
                         }
                         }
+                        list.Add(item);
                     }
                     }
-                    if (_isServer || !DevMode.IsDevMode) {
-                        using (LiteDatabase db = new LiteDatabase(_connectionString)) {
-                            var col = db.GetCollection<KernelOutputKeywordData>();
-                            foreach (var item in col.FindAll()) {
-                                if (!_dicById.ContainsKey(item.GetId())) {
-                                    item.SetDataLevel(DataLevel.Profile);
-                                    _dicById.Add(item.GetId(), item);
-                                    if (!_dicByKernelOutputId.TryGetValue(item.KernelOutputId, out List<IKernelOutputKeyword> list)) {
-                                        list = new List<IKernelOutputKeyword>();
-                                        _dicByKernelOutputId.Add(item.KernelOutputId, list);
-                                    }
-                                    list.Add(item);
-                                }
+                }
+            }
+            if (_isServer || !DevMode.IsDevMode) {
+                using (LiteDatabase db = new LiteDatabase(_connectionString)) {
+                    var col = db.GetCollection<KernelOutputKeywordData>();
+                    foreach (var item in col.FindAll()) {
+                        if (!_dicById.ContainsKey(item.GetId())) {
+                            item.SetDataLevel(DataLevel.Profile);
+                            _dicById.Add(item.GetId(), item);
+                            if (!_dicByKernelOutputId.TryGetValue(item.KernelOutputId, out List<IKernelOutputKeyword> list)) {
+                                list = new List<IKernelOutputKeyword>();
+                                _dicByKernelOutputId.Add(item.KernelOutputId, list);
                             }
                             }
+                            list.Add(item);
                         }
                         }
                     }
                     }
-                    _isInited = true;
                 }
                 }
             }
             }
         }
         }

部分文件因为文件数量过多而无法显示