-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRtfFileImporter.cs
50 lines (41 loc) · 1.2 KB
/
RtfFileImporter.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
#region
using System;
using System.Windows.Forms;
using Tabster.Core.Types;
using Tabster.Data;
using Tabster.Data.Processing;
#endregion
namespace RtfFile
{
public class RtfFileImporter : ITablatureFileImporter
{
public RtfFileImporter()
{
FileType = new FileType("Rich Text Format File", ".rtf");
}
#region Implementation of ITablatureDocumentImporter
public FileType FileType { get; private set; }
public Version Version
{
get { return new Version("1.0"); }
}
public AttributedTablature Import(string fileName)
{
using (var rtb = new RichTextBox())
{
rtb.LoadFile(fileName);
var doc = new AttributedTablature {Contents = rtb.Text};
return doc;
}
}
public AttributedTablature Import(string fileName, string artist, string title, TablatureType type)
{
var tab = Import(fileName);
tab.Artist = artist;
tab.Title = title;
tab.Type = type;
return tab;
}
#endregion
}
}