-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e8dd0e
commit 5f93a57
Showing
8 changed files
with
98 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace MailDiary.Filesystem | ||
{ | ||
using System.IO; | ||
using Types.Configuration; | ||
using Types.Mail; | ||
|
||
public class FilesystemHandler | ||
{ | ||
private readonly Configuration _configuration; | ||
|
||
public FilesystemHandler( Configuration config ) | ||
{ | ||
_configuration = config; | ||
} | ||
|
||
public void Save( MailMessage message ) | ||
{ | ||
var subFolder = message.Data.Received.ToString( "yyyy/MM/dd" ); | ||
var completeFolder = Path.Combine( _configuration.MarkdownBasePath, subFolder ); | ||
if ( !Directory.Exists( completeFolder ) ) { | ||
Directory.CreateDirectory( completeFolder ); | ||
} | ||
var filename = message.Data.Received.ToString( "HHmmss" ) + ".md"; | ||
File.WriteAllText( Path.Combine( completeFolder, filename), message.Data.ToMarkdown() ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\MailDiary.Types\MailDiary.Types.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters