Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ Thumbs.db
*\TestResults
*\updater.exe
*.orig
packages/
packages/
FeedBuilder/FeedBuilder.xml
50 changes: 45 additions & 5 deletions FeedBuilder/FeedBuilder.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
Expand All @@ -12,7 +12,7 @@
<AssemblyName>FeedBuilder</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<NoWarn>1591</NoWarn>
Expand All @@ -25,6 +25,7 @@
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>FeedBuilder.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -35,6 +36,7 @@
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>FeedBuilder.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
Expand Down Expand Up @@ -63,6 +65,7 @@
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DefineTrace>true</DefineTrace>
Expand All @@ -73,18 +76,34 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="NAppUpdate.Framework">
<HintPath>..\src\NAppUpdate.Framework\bin\Release\net35\NAppUpdate.Framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.Linq, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive.Windows.Forms, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.Windows.Forms.3.1.1\lib\net46\System.Reactive.Windows.Forms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ArgumentsParser.cs" />
Expand All @@ -98,6 +117,12 @@
<DependentUpon>frmMain.cs</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="frmWait.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmWait.Designer.cs">
<DependentUpon>frmWait.cs</DependentUpon>
</Compile>
<Compile Include="HelpfulTextBox.cs">
<SubType>Component</SubType>
</Compile>
Expand Down Expand Up @@ -133,13 +158,17 @@
<EmbeddedResource Include="frmMain.resx">
<DependentUpon>frmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmWait.resx">
<DependentUpon>frmWait.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand All @@ -149,6 +178,17 @@
<ItemGroup>
<Content Include="component.ico" />
<Content Include="Readme.txt" />
<None Include="Resources\ajax-loader.gif" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FileIcons\FileIcons.vbproj">
<Project>{3637b716-7eee-4a84-b6b9-982c4d8a39a6}</Project>
<Name>FileIcons</Name>
</ProjectReference>
<ProjectReference Include="..\src\NAppUpdate.Framework\NAppUpdate.Framework.csproj">
<Project>{5c07ebdf-d43f-4be9-b560-d7a443c0edce}</Project>
<Name>NAppUpdate.Framework</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
171 changes: 0 additions & 171 deletions FeedBuilder/FeedBuilder.xml

This file was deleted.

1 change: 1 addition & 0 deletions FeedBuilder/FeedBuilderSettingsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using FeedBuilder.Properties;

namespace FeedBuilder
{
Expand Down
33 changes: 29 additions & 4 deletions FeedBuilder/FileInfoEx.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Diagnostics;
using System.IO;
using NAppUpdate.Framework.Utils;

namespace FeedBuilder
{
Expand All @@ -24,18 +24,43 @@ public string Hash
{
get { return myHash; }
}
private static readonly string[] SizeSuffixes =
{ "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
public string getFileSize(int decimalPlaces = 1)
{
long value = myFileInfo.Length;
if (value == 0) { return "0.0 bytes"; }

// mag is 0 for bytes, 1 for KB, 2, for MB, etc.
int mag = (int)Math.Log(value, 1024);

// 1L << (mag * 10) == 2 ^ (10 * mag)
// [i.e. the number of bytes in the unit corresponding to mag]
decimal adjustedSize = (decimal)value / (1L << (mag * 10));

// make adjustment when the value is large enough that
// it would round up to 1000 or more
if (Math.Round(adjustedSize, decimalPlaces) >= 1000)
{
mag += 1;
adjustedSize /= 1024;
}

return $"{adjustedSize.ToString("n" + decimalPlaces.ToString())} {SizeSuffixes[mag]}";
}

public string RelativeName { get; private set; }

public FileInfoEx(string fileName, int rootDirLength)
{
myFileInfo = new FileInfo(fileName);
var verInfo = FileVersionInfo.GetVersionInfo(fileName);
if (myFileVersion == null)
myFileVersion = new System.Version(verInfo.FileMajorPart, verInfo.FileMinorPart, verInfo.FileBuildPart, verInfo.FilePrivatePart).ToString();
myFileVersion = new Version(verInfo.FileMajorPart, verInfo.FileMinorPart, verInfo.FileBuildPart, verInfo.FilePrivatePart).ToString();
RelativeName = fileName.Substring(rootDirLength);
while (RelativeName.StartsWith(@"\"))
RelativeName = RelativeName.Substring(1);//Just in case the file name starts with a \
myHash = NAppUpdate.Framework.Utils.FileChecksum.GetSHA256Checksum(fileName);

RelativeName = fileName.Substring(rootDirLength);
}
}
}
Loading