Added missing dlls and Costura.Fody for dll embeding

This commit is contained in:
gardient
2015-08-29 00:36:51 +03:00
parent ff2456d32f
commit 808d9dc7e5
7 changed files with 80 additions and 19 deletions

BIN
HtmlAgilityPack.dll Normal file

Binary file not shown.

BIN
Newtonsoft.Json.dll Normal file

Binary file not shown.

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura/>
</Weavers>

View File

@@ -30,12 +30,12 @@
{ {
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox(); 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.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.randomMax)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
@@ -54,23 +54,23 @@
this.textBox1.Size = new System.Drawing.Size(463, 20); this.textBox1.Size = new System.Drawing.Size(463, 20);
this.textBox1.TabIndex = 1; this.textBox1.TabIndex = 1;
// //
// numericUpDown1 // randomMax
// //
this.numericUpDown1.Location = new System.Drawing.Point(118, 39); this.randomMax.Location = new System.Drawing.Point(118, 39);
this.numericUpDown1.Maximum = new decimal(new int[] { this.randomMax.Maximum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
0}); 0});
this.numericUpDown1.Minimum = new decimal(new int[] { this.randomMax.Minimum = new decimal(new int[] {
1, 1,
0, 0,
0, 0,
0}); 0});
this.numericUpDown1.Name = "numericUpDown1"; this.randomMax.Name = "randomMax";
this.numericUpDown1.Size = new System.Drawing.Size(115, 20); this.randomMax.Size = new System.Drawing.Size(115, 20);
this.numericUpDown1.TabIndex = 2; this.randomMax.TabIndex = 2;
this.numericUpDown1.Value = new decimal(new int[] { this.randomMax.Value = new decimal(new int[] {
5000, 5000,
0, 0,
0, 0,
@@ -113,7 +113,7 @@
this.label3.TabIndex = 6; this.label3.TabIndex = 6;
this.label3.Text = "Result"; this.label3.Text = "Result";
// //
// Form1 // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -122,12 +122,13 @@
this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox2);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.numericUpDown1); this.Controls.Add(this.randomMax);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Name = "Form1"; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Text = "Form1"; this.Name = "MainForm";
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); this.Text = "Reddit random giveaway helper";
((System.ComponentModel.ISupportInitialize)(this.randomMax)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -137,7 +138,7 @@
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1; 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.Label label2;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox2;

View File

@@ -60,7 +60,7 @@ namespace RedditRandomNumberGiveawayHelper
textBox2.Text += string.Format("{1}{0}", textBox2.Text += string.Format("{1}{0}",
Environment.NewLine, Environment.NewLine,
"Getting random number from random.org..."); "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 (WebResponse resp = randomDotOrgRequest.GetResponse())
{ {
using (StreamReader sr = new StreamReader(resp.GetResponseStream())) using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
@@ -90,11 +90,12 @@ namespace RedditRandomNumberGiveawayHelper
int? winningNumVal = null; int? winningNumVal = null;
int? diff = 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) 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; winningNumKey = x.Key;
winningNumVal = x.Value; winningNumVal = x.Value;

View File

@@ -12,6 +12,7 @@
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>652f1da7</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -66,6 +67,7 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -85,7 +87,54 @@
<Name>RedditSharp</Name> <Name>RedditSharp</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.1.28.3\build\Fody.targets" Condition="Exists('..\packages\Fody.1.28.3\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.1.28.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.28.3\build\Fody.targets'))" />
</Target>
<UsingTask TaskName="CosturaCleanup" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" TaskFactory="CodeTaskFactory">
<ParameterGroup>
<Config Output="false" Required="true" ParameterType="Microsoft.Build.Framework.ITaskItem" />
<Files Output="false" Required="true" ParameterType="Microsoft.Build.Framework.ITaskItem[]" />
</ParameterGroup>
<Task Evaluate="true">
<Reference xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Include="System.Xml" />
<Reference xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Include="System.Xml.Linq" />
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System" />
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.IO" />
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.Xml.Linq" />
<Code xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Type="Fragment" Language="cs">
<![CDATA[
var config = XElement.Load(Config.ItemSpec).Elements("Costura").FirstOrDefault();
if (config == null) return true;
var excludedAssemblies = new List<string>();
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);
]]>
</Code></Task>
</UsingTask>
<Target Name="CleanReferenceCopyLocalPaths" AfterTargets="AfterBuild;NonWinFodyTarget">
<CosturaCleanup Config="FodyWeavers.xml" Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="1.3.3.0" targetFramework="net451" developmentDependency="true" />
<package id="Fody" version="1.28.3" targetFramework="net451" developmentDependency="true" />
</packages>