Skip to content

Commit b340810

Browse files
committed
fixed the dll missing error and checking if last change is null
1 parent 5dc0039 commit b340810

File tree

5 files changed

+48
-4
lines changed

5 files changed

+48
-4
lines changed

PraiseTheSave.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Global
1515
{889E2248-74DA-4DC4-B802-0D64E34F0748}.Debug|Any CPU.Build.0 = Debug|Any CPU
1616
{889E2248-74DA-4DC4-B802-0D64E34F0748}.Release|Any CPU.ActiveCfg = Release|Any CPU
1717
{889E2248-74DA-4DC4-B802-0D64E34F0748}.Release|Any CPU.Build.0 = Release|Any CPU
18+
{889E2248-74DA-4DC4-B802-0D64E34F0748}.Release|Any CPU.Deploy.0 = Release|Any CPU
1819
EndGlobalSection
1920
GlobalSection(SolutionProperties) = preSolution
2021
HideSolutionNode = FALSE

PraiseTheSave/FodyWeavers.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Weavers>
3+
<Costura/>
4+
5+
</Weavers>

PraiseTheSave/Form1.cs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ private FileInfo getOldestFileInDir(DirectoryInfo dir)
6868
return dir.GetFiles().OrderByDescending(f => f.LastWriteTime).Last();
6969
}
7070

71+
public bool IsDirectoryEmpty(string path)
72+
{
73+
return !Directory.EnumerateFileSystemEntries(path).Any();
74+
}
75+
7176

7277
private void Form1_Load(object sender, EventArgs e)
7378
{
@@ -195,7 +200,14 @@ public void doBackup(object sender, EventArgs e)
195200
if (!Directory.Exists(ds1destination))
196201
Directory.CreateDirectory(ds1destination);
197202

198-
if (PraiseTheSave.Properties.Settings.Default.LastDS1Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds1save)).FullName))
203+
DateTime? lastDS1Change = PraiseTheSave.Properties.Settings.Default.LastDS1Change;
204+
if (
205+
IsDirectoryEmpty(ds1destination)
206+
||
207+
!lastDS1Change.HasValue
208+
||
209+
PraiseTheSave.Properties.Settings.Default.LastDS1Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds1save)).FullName)
210+
)
199211
{
200212
while (PraiseTheSave.Properties.Settings.Default.SaveAmount <= Directory.GetFiles(ds1destination).Length)
201213
{
@@ -220,7 +232,14 @@ public void doBackup(object sender, EventArgs e)
220232
if (!Directory.Exists(ds2destination))
221233
Directory.CreateDirectory(ds2destination);
222234

223-
if (PraiseTheSave.Properties.Settings.Default.LastDS2Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds2save)).FullName))
235+
DateTime? lastDS2Change = PraiseTheSave.Properties.Settings.Default.LastDS2Change;
236+
if (
237+
IsDirectoryEmpty(ds2destination)
238+
||
239+
!lastDS2Change.HasValue
240+
||
241+
PraiseTheSave.Properties.Settings.Default.LastDS2Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds2save)).FullName)
242+
)
224243
{
225244

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

249-
if (PraiseTheSave.Properties.Settings.Default.LastDS3Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds3save)).FullName))
268+
DateTime? lastDS3Change = PraiseTheSave.Properties.Settings.Default.LastDS3Change;
269+
if (
270+
IsDirectoryEmpty(ds3destination)
271+
||
272+
!lastDS3Change.HasValue
273+
||
274+
PraiseTheSave.Properties.Settings.Default.LastDS3Change != File.GetLastWriteTime(getLatestFileInDir(new DirectoryInfo(ds3save)).FullName)
275+
)
250276
{
251277

252278
while (PraiseTheSave.Properties.Settings.Default.SaveAmount <= Directory.GetFiles(ds3destination).Length)

PraiseTheSave/PraiseTheSave.csproj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
<InstallUrl>https://github.com/lucidlemon/PraiseTheSave/</InstallUrl>
2727
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
2828
<WebPage>publish.htm</WebPage>
29-
<ApplicationRevision>1</ApplicationRevision>
29+
<ApplicationRevision>2</ApplicationRevision>
3030
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
3131
<UseApplicationTrust>false</UseApplicationTrust>
3232
<PublishWizardCompleted>true</PublishWizardCompleted>
3333
<BootstrapperEnabled>true</BootstrapperEnabled>
34+
<NuGetPackageImportStamp>
35+
</NuGetPackageImportStamp>
3436
</PropertyGroup>
3537
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
3638
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -133,9 +135,17 @@
133135
</BootstrapperPackage>
134136
</ItemGroup>
135137
<ItemGroup>
138+
<Content Include="FodyWeavers.xml" />
136139
<Content Include="sunbro_logo.ico" />
137140
</ItemGroup>
138141
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
142+
<Import Project="..\packages\Fody.1.28.3\build\Fody.targets" Condition="Exists('..\packages\Fody.1.28.3\build\Fody.targets')" />
143+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
144+
<PropertyGroup>
145+
<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>
146+
</PropertyGroup>
147+
<Error Condition="!Exists('..\packages\Fody.1.28.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.28.3\build\Fody.targets'))" />
148+
</Target>
139149
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
140150
Other similar extension points exist, see Microsoft.Common.targets.
141151
<Target Name="BeforeBuild">

PraiseTheSave/packages.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="Costura.Fody" version="1.3.3.0" targetFramework="net452" developmentDependency="true" />
34
<package id="DotNetZip" version="1.9.8" targetFramework="net452" />
5+
<package id="Fody" version="1.28.3" targetFramework="net452" developmentDependency="true" />
46
</packages>

0 commit comments

Comments
 (0)