forked from wenhelinlu/RTFEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
42 lines (33 loc) · 1.51 KB
/
Program.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
using System.Collections.Generic;
using System.IO;
namespace Rtf2HtmlMod
{
internal static class Program
{
public static void Main(string[] args)
{
//var rtfInput = GetArg(args, 0, "Document.rtf");
//var rtf = File.ReadAllText(rtfInput);
////var xaml = RtfToXamlConverter.RtfToXaml(rtf);
////File.WriteAllText("xaml.xaml", xaml);
////var rtf2 = RtfToXamlConverter.XamlToRtf(xaml);
////File.WriteAllText("rtf2.rtf", rtf2);
////var plainText = RtfToPlaintTextConverter.RtfToPlainText(rtf);
////File.WriteAllText("text.txt", plainText);
//var htmlOutput = GetArg(args, 1, Path.ChangeExtension(rtfInput, ".html"));
//var contentUriPrefix = Path.GetFileNameWithoutExtension(htmlOutput);
//var htmlResult = RtfToHtmlConverter.RtfToHtml(rtf, contentUriPrefix);
//htmlResult.WriteToFile(htmlOutput);
var rtf = File.ReadAllText(@"C:\Users\Administrator\Desktop\test.rtf");
var htmlOutput = @"D:\test12.html";
var contentUriPrefix = Path.GetFileNameWithoutExtension(htmlOutput);
var htmlResult = RtfToHtmlConverter.RtfToHtml(rtf, contentUriPrefix);
htmlResult.WriteToFile(htmlOutput);
}
private static string GetArg(IList<string> args, int index, string defaultValue)
{
if (args == null || args.Count <= index) return defaultValue;
return args[index];
}
}
}