Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
riQQ committed Nov 1, 2015
1 parent 29c8179 commit 24e27fb
Show file tree
Hide file tree
Showing 23 changed files with 1,458 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.suo
*.user
bin
obj
packages
22 changes: 22 additions & 0 deletions Hearth Arena Uploader.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hearth Arena Uploader", "Hearth Arena Uploader\Hearth Arena Uploader.csproj", "{A650CB40-DE4E-4500-8FF5-1B18863FA228}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A650CB40-DE4E-4500-8FF5-1B18863FA228}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A650CB40-DE4E-4500-8FF5-1B18863FA228}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A650CB40-DE4E-4500-8FF5-1B18863FA228}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A650CB40-DE4E-4500-8FF5-1B18863FA228}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
58 changes: 58 additions & 0 deletions Hearth Arena Uploader/Data/ArenaRewards.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
namespace HearthArenaUploader.Data
{
public class ArenaRewards
{
public ArenaRewards(int gold, int dust, int packs, int standardCards, int goldenCards)
{
this.gold = gold;
this.dust = dust;
this.packs = packs;
this.standardCards = standardCards;
this.goldenCards = goldenCards;
}

private int gold;
public int Gold
{
get { return gold; }
set { gold = value; }
}

private int dust;

public int Dust
{
get { return dust; }
set { dust = value; }
}


private int packs;

public int Packs
{
get { return packs; }
set { packs = value; }
}


private int standardCards;

public int StandardCards
{
get { return standardCards; }
set { standardCards = value; }
}


private int goldenCards;

public int GoldenCards
{
get { return goldenCards; }
set { goldenCards = value; }
}


}
}
15 changes: 15 additions & 0 deletions Hearth Arena Uploader/Data/HearthArenaClass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace HearthArenaUploader.Data
{
public enum HearthArenaClass
{
Druid = 1,
Hunter = 2,
Mage = 3,
Paladin = 4,
Priest = 5,
Rogue = 6,
Shaman = 7,
Warlock = 8,
Warrior = 9,
}
}
37 changes: 37 additions & 0 deletions Hearth Arena Uploader/Data/Result.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HearthArenaUploader.Data
{
public class Result<ResultDataType, ResultType>
{
public Result(ResultDataType resultData, ResultType outcome, string errorMessage)
{
ResultData = resultData;
Outcome = outcome;
ErrorMessage = errorMessage;
}

public ResultDataType ResultData { get; private set; }

public ResultType Outcome { get; private set; }

public string ErrorMessage { get; private set; }
}

public class Result<ResultType>
{
public Result(ResultType outcome, string errorMessage)
{
Outcome = outcome;
ErrorMessage = errorMessage;
}

public ResultType Outcome { get; private set; }

public string ErrorMessage { get; private set; }
}
}
17 changes: 17 additions & 0 deletions Hearth Arena Uploader/Data/UploadResults.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HearthArenaUploader.Data
{
public enum UploadResults
{
Success,
LoginFailedCredentialsWrong,
LoginFailedUnknownError,
SubmittingArenaRunFailedUnknownError,
ConnectionError
}
}
64 changes: 64 additions & 0 deletions Hearth Arena Uploader/Encryption.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Text;

namespace HearthArenaUploader
{
public class Encryption
{
static byte[] entropy = Encoding.Unicode.GetBytes("Salt Is Not A Password");

public static string EncryptString(SecureString input)
{
byte[] encryptedData = ProtectedData.Protect(
Encoding.Unicode.GetBytes(ToInsecureString(input)),
entropy,
DataProtectionScope.CurrentUser);
return Convert.ToBase64String(encryptedData);
}

public static SecureString DecryptString(string encryptedData)
{
try
{
byte[] decryptedData = ProtectedData.Unprotect(
Convert.FromBase64String(encryptedData),
entropy,
DataProtectionScope.CurrentUser);
return ToSecureString(Encoding.Unicode.GetString(decryptedData));
}
catch
{
return new SecureString();
}
}

public static SecureString ToSecureString(string input)
{
SecureString secure = new SecureString();
foreach (char c in input)
{
secure.AppendChar(c);
}
secure.MakeReadOnly();
return secure;
}

public static string ToInsecureString(SecureString input)
{
string returnValue = string.Empty;
IntPtr ptr = Marshal.SecureStringToBSTR(input);
try
{
returnValue = Marshal.PtrToStringBSTR(ptr);
}
finally
{
Marshal.ZeroFreeBSTR(ptr);
}
return returnValue;
}
}
}
146 changes: 146 additions & 0 deletions Hearth Arena Uploader/Hearth Arena Uploader.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{A650CB40-DE4E-4500-8FF5-1B18863FA228}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HearthArenaUploader</RootNamespace>
<AssemblyName>Hearth Arena Uploader</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</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>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'HDTandPlugins|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Hearthstone-Deck-TrackerPlugins\Hearthstone Deck Tracker\bin\HDTandPlugins\Plugins\HearthArenaUploader\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="HtmlAgilityPack, Version=1.4.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\..\Hearthstone-Deck-TrackerPlugins\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MahApps.Metro, Version=1.1.2.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
<HintPath>..\..\Hearthstone-Deck-TrackerPlugins\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Security" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\Hearthstone-Deck-TrackerPlugins\packages\MahApps.Metro.1.1.2.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<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.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Compile Include="Data\UploadResults.cs" />
<Compile Include="Data\Result.cs" />
<Compile Include="View\GoldenCardsConverter.cs" />
<Compile Include="View\CardsConverter.cs" />
<Compile Include="View\PacksConverter.cs" />
<Compile Include="View\SettingsWindow.xaml.cs">
<DependentUpon>SettingsWindow.xaml</DependentUpon>
</Compile>
<Page Include="View\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="Data\ArenaRewards.cs" />
<Compile Include="HearthArenaUploaderLogic.cs" />
<Compile Include="Encryption.cs" />
<Compile Include="Data\HearthArenaClass.cs" />
<Compile Include="HearthArenaUploaderPlugin.cs" />
<Compile Include="View\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="View\SettingsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="PluginSettings.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="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Hearthstone-Deck-TrackerPlugins\Hearthstone Deck Tracker\Hearthstone Deck Tracker.csproj">
<Project>{e63a3f1c-e662-4e62-be43-af27cb9e953d}</Project>
<Name>Hearthstone Deck Tracker</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading

0 comments on commit 24e27fb

Please sign in to comment.