diff --git a/HtmlAgilityPack.dll b/HtmlAgilityPack.dll
new file mode 100644
index 0000000..0563eea
Binary files /dev/null and b/HtmlAgilityPack.dll differ
diff --git a/Newtonsoft.Json.dll b/Newtonsoft.Json.dll
new file mode 100644
index 0000000..81639f9
Binary files /dev/null and b/Newtonsoft.Json.dll differ
diff --git a/RedditRandomNumberGiveawayHelper/FodyWeavers.xml b/RedditRandomNumberGiveawayHelper/FodyWeavers.xml
new file mode 100644
index 0000000..2e6d4a7
--- /dev/null
+++ b/RedditRandomNumberGiveawayHelper/FodyWeavers.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/RedditRandomNumberGiveawayHelper/MainForm.Designer.cs b/RedditRandomNumberGiveawayHelper/MainForm.Designer.cs
index afe3ebe..a67f254 100644
--- a/RedditRandomNumberGiveawayHelper/MainForm.Designer.cs
+++ b/RedditRandomNumberGiveawayHelper/MainForm.Designer.cs
@@ -30,12 +30,12 @@
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
+ this.randomMax = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.randomMax)).BeginInit();
this.SuspendLayout();
//
// label1
@@ -54,23 +54,23 @@
this.textBox1.Size = new System.Drawing.Size(463, 20);
this.textBox1.TabIndex = 1;
//
- // numericUpDown1
+ // randomMax
//
- this.numericUpDown1.Location = new System.Drawing.Point(118, 39);
- this.numericUpDown1.Maximum = new decimal(new int[] {
+ this.randomMax.Location = new System.Drawing.Point(118, 39);
+ this.randomMax.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
- this.numericUpDown1.Minimum = new decimal(new int[] {
+ this.randomMax.Minimum = new decimal(new int[] {
1,
0,
0,
0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(115, 20);
- this.numericUpDown1.TabIndex = 2;
- this.numericUpDown1.Value = new decimal(new int[] {
+ this.randomMax.Name = "randomMax";
+ this.randomMax.Size = new System.Drawing.Size(115, 20);
+ this.randomMax.TabIndex = 2;
+ this.randomMax.Value = new decimal(new int[] {
5000,
0,
0,
@@ -113,7 +113,7 @@
this.label3.TabIndex = 6;
this.label3.Text = "Result";
//
- // Form1
+ // MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -122,12 +122,13 @@
this.Controls.Add(this.textBox2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
- this.Controls.Add(this.numericUpDown1);
+ this.Controls.Add(this.randomMax);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
- this.Name = "Form1";
- this.Text = "Form1";
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.Name = "MainForm";
+ this.Text = "Reddit random giveaway helper";
+ ((System.ComponentModel.ISupportInitialize)(this.randomMax)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -137,7 +138,7 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.NumericUpDown numericUpDown1;
+ private System.Windows.Forms.NumericUpDown randomMax;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox2;
diff --git a/RedditRandomNumberGiveawayHelper/MainForm.cs b/RedditRandomNumberGiveawayHelper/MainForm.cs
index e21f50e..6bc9d05 100644
--- a/RedditRandomNumberGiveawayHelper/MainForm.cs
+++ b/RedditRandomNumberGiveawayHelper/MainForm.cs
@@ -60,7 +60,7 @@ namespace RedditRandomNumberGiveawayHelper
textBox2.Text += string.Format("{1}{0}",
Environment.NewLine,
"Getting random number from random.org...");
- WebRequest randomDotOrgRequest = WebRequest.Create(string.Format(RANDOM_ORG_URI, decimal.Round(numericUpDown1.Value, 0)));
+ WebRequest randomDotOrgRequest = WebRequest.Create(string.Format(RANDOM_ORG_URI, decimal.Round(randomMax.Value, 0)));
using (WebResponse resp = randomDotOrgRequest.GetResponse())
{
using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
@@ -90,11 +90,12 @@ namespace RedditRandomNumberGiveawayHelper
int? winningNumVal = null;
int? diff = null;
- for (int i = 0; (winningNumKey == null && winningNumVal == null) && randomNumber + i < decimal.Round(numericUpDown1.Value, 0); i++)
+ for (int i = 0; (winningNumKey == null && winningNumVal == null) && (randomNumber + i < decimal.Round(randomMax.Value, 0) || randomNumber - i > 0); i++)
{
foreach (var x in nums)
{
- if (x.Value == randomNumber + i || x.Value == randomNumber - i)
+ if ((x.Value == randomNumber + i && randomNumber + i < decimal.Round(randomMax.Value, 0))
+ || (x.Value == randomNumber - i && randomNumber - i > 0))
{
winningNumKey = x.Key;
winningNumVal = x.Value;
diff --git a/RedditRandomNumberGiveawayHelper/RedditRandomNumberGiveawayHelper.csproj b/RedditRandomNumberGiveawayHelper/RedditRandomNumberGiveawayHelper.csproj
index cb9c494..9f14623 100644
--- a/RedditRandomNumberGiveawayHelper/RedditRandomNumberGiveawayHelper.csproj
+++ b/RedditRandomNumberGiveawayHelper/RedditRandomNumberGiveawayHelper.csproj
@@ -12,6 +12,7 @@
v4.5.1
512
true
+ 652f1da7
AnyCPU
@@ -66,6 +67,7 @@
True
Resources.resx
+
SettingsSingleFileGenerator
Settings.Designer.cs
@@ -85,7 +87,54 @@
RedditSharp
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+();
+var attribute = config.Attribute("ExcludeAssemblies");
+if (attribute != null)
+ foreach (var item in attribute.Value.Split('|').Select(x => x.Trim()).Where(x => x != string.Empty))
+ excludedAssemblies.Add(item);
+var element = config.Element("ExcludeAssemblies");
+if (element != null)
+ foreach (var item in element.Value.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).Where(x => x != string.Empty))
+ excludedAssemblies.Add(item);
+
+var filesToCleanup = Files.Select(f => f.ItemSpec).Where(f => !excludedAssemblies.Contains(Path.GetFileNameWithoutExtension(f), StringComparer.InvariantCultureIgnoreCase));
+
+foreach (var item in filesToCleanup)
+ File.Delete(item);
+]]>
+
+
+
+
+