Skip to content

Commit

Permalink
FileArchiveStyleFactory - Extracted from FileTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot committed Feb 28, 2017
1 parent 29f8734 commit 45b8254
Show file tree
Hide file tree
Showing 17 changed files with 1,044 additions and 872 deletions.
7 changes: 2 additions & 5 deletions src/NLog/Internal/FileInfoExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,16 @@ public static DateTime GetLastWriteTimeUtc(this FileInfo fileInfo)
#if !SILVERLIGHT
return fileInfo.LastWriteTimeUtc;
#else
return fileInfo.LastWriteTime;
return fileInfo.LastWriteTime.ToUniversalTime();
#endif
}
public static DateTime GetCreationTimeUtc(this FileInfo fileInfo)
{
#if !SILVERLIGHT
return fileInfo.CreationTimeUtc;
#else
return fileInfo.CreationTime;
return fileInfo.CreationTime.ToUniversalTime();
#endif
}



}
}
1 change: 1 addition & 0 deletions src/NLog/NLog.Xamarin.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.Xamarin.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.doc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.netfx35.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.netfx40.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
4 changes: 2 additions & 2 deletions src/NLog/NLog.netfx45.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
<FileAlignment>512</FileAlignment>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NLog.snk</AssemblyOriginatorKeyFile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<TargetFrameworkProfile></TargetFrameworkProfile>
<StyleCopTargetsFile>$(MSBuildExtensionsPath)\Microsoft\StyleCop\v4.4\Microsoft.StyleCop.Targets</StyleCopTargetsFile>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down Expand Up @@ -384,6 +383,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.sl4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.sl5.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.wp7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.wp71.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/NLog/NLog.wp8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@
<Compile Include="Targets\EventLogTarget.cs" />
<Compile Include="Targets\EventLogTargetOverflowAction.cs" />
<Compile Include="Targets\FileArchivePeriod.cs" />
<Compile Include="Targets\FileArchiveStyleFactory.cs" />
<Compile Include="Targets\FilePathKind.cs" />
<Compile Include="Targets\FileTarget.cs" />
<Compile Include="Targets\IFileCompressor.cs" />
Expand Down
4 changes: 1 addition & 3 deletions src/NLog/Targets/DateAndSequenceArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ namespace NLog.Targets
internal class DateAndSequenceArchive
{
private readonly string _dateFormat;
private readonly string _formattedDate;

/// <summary>
/// The full name of the archive file.
Expand All @@ -65,7 +64,7 @@ internal class DateAndSequenceArchive
/// <returns><c>True</c> if the formatted dates are equal, otherwise <c>False</c>.</returns>
public bool HasSameFormattedDate(DateTime date)
{
return date.ToString(_dateFormat) == _formattedDate;
return string.Equals(date.ToString(_dateFormat), Date.ToString(_dateFormat), StringComparison.Ordinal);
}

/// <summary>
Expand All @@ -80,7 +79,6 @@ public DateAndSequenceArchive(string fileName, DateTime date, string dateFormat,
_dateFormat = dateFormat;
Sequence = sequence;
FileName = fileName;
_formattedDate = date.ToString(dateFormat);
}
}
}
Loading

0 comments on commit 45b8254

Please sign in to comment.