-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathOpenLiveWriterPostGenerator.cs
More file actions
31 lines (21 loc) · 898 Bytes
/
Copy pathOpenLiveWriterPostGenerator.cs
File metadata and controls
31 lines (21 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using OpenLiveWriter.CoreServices;
using OpenLiveWriter.Extensibility.BlogClient;
using OpenLiveWriter.PostEditor;
using System.Reflection;
namespace OpenLiveWriterPost;
internal class OpenLiveWriterPostGenerator
{
public static void SavePost(BlogPost post, string filePath)
{
SavePostAsStructuredStorage(post, filePath);
}
private static void SavePostAsStructuredStorage(BlogPost post, string filePath)
{
ApplicationEnvironment.Initialize(Assembly.GetExecutingAssembly(),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"\Windows Live\Writer\"));
PostEditorFile.Initialize();
PostEditorFile pef = PostEditorFile.CreateNew(new DirectoryInfo(Path.GetDirectoryName(filePath)));
var bef = new BlogPostEditingContext(post.Id, post);
pef.SaveBlogPost(bef);
}
}