-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHtmlFileExporter.cs
52 lines (41 loc) · 1.31 KB
/
HtmlFileExporter.cs
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#region
using System;
using System.Collections.Generic;
using System.IO;
using HtmlExport.Properties;
using Tabster.Data;
using Tabster.Data.Processing;
#endregion
namespace HtmlExport
{
public class HtmlFileExporter : ITablatureFileExporter
{
public HtmlFileExporter()
{
FileType = new FileType("HTML File", new[] {".html", ".htm"});
}
#region Implementation of ITablatureFileExporter
public FileType FileType { get; private set; }
public Version Version
{
get { return new Version("1.0"); }
}
public void Export(ITablatureFile file, string fileName, TablatureFileExportArguments args)
{
var templates = new Dictionary<string, string>
{
{"{TAB_ARTIST}", file.Artist},
{"{TAB_TITLE}", file.Title},
{"{TAB_TYPE}", file.Type.ToFriendlyString()},
{"{TAB_CONTENTS}", file.Contents}
};
var html = Resources.Html_Template;
foreach (var templatePair in templates)
{
html = html.Replace(templatePair.Key, templatePair.Value);
}
File.WriteAllText(fileName, html);
}
#endregion
}
}