diff options
Diffstat (limited to 'Analizator9000')
-rw-r--r-- | Analizator9000/Analizator9000/Accumulator.cs | 12 | ||||
-rw-r--r-- | Analizator9000/Analizator9000/Analizator9000.csproj | 6 | ||||
-rw-r--r-- | Analizator9000/Analizator9000/Contract.cs | 24 | ||||
-rw-r--r-- | Analizator9000/Analizator9000/Form1.Designer.cs | 24 | ||||
-rw-r--r-- | Analizator9000/Analizator9000/Form1.cs | 4 | ||||
-rw-r--r-- | Analizator9000/Analizator9000/Form1.resx | 12 | ||||
-rw-r--r-- | Analizator9000/Analizator9000/app.config | 3 |
7 files changed, 57 insertions, 28 deletions
diff --git a/Analizator9000/Analizator9000/Accumulator.cs b/Analizator9000/Analizator9000/Accumulator.cs index 304954d..303b718 100644 --- a/Analizator9000/Analizator9000/Accumulator.cs +++ b/Analizator9000/Analizator9000/Accumulator.cs @@ -17,7 +17,7 @@ namespace Analizator9000 private StreamWriter outputFile;
private String filename;
- public Accumulator(String[] deals, List<Tuple<int, int>> contracts, Form1 form)
+ public Accumulator(String[] deals, List<Contract> contracts, Form1 form)
{
this.deals = new Stack<String>(deals);
this.toAnalyze = deals.LongLength;
@@ -28,7 +28,7 @@ namespace Analizator9000 this.sums.Add(den, new Dictionary<int,long[]>());
for (int hand = 0; hand < BCalcWrapper.table.Length; hand++)
{
- if (contracts.Contains(new Tuple<int, int>(den, hand)))
+ if (contracts.Contains(new Contract(den, hand)))
{
this.sums[den].Add(hand, new long[] { 0, 0, 0 });
}
@@ -39,13 +39,13 @@ namespace Analizator9000 }
}
this.contracts = new Dictionary<int, List<int>>();
- foreach (Tuple<int, int> contract in contracts)
+ foreach (Contract contract in contracts)
{
- if (!this.contracts.ContainsKey(contract.Item1))
+ if (!this.contracts.ContainsKey(contract.Denomination))
{
- this.contracts.Add(contract.Item1, new List<int>());
+ this.contracts.Add(contract.Denomination, new List<int>());
}
- this.contracts[contract.Item1].Add(contract.Item2);
+ this.contracts[contract.Denomination].Add(contract.Declarer);
}
this.filename = Utils.getFilename("result");
this.outputFile = new StreamWriter(@"files\"+this.filename);
diff --git a/Analizator9000/Analizator9000/Analizator9000.csproj b/Analizator9000/Analizator9000/Analizator9000.csproj index 35d5ed5..89dafd7 100644 --- a/Analizator9000/Analizator9000/Analizator9000.csproj +++ b/Analizator9000/Analizator9000/Analizator9000.csproj @@ -10,7 +10,7 @@ <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Analizator9000</RootNamespace>
<AssemblyName>Analizator9000</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
@@ -57,7 +57,6 @@ <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.Deployment" />
<Reference Include="System.Drawing" />
@@ -67,6 +66,7 @@ <ItemGroup>
<Compile Include="Accumulator.cs" />
<Compile Include="BCalcWrapper.cs" />
+ <Compile Include="Contract.cs" />
<Compile Include="DealerParser.cs" />
<Compile Include="DealerWrapper.cs" />
<Compile Include="Form1.cs">
@@ -89,7 +89,9 @@ <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
+ <DesignTime>True</DesignTime>
</Compile>
+ <None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
diff --git a/Analizator9000/Analizator9000/Contract.cs b/Analizator9000/Analizator9000/Contract.cs new file mode 100644 index 0000000..f603ecd --- /dev/null +++ b/Analizator9000/Analizator9000/Contract.cs @@ -0,0 +1,24 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Analizator9000
+{
+ class Contract: IEquatable<Contract>
+ {
+ public int Denomination;
+ public int Declarer;
+
+ public Contract(int denom, int decl)
+ {
+ this.Denomination = denom;
+ this.Declarer = decl;
+ }
+
+ public bool Equals(Contract other)
+ {
+ return this.Denomination == other.Denomination && this.Declarer == other.Declarer;
+ }
+ }
+}
diff --git a/Analizator9000/Analizator9000/Form1.Designer.cs b/Analizator9000/Analizator9000/Form1.Designer.cs index 1654277..0222834 100644 --- a/Analizator9000/Analizator9000/Form1.Designer.cs +++ b/Analizator9000/Analizator9000/Form1.Designer.cs @@ -96,6 +96,7 @@ this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
+ this.button3 = new System.Windows.Forms.Button();
this.analyzeButton = new System.Windows.Forms.Button();
this.label13 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
@@ -106,7 +107,6 @@ this.analyzeFileDialog = new System.Windows.Forms.OpenFileDialog();
this.resultTextBox = new System.Windows.Forms.TextBox();
this.abortButton = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
this.generateGroup.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.analyzeGroup.SuspendLayout();
@@ -893,6 +893,17 @@ this.label22.Text = "W:";
this.label22.Click += new System.EventHandler(this.label22_Click);
//
+ // button3
+ //
+ this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.button3.Location = new System.Drawing.Point(13, 3);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(18, 16);
+ this.button3.TabIndex = 31;
+ this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
+ //
// analyzeButton
//
this.analyzeButton.Location = new System.Drawing.Point(226, 47);
@@ -974,17 +985,6 @@ this.abortButton.UseVisualStyleBackColor = true;
this.abortButton.Click += new System.EventHandler(this.abortButton_Click);
//
- // button3
- //
- this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.button3.Location = new System.Drawing.Point(13, 3);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(18, 16);
- this.button3.TabIndex = 31;
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
diff --git a/Analizator9000/Analizator9000/Form1.cs b/Analizator9000/Analizator9000/Form1.cs index 8747c68..14b33aa 100644 --- a/Analizator9000/Analizator9000/Form1.cs +++ b/Analizator9000/Analizator9000/Form1.cs @@ -192,14 +192,14 @@ namespace Analizator9000 try
{
String[] deals = File.ReadAllLines(analyzeFileNameTextBox.Text);
- List<Tuple<int, int>> cons = new List<Tuple<int,int>>();
+ List<Contract> cons = new List<Contract>();
foreach (int i in Enumerable.Range(1, 5))
{
foreach (int j in Enumerable.Range(1, 4))
{
if (((CheckBox)contractTable.GetControlFromPosition(i, j)).Checked)
{
- cons.Add(new Tuple<int, int>(5 - i, j - 1));
+ cons.Add(new Contract(5 - i, j - 1));
}
}
}
diff --git a/Analizator9000/Analizator9000/Form1.resx b/Analizator9000/Analizator9000/Form1.resx index b153991..6e15622 100644 --- a/Analizator9000/Analizator9000/Form1.resx +++ b/Analizator9000/Analizator9000/Form1.resx @@ -112,21 +112,21 @@ <value>2.0</value>
</resheader>
<resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <metadata name="generateFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <metadata name="generateFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
- <metadata name="analyzeFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <metadata name="analyzeFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>171, 17</value>
</metadata>
- <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
- <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAoAAAAAAAEACAAoJAEApgAAADAwAAABAAgAqA4AAM4kAQAgIAAAAQAIAKgIAAB2MwEAGBgAAAEA
diff --git a/Analizator9000/Analizator9000/app.config b/Analizator9000/Analizator9000/app.config new file mode 100644 index 0000000..809fa1f --- /dev/null +++ b/Analizator9000/Analizator9000/app.config @@ -0,0 +1,3 @@ +<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v2.0.50727" sku="Client"/></startup></configuration>
|