Skip to content

Commit 4c5ca79

Browse files
committed
switch to windows forms, add isGolden field
1 parent c9af180 commit 4c5ca79

File tree

8 files changed

+284
-40
lines changed

8 files changed

+284
-40
lines changed

HearthstoneCollectionExporter.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
44
VisualStudioVersion = 14.0.25420.1
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HearthstoneCollectionExporter", "HearthstoneCollectionExporter\HearthstoneCollectionExporter.csproj", "{9223DFCA-84FA-4D6A-A864-F1B40EE0F449}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HearthstoneCollectionExporter", "HearthstoneCollectionExporter\HearthstoneCollectionExporter.csproj", "{EFCCD9D5-B163-4C9F-A654-11B39A9E3BF2}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{9223DFCA-84FA-4D6A-A864-F1B40EE0F449}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{9223DFCA-84FA-4D6A-A864-F1B40EE0F449}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{9223DFCA-84FA-4D6A-A864-F1B40EE0F449}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{9223DFCA-84FA-4D6A-A864-F1B40EE0F449}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{EFCCD9D5-B163-4C9F-A654-11B39A9E3BF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{EFCCD9D5-B163-4C9F-A654-11B39A9E3BF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{EFCCD9D5-B163-4C9F-A654-11B39A9E3BF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{EFCCD9D5-B163-4C9F-A654-11B39A9E3BF2}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE
Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
2+
using System.Windows.Forms;
63
using System.IO;
74
using HearthMirror;
85
using static HearthMirror.Enums.MirrorStatus;
96

107
namespace HearthstoneCollectionExporter
118
{
12-
class MainClass
9+
static class HearthstoneCollectionExporter
1310
{
14-
static void Main(string[] args)
11+
/// <summary>
12+
/// The main entry point for the application.
13+
/// </summary>
14+
[STAThread]
15+
static void Main()
1516
{
1617
var status = HearthMirror.Status.GetStatus().MirrorStatus;
1718
if (status == Ok)
1819
{
19-
Console.WriteLine("Found Hearthstone process.");
20+
// Found Hearthstone process, attempting to get cards and write them to CSV.
21+
var collection = Reflection.GetCollection();
22+
23+
using (var w = new StreamWriter("cards.csv"))
24+
{
25+
var header = "cardId,isGolden,cardCount";
26+
w.WriteLine(header);
27+
28+
foreach (var card in collection)
29+
{
30+
var cardId = card.Id;
31+
var cardCount = card.Count;
32+
var isGolden = card.Premium;
33+
var newLine = string.Format("{0},{1},{2}", cardId, isGolden, cardCount);
34+
w.WriteLine(newLine);
35+
w.Flush();
36+
}
37+
}
38+
MessageBox.Show("Finished exporting cards to cards.csv.", "Success");
39+
2040
}
2141
else if (status == ProcNotFound)
2242
{
23-
Console.WriteLine("Unable to find Hearthstone process.");
24-
Environment.Exit(0);
43+
MessageBox.Show("Unable to find Hearthstone the process.", "Error");
2544
}
2645
else if (status == Error)
2746
{
28-
Console.WriteLine("There was a problem finding the Hearthstone process.");
29-
Environment.Exit(0);
47+
MessageBox.Show("There was a problem finding the Hearthstone process.", "Error");
3048
}
31-
32-
var collection = Reflection.GetCollection();
33-
34-
using (var w = new StreamWriter("cards.csv"))
35-
{
36-
var header = "cardId,cardCount";
37-
w.WriteLine(header);
38-
39-
foreach (var card in collection)
40-
{
41-
var cardId = card.Id;
42-
var cardCount = card.Count;
43-
var newLine = string.Format("{0},{1}", cardId, cardCount);
44-
w.WriteLine(newLine);
45-
w.Flush();
46-
}
47-
}
48-
49-
Console.WriteLine("Finished exporting cards to cards.csv.");
5049
}
5150
}
5251
}

HearthstoneCollectionExporter/HearthstoneCollectionExporter.csproj

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{9223DFCA-84FA-4D6A-A864-F1B40EE0F449}</ProjectGuid>
8-
<OutputType>Exe</OutputType>
7+
<ProjectGuid>{EFCCD9D5-B163-4C9F-A654-11B39A9E3BF2}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>HearthstoneCollectionExporter</RootNamespace>
1111
<AssemblyName>HearthstoneCollectionExporter</AssemblyName>
@@ -33,8 +33,7 @@
3333
<WarningLevel>4</WarningLevel>
3434
</PropertyGroup>
3535
<ItemGroup>
36-
<Reference Include="HearthMirror, Version=7.0.0.15590, Culture=neutral, processorArchitecture=x86">
37-
<SpecificVersion>False</SpecificVersion>
36+
<Reference Include="HearthMirror">
3837
<HintPath>lib\HearthMirror.dll</HintPath>
3938
</Reference>
4039
<Reference Include="System" />
@@ -43,12 +42,33 @@
4342
<Reference Include="System.Data.DataSetExtensions" />
4443
<Reference Include="Microsoft.CSharp" />
4544
<Reference Include="System.Data" />
45+
<Reference Include="System.Deployment" />
46+
<Reference Include="System.Drawing" />
4647
<Reference Include="System.Net.Http" />
48+
<Reference Include="System.Windows.Forms" />
4749
<Reference Include="System.Xml" />
4850
</ItemGroup>
4951
<ItemGroup>
5052
<Compile Include="HearthstoneCollectionExporter.cs" />
5153
<Compile Include="Properties\AssemblyInfo.cs" />
54+
<EmbeddedResource Include="Properties\Resources.resx">
55+
<Generator>ResXFileCodeGenerator</Generator>
56+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
57+
<SubType>Designer</SubType>
58+
</EmbeddedResource>
59+
<Compile Include="Properties\Resources.Designer.cs">
60+
<AutoGen>True</AutoGen>
61+
<DependentUpon>Resources.resx</DependentUpon>
62+
</Compile>
63+
<None Include="Properties\Settings.settings">
64+
<Generator>SettingsSingleFileGenerator</Generator>
65+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
66+
</None>
67+
<Compile Include="Properties\Settings.Designer.cs">
68+
<AutoGen>True</AutoGen>
69+
<DependentUpon>Settings.settings</DependentUpon>
70+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
71+
</Compile>
5272
</ItemGroup>
5373
<ItemGroup>
5474
<None Include="App.config" />

HearthstoneCollectionExporter/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[assembly: ComVisible(false)]
2121

2222
// The following GUID is for the ID of the typelib if this project is exposed to COM
23-
[assembly: Guid("9223dfca-84fa-4d6a-a864-f1b40ee0f449")]
23+
[assembly: Guid("efccd9d5-b163-4c9f-a654-11b39a9e3bf2")]
2424

2525
// Version information for an assembly consists of the following four values:
2626
//

HearthstoneCollectionExporter/Properties/Resources.Designer.cs

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:element name="root" msdata:IsDataSet="true">
64+
<xsd:complexType>
65+
<xsd:choice maxOccurs="unbounded">
66+
<xsd:element name="metadata">
67+
<xsd:complexType>
68+
<xsd:sequence>
69+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
70+
</xsd:sequence>
71+
<xsd:attribute name="name" type="xsd:string" />
72+
<xsd:attribute name="type" type="xsd:string" />
73+
<xsd:attribute name="mimetype" type="xsd:string" />
74+
</xsd:complexType>
75+
</xsd:element>
76+
<xsd:element name="assembly">
77+
<xsd:complexType>
78+
<xsd:attribute name="alias" type="xsd:string" />
79+
<xsd:attribute name="name" type="xsd:string" />
80+
</xsd:complexType>
81+
</xsd:element>
82+
<xsd:element name="data">
83+
<xsd:complexType>
84+
<xsd:sequence>
85+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
86+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
87+
</xsd:sequence>
88+
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
89+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
90+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
91+
</xsd:complexType>
92+
</xsd:element>
93+
<xsd:element name="resheader">
94+
<xsd:complexType>
95+
<xsd:sequence>
96+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
97+
</xsd:sequence>
98+
<xsd:attribute name="name" type="xsd:string" use="required" />
99+
</xsd:complexType>
100+
</xsd:element>
101+
</xsd:choice>
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:schema>
105+
<resheader name="resmimetype">
106+
<value>text/microsoft-resx</value>
107+
</resheader>
108+
<resheader name="version">
109+
<value>2.0</value>
110+
</resheader>
111+
<resheader name="reader">
112+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
113+
</resheader>
114+
<resheader name="writer">
115+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
</root>

HearthstoneCollectionExporter/Properties/Settings.Designer.cs

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
3+
<Profiles>
4+
<Profile Name="(Default)" />
5+
</Profiles>
6+
<Settings />
7+
</SettingsFile>

0 commit comments

Comments
 (0)