Skip to content

Commit

Permalink
fixed the dll missing error and checking if last change is null
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidlemon committed May 3, 2016
1 parent 5dc0039 commit b340810
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
1 change: 1 addition & 0 deletions PraiseTheSave.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Global
{889E2248-74DA-4DC4-B802-0D64E34F0748}.Debug|Any CPU.Build.0 = Debug|Any CPU
{889E2248-74DA-4DC4-B802-0D64E34F0748}.Release|Any CPU.ActiveCfg = Release|Any CPU
{889E2248-74DA-4DC4-B802-0D64E34F0748}.Release|Any CPU.Build.0 = Release|Any CPU
{889E2248-74DA-4DC4-B802-0D64E34F0748}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 5 additions & 0 deletions PraiseTheSave/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura/>

</Weavers>
32 changes: 29 additions & 3 deletions PraiseTheSave/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ private FileInfo getOldestFileInDir(DirectoryInfo dir)
return dir.GetFiles().OrderByDescending(f => f.LastWriteTime).Last();
}

public bool IsDirectoryEmpty(string path)
{
return !Directory.EnumerateFileSystemEntries(path).Any();
}


private void Form1_Load(object sender, EventArgs e)
{
Expand Down Expand Up @@ -195,7 +200,14 @@ public void doBackup(object sender, EventArgs e)
if (!Directory.Exists(ds1destination))
Directory.CreateDirectory(ds1destination);

if (PraiseTheSave.Properties.Settings.Default.LastDS1Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds1save)).FullName))
DateTime? lastDS1Change = PraiseTheSave.Properties.Settings.Default.LastDS1Change;
if (
IsDirectoryEmpty(ds1destination)
||
!lastDS1Change.HasValue
||
PraiseTheSave.Properties.Settings.Default.LastDS1Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds1save)).FullName)
)
{
while (PraiseTheSave.Properties.Settings.Default.SaveAmount <= Directory.GetFiles(ds1destination).Length)
{
Expand All @@ -220,7 +232,14 @@ public void doBackup(object sender, EventArgs e)
if (!Directory.Exists(ds2destination))
Directory.CreateDirectory(ds2destination);

if (PraiseTheSave.Properties.Settings.Default.LastDS2Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds2save)).FullName))
DateTime? lastDS2Change = PraiseTheSave.Properties.Settings.Default.LastDS2Change;
if (
IsDirectoryEmpty(ds2destination)
||
!lastDS2Change.HasValue
||
PraiseTheSave.Properties.Settings.Default.LastDS2Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds2save)).FullName)
)
{

while (PraiseTheSave.Properties.Settings.Default.SaveAmount <= Directory.GetFiles(ds2destination).Length)
Expand All @@ -246,7 +265,14 @@ public void doBackup(object sender, EventArgs e)
if (!Directory.Exists(ds3destination))
Directory.CreateDirectory(ds3destination);

if (PraiseTheSave.Properties.Settings.Default.LastDS3Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds3save)).FullName))
DateTime? lastDS3Change = PraiseTheSave.Properties.Settings.Default.LastDS3Change;
if (
IsDirectoryEmpty(ds3destination)
||
!lastDS3Change.HasValue
||
PraiseTheSave.Properties.Settings.Default.LastDS3Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds3save)).FullName)
)
{

while (PraiseTheSave.Properties.Settings.Default.SaveAmount <= Directory.GetFiles(ds3destination).Length)
Expand Down
12 changes: 11 additions & 1 deletion PraiseTheSave/PraiseTheSave.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
<InstallUrl>https://github.com/lucidlemon/PraiseTheSave/</InstallUrl>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -133,9 +135,17 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml" />
<Content Include="sunbro_logo.ico" />
</ItemGroup>
<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. Use 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>
<!-- 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.
<Target Name="BeforeBuild">
Expand Down
2 changes: 2 additions & 0 deletions PraiseTheSave/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="1.3.3.0" targetFramework="net452" developmentDependency="true" />
<package id="DotNetZip" version="1.9.8" targetFramework="net452" />
<package id="Fody" version="1.28.3" targetFramework="net452" developmentDependency="true" />
</packages>

0 comments on commit b340810

Please # to comment.