Permalink
Browse files

Add a simple project for checking if donation pools are online

  • Loading branch information...
nwoolls committed Dec 24, 2017
1 parent c4003da commit fa7efeb9cc2f24b0fd00f8f060071914a822e014
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4409DA1A-D1C3-4AE9-9AAC-D87C2F84AAA8}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>MultiMiner.PoolChecker</RootNamespace>
<AssemblyName>MultiMiner.PoolChecker</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MultiMiner.Engine\MultiMiner.Engine.csproj">
<Project>{845687bb-ec47-46d3-ac9d-6fcfb63de8f5}</Project>
<Name>MultiMiner.Engine</Name>
</ProjectReference>
<ProjectReference Include="..\MultiMiner.Xgminer\MultiMiner.Xgminer.csproj">
<Project>{0DBEF993-1B34-4D80-AB6A-F662604325DC}</Project>
<Name>MultiMiner.Xgminer</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,58 @@
using MultiMiner.Xgminer.Data;
using MultiMiner.Engine.Helpers;
using MultiMiner.Engine.Data.Configuration;
using System.Collections.Generic;
using System;
using System.Net.Sockets;
namespace MultiMiner.PoolChecker
{
class Program
{
static void Main(string[] args)
{
TimeSpan timeout = new TimeSpan(0, 0, 5);
List<Coin> configurations = new List<Coin>(); ;
DonationPools.Seed(configurations);
foreach (Coin coin in configurations)
{
foreach (MiningPool pool in coin.Pools)
{
Uri uri = new Uri(pool.Host);
if (!IsPortOpen(uri.Host, pool.Port, timeout))
{
Console.WriteLine(String.Format("{0} pool {1} (port {2}) is defunct.", coin.PoolGroup.Id, pool.Host, pool.Port));
}
}
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
private static bool IsPortOpen(string host, int port, TimeSpan timeout)
{
try
{
using (var client = new TcpClient())
{
var result = client.BeginConnect(host, port, null, null);
var success = result.AsyncWaitHandle.WaitOne(timeout);
if (!success)
{
return false;
}
client.EndConnect(result);
}
}
catch
{
return false;
}
return true;
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MultiMiner.PoolChecker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MultiMiner.PoolChecker")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4409da1a-d1c3-4ae9-9aac-d87c2f84aaa8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
View
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22310.1
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiMiner.Xgminer", "MultiMiner.Xgminer\MultiMiner.Xgminer.csproj", "{0DBEF993-1B34-4D80-AB6A-F662604325DC}"
EndProject
@@ -59,6 +59,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiMiner.TUI", "MultiMine
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiMiner.MobileMiner.Embed", "MultiMiner.MobileMiner.Embed\MultiMiner.MobileMiner.Embed.csproj", "{94F1A985-4DB1-46F0-A522-30B3A968E7DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiMiner.PoolChecker", "MultiMiner.PoolChecker\MultiMiner.PoolChecker.csproj", "{4409DA1A-D1C3-4AE9-9AAC-D87C2F84AAA8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -173,6 +175,10 @@ Global
{94F1A985-4DB1-46F0-A522-30B3A968E7DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94F1A985-4DB1-46F0-A522-30B3A968E7DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94F1A985-4DB1-46F0-A522-30B3A968E7DA}.Release|Any CPU.Build.0 = Release|Any CPU
{4409DA1A-D1C3-4AE9-9AAC-D87C2F84AAA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4409DA1A-D1C3-4AE9-9AAC-D87C2F84AAA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4409DA1A-D1C3-4AE9-9AAC-D87C2F84AAA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4409DA1A-D1C3-4AE9-9AAC-D87C2F84AAA8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

0 comments on commit fa7efeb

Please sign in to comment.