Skip to content

Commit

Permalink
Initial commit V1
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSwine committed Aug 22, 2017
1 parent 6563d87 commit 85c6128
Show file tree
Hide file tree
Showing 130 changed files with 104,189 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
25 changes: 25 additions & 0 deletions CodeSwine-Solo_Public_Lobby/CodeSwine-Private_Public_Lobby.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.8
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeSwine-Private_Public_Lobby", "CodeSwine-Solo_Public_Lobby\CodeSwine-Private_Public_Lobby.csproj", "{8568F1E3-880F-4CAC-819D-40D1A4D3D863}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8568F1E3-880F-4CAC-819D-40D1A4D3D863}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8568F1E3-880F-4CAC-819D-40D1A4D3D863}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8568F1E3-880F-4CAC-819D-40D1A4D3D863}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8568F1E3-880F-4CAC-819D-40D1A4D3D863}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E5EAABC1-CA50-429B-A02A-A78AC5EED8F0}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="CodeSwine_Solo_Public_Lobby.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CodeSwine_Solo_Public_Lobby"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace CodeSwine_Solo_Public_Lobby
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?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>{8568F1E3-880F-4CAC-819D-40D1A4D3D863}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CodeSwine_Solo_Public_Lobby</RootNamespace>
<AssemblyName>CodeSwine-Solo_Public_Lobby</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>D:\Downloads\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</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>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>C2F190854D8F6F14FA1C9ACDF545758AFD208C57</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>CodeSwine-Solo_Public_Lobby_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="DataAccess\DaWhitelist.cs" />
<Compile Include="Helpers\ColorBrush.cs" />
<Compile Include="Helpers\FirewallRule.cs" />
<Compile Include="Helpers\IPTool.cs" />
<Compile Include="Helpers\RangeCalculator.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Models\MWhitelist.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="CodeSwine-Private_Public_Lobby_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<COMReference Include="NetFwTypeLib">
<Guid>{58FBCF7C-E7A9-467C-80B3-FC65E8FCCA08}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Resource Include="icon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="ImageResources\wireless.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="ImageResources\gears.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="ImageResources\help.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="ImageResources\locked.png" />
<Resource Include="ImageResources\unlocked.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="ImageResources\add.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="ImageResources\Github.png" />
<Resource Include="ImageResources\trash.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="ImageResources\mpgh.PNG" />
</ItemGroup>
<ItemGroup>
<Resource Include="ImageResources\5mods.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using CodeSwine_Solo_Public_Lobby.Helpers;
using CodeSwine_Solo_Public_Lobby.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;

namespace CodeSwine_Solo_Public_Lobby.DataAccess
{
public class DaWhitelist
{
public IPTool iPTool = new IPTool();
private bool useWhitelist;
private string iPCount;

public DaWhitelist()
{
ReadIPsFromJSON();
}

public List<IPAddress> IpAddressess {
get { return ReadIPsFromJSON(); }
}

public string IPCount {
get { return iPCount; }
}

public bool UseWhitelist {
get { return useWhitelist; }
set { useWhitelist = value; }
}

List<IPAddress> ReadIPsFromJSON()
{
List<IPAddress> addresses = new List<IPAddress>();

string path = Environment.ExpandEnvironmentVariables(AppDomain.CurrentDomain.BaseDirectory + "settings.json");

string json = "";

if(!File.Exists(path))
{
SaveToJson(new MWhitelist());
}

using (StreamReader r = new StreamReader(path))
{
json = r.ReadToEnd();
}

MWhitelist whitelist = JsonConvert.DeserializeObject<MWhitelist>(json);

foreach (string address in whitelist.Ips)
{
if(iPTool.ValidateIPv4(address.ToString())) addresses.Add(IPAddress.Parse(address));
}

iPCount = addresses.Count.ToString();
return addresses;
}

public static void SaveToJson(MWhitelist whitelist)
{
string json = JsonConvert.SerializeObject(whitelist);
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "settings.json", json);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Windows.Media;

namespace CodeSwine_Solo_Public_Lobby.Helpers
{
public class ColorBrush
{
public static SolidColorBrush Red {
get { return new SolidColorBrush(Color.FromArgb(255, (byte)220, (byte)53, (byte)69)); }
}

public static SolidColorBrush Blue {
get { return new SolidColorBrush(Color.FromArgb(255, (byte)0, (byte)123, (byte)255)); }
}

public static SolidColorBrush Green {
get { return new SolidColorBrush(Color.FromArgb(255, (byte)40, (byte)167, (byte)69)); }
}

public static SolidColorBrush Yellow {
get { return new SolidColorBrush(Color.FromArgb(255, (byte)255, (byte)193, (byte)7)); }
}
}
}
Loading

0 comments on commit 85c6128

Please sign in to comment.