├── .gitignore ├── Converter ├── Html │ ├── ConverterHtml2008.csproj │ ├── ConverterHtml2010.csproj │ ├── IRtfHtmlCssStyle.cs │ ├── IRtfHtmlCssStyleCollection.cs │ ├── IRtfHtmlStyle.cs │ ├── IRtfHtmlStyleConverter.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── VersionInfo.cs │ ├── RtfHtmlConvertScope.cs │ ├── RtfHtmlConvertSettings.cs │ ├── RtfHtmlConverter.cs │ ├── RtfHtmlCssStyle.cs │ ├── RtfHtmlCssStyleCollection.cs │ ├── RtfHtmlElementPath.cs │ ├── RtfHtmlSpecialCharCollection.cs │ ├── RtfHtmlStyle.cs │ └── RtfHtmlStyleConverter.cs └── Xml │ ├── ConverterXml2008.csproj │ ├── ConverterXml2010.csproj │ ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs │ ├── RtfXmlConvertSettings.cs │ └── RtfXmlConverter.cs ├── Interpreter ├── Converter │ ├── Image │ │ ├── IRtfConvertedImageInfo.cs │ │ ├── IRtfConvertedImageInfoCollection.cs │ │ ├── IRtfVisualImageAdapter.cs │ │ ├── RtfConvertedImageInfo.cs │ │ ├── RtfConvertedImageInfoCollection.cs │ │ ├── RtfImageConvertSettings.cs │ │ ├── RtfImageConverter.cs │ │ └── RtfVisualImageAdapter.cs │ └── Text │ │ ├── RtfTextConvertSettings.cs │ │ └── RtfTextConverter.cs ├── IRtfColor.cs ├── IRtfColorCollection.cs ├── IRtfDocument.cs ├── IRtfDocumentInfo.cs ├── IRtfDocumentProperty.cs ├── IRtfDocumentPropertyCollection.cs ├── IRtfFont.cs ├── IRtfFontCollection.cs ├── IRtfInterpreter.cs ├── IRtfInterpreterContext.cs ├── IRtfInterpreterListener.cs ├── IRtfTextFormat.cs ├── IRtfTextFormatCollection.cs ├── IRtfVisual.cs ├── IRtfVisualBreak.cs ├── IRtfVisualCollection.cs ├── IRtfVisualImage.cs ├── IRtfVisualSpecialChar.cs ├── IRtfVisualText.cs ├── IRtfVisualVisitor.cs ├── Interpreter │ ├── RtfColorTableBuilder.cs │ ├── RtfDocumentInfoBuilder.cs │ ├── RtfFontBuilder.cs │ ├── RtfFontTableBuilder.cs │ ├── RtfImageBuilder.cs │ ├── RtfInterpreter.cs │ ├── RtfInterpreterBase.cs │ ├── RtfInterpreterContext.cs │ ├── RtfInterpreterListenerBase.cs │ ├── RtfInterpreterListenerDocumentBuilder.cs │ ├── RtfInterpreterListenerFileLogger.cs │ ├── RtfInterpreterListenerLogger.cs │ ├── RtfInterpreterLoggerSettings.cs │ ├── RtfTextBuilder.cs │ ├── RtfTimestampBuilder.cs │ └── RtfUserPropertyBuilder.cs ├── Interpreter2008.csproj ├── Interpreter2010.csproj ├── Model │ ├── RtfColor.cs │ ├── RtfColorCollection.cs │ ├── RtfDocument.cs │ ├── RtfDocumentInfo.cs │ ├── RtfDocumentProperty.cs │ ├── RtfDocumentPropertyCollection.cs │ ├── RtfFont.cs │ ├── RtfFontCollection.cs │ ├── RtfTextFormat.cs │ ├── RtfTextFormatCollection.cs │ ├── RtfVisual.cs │ ├── RtfVisualBreak.cs │ ├── RtfVisualCollection.cs │ ├── RtfVisualImage.cs │ ├── RtfVisualSpecialChar.cs │ └── RtfVisualText.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── RtfColorException.cs ├── RtfColorTableFormatException.cs ├── RtfFontKind.cs ├── RtfFontPitch.cs ├── RtfFontTableFormatException.cs ├── RtfInterpreterException.cs ├── RtfInterpreterState.cs ├── RtfInvalidDataException.cs ├── RtfPropertyKind.cs ├── RtfTextAlignment.cs ├── RtfUndefinedColorException.cs ├── RtfUndefinedFontException.cs ├── RtfUnsupportedStructureException.cs ├── RtfVisualBreakKind.cs ├── RtfVisualImageFormat.cs ├── RtfVisualKind.cs ├── RtfVisualSpecialCharKind.cs ├── Strings.cs ├── Strings.resx └── Support │ ├── RtfElementVisitorBase.cs │ ├── RtfElementVisitorOrder.cs │ ├── RtfInterpreterTool.cs │ └── RtfVisualVisitorBase.cs ├── InterpreterTests ├── ArticleCode.cs ├── InterpreterTests2008.csproj ├── InterpreterTests2010.csproj ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── RtfInterpreterTest.cs ├── RtfInterpreterTest │ ├── RtfInterpreterTest_0.rtf │ ├── RtfInterpreterTest_0.txt │ ├── RtfInterpreterTest_1.rtf │ ├── RtfInterpreterTest_1.txt │ ├── RtfInterpreterTest_10.rtf │ ├── RtfInterpreterTest_10.txt │ ├── RtfInterpreterTest_11.rtf │ ├── RtfInterpreterTest_11.txt │ ├── RtfInterpreterTest_12.rtf │ ├── RtfInterpreterTest_12.txt │ ├── RtfInterpreterTest_13.rtf │ ├── RtfInterpreterTest_13.txt │ ├── RtfInterpreterTest_14.rtf │ ├── RtfInterpreterTest_14.txt │ ├── RtfInterpreterTest_15.rtf │ ├── RtfInterpreterTest_15.txt │ ├── RtfInterpreterTest_16.rtf │ ├── RtfInterpreterTest_16.txt │ ├── RtfInterpreterTest_17.rtf │ ├── RtfInterpreterTest_17.txt │ ├── RtfInterpreterTest_18.rtf │ ├── RtfInterpreterTest_18.txt │ ├── RtfInterpreterTest_19.rtf │ ├── RtfInterpreterTest_19.txt │ ├── RtfInterpreterTest_2.rtf │ ├── RtfInterpreterTest_2.txt │ ├── RtfInterpreterTest_20.rtf │ ├── RtfInterpreterTest_20.txt │ ├── RtfInterpreterTest_21.rtf │ ├── RtfInterpreterTest_21.txt │ ├── RtfInterpreterTest_22.rtf │ ├── RtfInterpreterTest_22.txt │ ├── RtfInterpreterTest_23.rtf │ ├── RtfInterpreterTest_23.txt │ ├── RtfInterpreterTest_3.rtf │ ├── RtfInterpreterTest_3.txt │ ├── RtfInterpreterTest_4.rtf │ ├── RtfInterpreterTest_4.rtf.jpg │ ├── RtfInterpreterTest_4.rtf.jpg.hex │ ├── RtfInterpreterTest_4.txt │ ├── RtfInterpreterTest_5.rtf │ ├── RtfInterpreterTest_5.rtf.png │ ├── RtfInterpreterTest_5.rtf.png.hex │ ├── RtfInterpreterTest_5.txt │ ├── RtfInterpreterTest_6.rtf │ ├── RtfInterpreterTest_6.rtf.wmf │ ├── RtfInterpreterTest_6.rtf.wmf.hex │ ├── RtfInterpreterTest_6.txt │ ├── RtfInterpreterTest_7.rtf │ ├── RtfInterpreterTest_7.rtf.emf │ ├── RtfInterpreterTest_7.rtf.emf.hex │ ├── RtfInterpreterTest_7.txt │ ├── RtfInterpreterTest_8.rtf │ ├── RtfInterpreterTest_8.rtf.wmf │ ├── RtfInterpreterTest_8.rtf.wmf.hex │ ├── RtfInterpreterTest_8.txt │ ├── RtfInterpreterTest_9.rtf │ ├── RtfInterpreterTest_9.txt │ ├── RtfInterpreterTest_fail_0.rtf │ ├── RtfInterpreterTest_fail_1.rtf │ ├── RtfInterpreterTest_fail_2.rtf │ ├── RtfInterpreterTest_fail_3.rtf │ └── RtfInterpreterTest_fail_4.rtf ├── Strings.cs ├── Strings.resx └── app.config ├── MyRTF2HTML.sln ├── MyRTF2HTML ├── MyRTF2HTML.csproj ├── Properties │ └── AssemblyInfo.cs └── RTF2HTML.cs ├── Parser ├── IRtfElement.cs ├── IRtfElementCollection.cs ├── IRtfElementVisitor.cs ├── IRtfGroup.cs ├── IRtfParser.cs ├── IRtfParserListener.cs ├── IRtfSource.cs ├── IRtfTag.cs ├── IRtfText.cs ├── Model │ ├── ReadOnlyBaseCollection.cs │ ├── RtfElement.cs │ ├── RtfElementCollection.cs │ ├── RtfGroup.cs │ ├── RtfTag.cs │ └── RtfText.cs ├── Parser │ ├── RtfParser.cs │ ├── RtfParserBase.cs │ ├── RtfParserListenerBase.cs │ ├── RtfParserListenerFileLogger.cs │ ├── RtfParserListenerLogger.cs │ ├── RtfParserListenerStructureBuilder.cs │ └── RtfParserLoggerSettings.cs ├── Parser2008.csproj ├── Parser2010.csproj ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── RtfBraceNestingException.cs ├── RtfElementKind.cs ├── RtfEmptyDocumentException.cs ├── RtfEncodingException.cs ├── RtfException.cs ├── RtfHexEncodingException.cs ├── RtfMissingCharacterException.cs ├── RtfMultiByteEncodingException.cs ├── RtfParserException.cs ├── RtfSpec.cs ├── RtfStructureException.cs ├── RtfUnicodeEncodingException.cs ├── Strings.cs ├── Strings.resx └── Support │ ├── RtfParserTool.cs │ └── RtfSource.cs ├── ParserTests ├── ParserTests2008.csproj ├── ParserTests2010.csproj ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── RtfParserTest.cs ├── RtfParserTest │ ├── RtfParserTest_0.rtf │ ├── RtfParserTest_1.rtf │ ├── RtfParserTest_2.rtf │ ├── RtfParserTest_3.rtf │ ├── RtfParserTest_4.rtf │ ├── RtfParserTest_5.rtf │ ├── RtfParserTest_6.rtf │ ├── RtfParserTest_7.rtf │ ├── RtfParserTest_8.rtf │ ├── RtfParserTest_fail_0.rtf │ ├── RtfParserTest_fail_1.rtf │ ├── RtfParserTest_fail_2.rtf │ ├── RtfParserTest_fail_3.rtf │ ├── RtfParserTest_fail_4.rtf │ ├── RtfParserTest_fail_5.rtf │ ├── RtfParserTest_fail_6.rtf │ └── minimal.rtf ├── Strings.cs ├── Strings.resx └── app.config ├── ReadMe.txt ├── Rtf2Html ├── App.config ├── Program.cs ├── ProgramSettings.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── Rtf2Html2008.csproj └── Rtf2Html2010.csproj ├── Rtf2Html2008.sln ├── Rtf2Html2010.sln ├── Rtf2Raw ├── App.config ├── Program.cs ├── ProgramSettings.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── Rtf2Raw2008.csproj └── Rtf2Raw2010.csproj ├── Rtf2Raw2008.sln ├── Rtf2Raw2010.sln ├── Rtf2Xml ├── App.config ├── Program.cs ├── ProgramSettings.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── Rtf2Xml2008.csproj └── Rtf2Xml2010.csproj ├── Rtf2Xml2008.sln ├── Rtf2Xml2010.sln ├── RtfInterpreter2008.sln ├── RtfInterpreter2010.sln ├── RtfParser2008.sln ├── RtfParser2010.sln ├── RtfWinForms ├── DefaultText.rtf ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── RtfForm.Designer.cs ├── RtfForm.cs ├── RtfForm.resx ├── RtfWinForms2008.csproj └── RtfWinForms2010.csproj ├── RtfWinForms2008.sln ├── RtfWinForms2010.sln ├── RtfWindows ├── App.xaml ├── App.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── RtfWindow.xaml ├── RtfWindow.xaml.cs ├── RtfWindows2008.csproj └── RtfWindows2010.csproj ├── RtfWindows2008.sln ├── RtfWindows2010.sln ├── Sys ├── Application │ ├── ApplicationArguments.cs │ ├── ApplicationInfo.cs │ ├── Argument.cs │ ├── ArgumentCollection.cs │ ├── ArgumentType.cs │ ├── HelpModeArgument.cs │ ├── IArgument.cs │ ├── NamedValueArgument.cs │ ├── ToggleArgument.cs │ └── ValueArgument.cs ├── ArgumentCheck.cs ├── Collection │ ├── CollectionTool.cs │ ├── IStringCollection.cs │ └── StringCollection.cs ├── CompareTool.cs ├── HashTool.cs ├── Logging │ ├── ILogger.cs │ ├── ILoggerEvent.cs │ ├── ILoggerListener.cs │ ├── ILoggerMonitor.cs │ ├── Logger.cs │ ├── LoggerBase.cs │ ├── LoggerContextDisposable.cs │ ├── LoggerEvent.cs │ ├── LoggerFactory.cs │ ├── LoggerFactoryBuilder.cs │ ├── LoggerFactoryLog4net.cs │ ├── LoggerFactoryNone.cs │ ├── LoggerFactoryTrace.cs │ ├── LoggerImplBase.cs │ ├── LoggerLevel.cs │ ├── LoggerLog4net.cs │ ├── LoggerMonitorAppender.cs │ ├── LoggerMonitorLog4net.cs │ ├── LoggerMonitorNone.cs │ ├── LoggerNone.cs │ ├── LoggerTrace.cs │ └── StringBuilderLogger.cs ├── Properties │ ├── AssemblyInfo.cs │ └── VersionInfo.cs ├── StringTool.cs ├── Strings.cs ├── Strings.resx ├── StringsBase.cs ├── Sys2008.csproj ├── Sys2010.csproj └── Test │ ├── ConsoleRunner.cs │ └── TestUnitBase.cs ├── docu ├── ChangeHistory.txt └── Word2007RTFSpec9.pdf ├── ext ├── log4net.dll ├── nunit-console-runner.dll ├── nunit.core.dll ├── nunit.framework.dll └── nunit.util.dll └── keys └── ItensoRtfConverter.snk /.gitignore: -------------------------------------------------------------------------------- 1 | *.cache 2 | *.FileListAbsolute.txt 3 | *.pdb 4 | *.dll 5 | *.exe 6 | */bin 7 | */obj 8 | */bin/* 9 | */obj/* 10 | bin 11 | obj 12 | *.suo 13 | *.bat 14 | -------------------------------------------------------------------------------- /Converter/Html/IRtfHtmlCssStyle.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfHtmlCssStyle.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.08 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections.Specialized; 10 | 11 | namespace Itenso.Rtf.Converter.Html 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfHtmlCssStyle 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | NameValueCollection Properties { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | string SelectorName { get; } 23 | 24 | } // interface IRtfHtmlCssStyle 25 | 26 | } // namespace Itenso.Rtf.Converter.Html 27 | // -- EOF ------------------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /Converter/Html/IRtfHtmlCssStyleCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfHtmlCssStyleCollection.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.08 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Rtf.Converter.Html 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfHtmlCssStyleCollection : IEnumerable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Count { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | IRtfHtmlCssStyle this[ int index ] { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | bool Contains( string selectorName ); 26 | 27 | // ---------------------------------------------------------------------- 28 | void CopyTo( IRtfHtmlCssStyle[] array, int index ); 29 | 30 | } // interface IRtfHtmlCssStyleCollection 31 | 32 | } // namespace Itenso.Rtf.Converter.Html 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Converter/Html/IRtfHtmlStyle.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfHtmlStyle.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.08 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf.Converter.Html 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfHtmlStyle 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | string ForegroundColor { get; set; } 19 | 20 | // ---------------------------------------------------------------------- 21 | string BackgroundColor { get; set; } 22 | 23 | // ---------------------------------------------------------------------- 24 | string FontFamily { get; set; } 25 | 26 | // ---------------------------------------------------------------------- 27 | string FontSize { get; set; } 28 | 29 | // ---------------------------------------------------------------------- 30 | bool IsEmpty { get; } 31 | 32 | } // interface IRtfHtmlStyle 33 | 34 | } // namespace Itenso.Rtf.Converter.Html 35 | // -- EOF ------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /Converter/Html/IRtfHtmlStyleConverter.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfHtmlStyleConverter.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.07.13 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf.Converter.Html 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfHtmlStyleConverter 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | IRtfHtmlStyle TextToHtml( IRtfVisualText visualText ); 19 | 20 | } // interface IRtfHtmlStyleConverter 21 | 22 | } // namespace Itenso.Rtf.Converter.Html 23 | // -- EOF ------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Converter/Html/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : AssemblyInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.07 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Security.Permissions; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle( "Itenso RTF to HTML Converter" )] 18 | [assembly: AssemblyDescription( "Itenso RTF to HTML Converter" )] 19 | [assembly: AssemblyConfiguration( "" )] 20 | [assembly: AssemblyCompany( "Itenso GmbH" )] 21 | [assembly: AssemblyProduct( "Itenso RTF to HTML Converter" )] 22 | [assembly: AssemblyCopyright( "Copyright © Itenso GmbH 2010" )] 23 | [assembly: AssemblyTrademark( "" )] 24 | [assembly: AssemblyCulture( "" )] 25 | [assembly: ComVisible( false )] 26 | [assembly: SecurityPermission( SecurityAction.RequestMinimum, Assertion = true )] 27 | [assembly: CLSCompliant( true )] 28 | 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /Converter/Html/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.05.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Rtf.Converter.Html 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Rtf.Converter.Html 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Converter/Html/RtfHtmlConvertScope.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfHtmlConvertScope.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.09 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Rtf.Converter.Html 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | [Flags] 16 | public enum RtfHtmlConvertScope 17 | { 18 | None = 0x00000000, 19 | 20 | Document = 0x00000001, 21 | Html = 0x00000010, 22 | Head = 0x00000100, 23 | Body = 0x00001000, 24 | Content = 0x00010000, 25 | 26 | All = Document | Html | Head | Body | Content, 27 | } // class RtfHtmlConvertScope 28 | 29 | } // namespace Itenso.Rtf.Converter.Html 30 | // -- EOF ------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /Converter/Html/RtfHtmlCssStyle.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfHtmlCssStyle.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.08 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Collections.Specialized; 11 | 12 | namespace Itenso.Rtf.Converter.Html 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public class RtfHtmlCssStyle : IRtfHtmlCssStyle 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public RtfHtmlCssStyle( string selectorName ) 21 | { 22 | if ( selectorName == null ) 23 | { 24 | throw new ArgumentNullException( "selectorName" ); 25 | } 26 | this.selectorName = selectorName; 27 | } // RtfHtmlCssStyle 28 | 29 | // ---------------------------------------------------------------------- 30 | public NameValueCollection Properties 31 | { 32 | get { return properties; } 33 | } // Properties 34 | 35 | // ---------------------------------------------------------------------- 36 | public string SelectorName 37 | { 38 | get { return selectorName; } 39 | } // SelectorName 40 | 41 | // ---------------------------------------------------------------------- 42 | // members 43 | private readonly NameValueCollection properties = new NameValueCollection(); 44 | private readonly string selectorName; 45 | 46 | } // class RtfHtmlCssStyle 47 | 48 | } // namespace Itenso.Rtf.Converter.Html 49 | // -- EOF ------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /Converter/Html/RtfHtmlCssStyleCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfHtmlCssStyleCollection.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.08 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Collections; 11 | 12 | namespace Itenso.Rtf.Converter.Html 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public sealed class RtfHtmlCssStyleCollection : ReadOnlyCollectionBase, IRtfHtmlCssStyleCollection 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public IRtfHtmlCssStyle this[ int index ] 21 | { 22 | get { return InnerList[ index ] as RtfHtmlCssStyle; } 23 | } // this[ int ] 24 | 25 | // ---------------------------------------------------------------------- 26 | public bool Contains( string selectorName ) 27 | { 28 | foreach ( IRtfHtmlCssStyle cssStyle in InnerList ) 29 | { 30 | if ( cssStyle.SelectorName.Equals( selectorName ) ) 31 | { 32 | return true; 33 | } 34 | } 35 | return false; 36 | } // Contains 37 | 38 | // ---------------------------------------------------------------------- 39 | public void CopyTo( IRtfHtmlCssStyle[] array, int index ) 40 | { 41 | InnerList.CopyTo( array, index ); 42 | } // CopyTo 43 | 44 | // ---------------------------------------------------------------------- 45 | public void Add( IRtfHtmlCssStyle item ) 46 | { 47 | if ( item == null ) 48 | { 49 | throw new ArgumentNullException( "item" ); 50 | } 51 | InnerList.Add( item ); 52 | } // Add 53 | 54 | // ---------------------------------------------------------------------- 55 | public void Clear() 56 | { 57 | InnerList.Clear(); 58 | } // Clear 59 | 60 | } // class RtfHtmlCssStyleCollection 61 | 62 | } // namespace Itenso.Rtf.Converter.Html 63 | // -- EOF ------------------------------------------------------------------- 64 | -------------------------------------------------------------------------------- /Converter/Html/RtfHtmlStyleConverter.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfHtmlStyleConverter.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.07.13 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Drawing; 11 | 12 | namespace Itenso.Rtf.Converter.Html 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public class RtfHtmlStyleConverter : IRtfHtmlStyleConverter 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public virtual IRtfHtmlStyle TextToHtml( IRtfVisualText visualText ) 21 | { 22 | if ( visualText == null ) 23 | { 24 | throw new ArgumentNullException( "visualText" ); 25 | } 26 | 27 | RtfHtmlStyle htmlStyle = new RtfHtmlStyle(); 28 | 29 | IRtfTextFormat textFormat = visualText.Format; 30 | 31 | // background color 32 | Color backgroundColor = textFormat.BackgroundColor.AsDrawingColor; 33 | if ( backgroundColor.R != 0 || backgroundColor.G != 0 || backgroundColor.B != 0 ) 34 | { 35 | htmlStyle.BackgroundColor = ColorTranslator.ToHtml( backgroundColor ); 36 | } 37 | 38 | // foreground color 39 | Color foregroundColor = textFormat.ForegroundColor.AsDrawingColor; 40 | if ( foregroundColor.R != 0 || foregroundColor.G != 0 || foregroundColor.B != 0 ) 41 | { 42 | htmlStyle.ForegroundColor = ColorTranslator.ToHtml( foregroundColor ); 43 | } 44 | 45 | // font 46 | htmlStyle.FontFamily = textFormat.Font.Name; 47 | if ( textFormat.FontSize > 0 ) 48 | { 49 | htmlStyle.FontSize = (textFormat.FontSize /2) + "pt"; 50 | } 51 | 52 | return htmlStyle; 53 | } // TextToHtml 54 | 55 | } // class GetTextHtmlStyle 56 | 57 | } // namespace Itenso.Rtf.Converter.Html 58 | // -- EOF ------------------------------------------------------------------- 59 | -------------------------------------------------------------------------------- /Converter/Xml/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : AssemblyInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.07 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Security.Permissions; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle( "Itenso RTF to XML Converter" )] 18 | [assembly: AssemblyDescription( "Itenso RTF to XML Converter" )] 19 | [assembly: AssemblyConfiguration( "" )] 20 | [assembly: AssemblyCompany( "Itenso GmbH" )] 21 | [assembly: AssemblyProduct( "Itenso RTF to XML Converter" )] 22 | [assembly: AssemblyCopyright( "Copyright © Itenso GmbH 2010" )] 23 | [assembly: AssemblyTrademark( "" )] 24 | [assembly: AssemblyCulture( "" )] 25 | [assembly: ComVisible( false )] 26 | [assembly: SecurityPermission( SecurityAction.RequestMinimum, Assertion = true )] 27 | [assembly: CLSCompliant( true )] 28 | 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /Converter/Xml/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.05.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Rtf.Converter.Xml 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Rtf.Converter.Xml 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Converter/Xml/RtfXmlConvertSettings.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfXmlConvertSettings.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.10 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf.Converter.Xml 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public class RtfXmlConvertSettings 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | public RtfXmlConvertSettings() 19 | : this( null, null ) 20 | { 21 | } // RtfXmlConvertSettings 22 | 23 | // ---------------------------------------------------------------------- 24 | public RtfXmlConvertSettings( string ns ) 25 | : this( null, ns ) 26 | { 27 | } // RtfXmlConvertSettings 28 | 29 | // ---------------------------------------------------------------------- 30 | public RtfXmlConvertSettings( string prefix, string ns ) 31 | { 32 | this.prefix = prefix; 33 | this.ns = ns; 34 | } // RtfXmlConvertSettings 35 | 36 | // ---------------------------------------------------------------------- 37 | public string Prefix 38 | { 39 | get { return prefix; } 40 | set { prefix = value; } 41 | } // Prefix 42 | 43 | // ---------------------------------------------------------------------- 44 | public string Ns 45 | { 46 | get { return ns; } 47 | set { ns = value; } 48 | } // Ns 49 | 50 | // ---------------------------------------------------------------------- 51 | public bool IsShowHiddenText 52 | { 53 | get { return showHiddenText; } 54 | set { showHiddenText = value; } 55 | } // IsShowHiddenText 56 | 57 | // ---------------------------------------------------------------------- 58 | // members 59 | private string prefix; 60 | private string ns; 61 | private bool showHiddenText; 62 | 63 | } // class RtfXmlConvertSettings 64 | 65 | } // namespace Itenso.Rtf.Converter.Xml 66 | // -- EOF ------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /Interpreter/Converter/Image/IRtfConvertedImageInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfConvertedImageInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.10.13 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Drawing; 10 | using System.Drawing.Imaging; 11 | 12 | namespace Itenso.Rtf.Converter.Image 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public interface IRtfConvertedImageInfo 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | string FileName { get; } 21 | 22 | // ---------------------------------------------------------------------- 23 | ImageFormat Format { get; } 24 | 25 | // ---------------------------------------------------------------------- 26 | Size Size { get; } 27 | 28 | } // interface IRtfConvertedImageInfo 29 | 30 | } // namespace Itenso.Rtf.Converter.Image 31 | // -- EOF ------------------------------------------------------------------- 32 | -------------------------------------------------------------------------------- /Interpreter/Converter/Image/IRtfConvertedImageInfoCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfConvertedImageInfoCollection.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.10.13 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Rtf.Converter.Image 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfConvertedImageInfoCollection : IEnumerable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Count { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | IRtfConvertedImageInfo this[ int index ] { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | void CopyTo( IRtfConvertedImageInfo[] array, int index ); 26 | 27 | } // interface IRtfConvertedImageInfoCollection 28 | 29 | } // namespace Itenso.Rtf.Converter.Image 30 | // -- EOF ------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /Interpreter/Converter/Image/IRtfVisualImageAdapter.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfVisualImageAdapter.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.05 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Drawing.Imaging; 10 | 11 | namespace Itenso.Rtf.Converter.Image 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfVisualImageAdapter 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | string FileNamePattern { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | ImageFormat TargetFormat { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | double DpiX { get; } 26 | 27 | // ---------------------------------------------------------------------- 28 | double DpiY { get; } 29 | 30 | // ---------------------------------------------------------------------- 31 | ImageFormat GetImageFormat( RtfVisualImageFormat rtfVisualImageFormat ); 32 | 33 | // ---------------------------------------------------------------------- 34 | string ResolveFileName( int index, RtfVisualImageFormat rtfVisualImageFormat ); 35 | 36 | // ---------------------------------------------------------------------- 37 | int CalcImageWidth( RtfVisualImageFormat format, int width, 38 | int desiredWidth, int scaleWidthPercent ); 39 | 40 | // ---------------------------------------------------------------------- 41 | int CalcImageHeight( RtfVisualImageFormat format, int height, 42 | int desiredHeight, int scaleHeightPercent ); 43 | 44 | } // interface IRtfVisualImageAdapter 45 | 46 | } // namespace Itenso.Rtf.Converter.Image 47 | // -- EOF ------------------------------------------------------------------- 48 | -------------------------------------------------------------------------------- /Interpreter/Converter/Image/RtfConvertedImageInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfConvertedImageInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.10.13 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Drawing; 11 | using System.Drawing.Imaging; 12 | 13 | namespace Itenso.Rtf.Converter.Image 14 | { 15 | 16 | // ------------------------------------------------------------------------ 17 | public class RtfConvertedImageInfo : IRtfConvertedImageInfo 18 | { 19 | 20 | // ---------------------------------------------------------------------- 21 | public RtfConvertedImageInfo( string fileName, ImageFormat format, Size size ) 22 | { 23 | if ( fileName == null ) 24 | { 25 | throw new ArgumentNullException( "fileName" ); 26 | } 27 | 28 | this.fileName = fileName; 29 | this.format = format; 30 | this.size = size; 31 | } // RtfConvertedImageInfo 32 | 33 | // ---------------------------------------------------------------------- 34 | public string FileName 35 | { 36 | get { return fileName; } 37 | } // FileName 38 | 39 | // ---------------------------------------------------------------------- 40 | public ImageFormat Format 41 | { 42 | get { return format; } 43 | } // Format 44 | 45 | // ---------------------------------------------------------------------- 46 | public Size Size 47 | { 48 | get { return size; } 49 | } // Size 50 | 51 | // ---------------------------------------------------------------------- 52 | public override string ToString() 53 | { 54 | return fileName + " " + format + " " + size.Width + "x" + size.Height; 55 | } // ToString 56 | 57 | // ---------------------------------------------------------------------- 58 | // members 59 | private readonly string fileName; 60 | private readonly ImageFormat format; 61 | private readonly Size size; 62 | 63 | } // class RtfConvertedImageInfo 64 | 65 | } // namespace Itenso.Rtf.Converter.Image 66 | // -- EOF ------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /Interpreter/Converter/Image/RtfConvertedImageInfoCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfConvertedImageInfoCollection.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.10.13 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Collections; 11 | using Itenso.Sys.Collection; 12 | 13 | namespace Itenso.Rtf.Converter.Image 14 | { 15 | 16 | // ------------------------------------------------------------------------ 17 | public sealed class RtfConvertedImageInfoCollection : ReadOnlyCollectionBase, IRtfConvertedImageInfoCollection 18 | { 19 | 20 | // ---------------------------------------------------------------------- 21 | public IRtfConvertedImageInfo this[ int index ] 22 | { 23 | get { return InnerList[ index ] as RtfConvertedImageInfo; } 24 | } // this[ int ] 25 | 26 | // ---------------------------------------------------------------------- 27 | public void CopyTo( IRtfConvertedImageInfo[] array, int index ) 28 | { 29 | InnerList.CopyTo( array, index ); 30 | } // CopyTo 31 | 32 | // ---------------------------------------------------------------------- 33 | public void Add( IRtfConvertedImageInfo item ) 34 | { 35 | if ( item == null ) 36 | { 37 | throw new ArgumentNullException( "item" ); 38 | } 39 | InnerList.Add( item ); 40 | } // Add 41 | 42 | // ---------------------------------------------------------------------- 43 | public void Clear() 44 | { 45 | InnerList.Clear(); 46 | } // Clear 47 | 48 | // ---------------------------------------------------------------------- 49 | public override string ToString() 50 | { 51 | return CollectionTool.ToString( this ); 52 | } // ToString 53 | 54 | } // class RtfConvertedImageInfoCollection 55 | 56 | } // namespace Itenso.Rtf.Converter.Image 57 | // -- EOF ------------------------------------------------------------------- 58 | -------------------------------------------------------------------------------- /Interpreter/IRtfColor.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfColor.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Drawing; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfColor 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Red { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | int Green { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | int Blue { get; } 26 | 27 | // ---------------------------------------------------------------------- 28 | Color AsDrawingColor { get; } 29 | 30 | } // interface IRtfColor 31 | 32 | } // namespace Itenso.Rtf 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Interpreter/IRtfColorCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfColorCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.21 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfColorCollection : IEnumerable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Count { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | IRtfColor this[ int index ] { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | void CopyTo( IRtfColor[] array, int index ); 26 | 27 | } // interface IRtfColorCollection 28 | 29 | } // namespace Itenso.Rtf 30 | // -- EOF ------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /Interpreter/IRtfDocument.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfDocument.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.21 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfDocument 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | int RtfVersion { get; } 19 | 20 | // ---------------------------------------------------------------------- 21 | IRtfFont DefaultFont { get; } 22 | 23 | // ---------------------------------------------------------------------- 24 | IRtfTextFormat DefaultTextFormat { get; } 25 | 26 | // ---------------------------------------------------------------------- 27 | IRtfFontCollection FontTable { get; } 28 | 29 | // ---------------------------------------------------------------------- 30 | IRtfColorCollection ColorTable { get; } 31 | 32 | // ---------------------------------------------------------------------- 33 | string Generator { get; } 34 | 35 | // ---------------------------------------------------------------------- 36 | IRtfTextFormatCollection UniqueTextFormats { get; } 37 | 38 | // ---------------------------------------------------------------------- 39 | IRtfDocumentInfo DocumentInfo { get; } 40 | 41 | // ---------------------------------------------------------------------- 42 | IRtfDocumentPropertyCollection UserProperties { get; } 43 | 44 | // ---------------------------------------------------------------------- 45 | IRtfVisualCollection VisualContent { get; } 46 | 47 | } // interface IRtfDocument 48 | 49 | } // namespace Itenso.Rtf 50 | // -- EOF ------------------------------------------------------------------- 51 | -------------------------------------------------------------------------------- /Interpreter/IRtfDocumentProperty.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfDocumentProperty.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.23 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfDocumentProperty 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | int PropertyKindCode { get; } 19 | 20 | // ---------------------------------------------------------------------- 21 | RtfPropertyKind PropertyKind { get; } 22 | 23 | // ---------------------------------------------------------------------- 24 | string Name { get; } 25 | 26 | // ---------------------------------------------------------------------- 27 | string StaticValue { get; } 28 | 29 | // ---------------------------------------------------------------------- 30 | string LinkValue { get; } 31 | 32 | } // interface IRtfDocumentProperty 33 | 34 | } // namespace Itenso.Rtf 35 | // -- EOF ------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /Interpreter/IRtfDocumentPropertyCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfDocumentPropertyCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.23 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfDocumentPropertyCollection : IEnumerable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Count { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | IRtfDocumentProperty this[ int index ] { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | IRtfDocumentProperty this[ string name ] { get; } 26 | 27 | // ---------------------------------------------------------------------- 28 | void CopyTo( IRtfDocumentProperty[] array, int index ); 29 | 30 | } // interface IRtfDocumentPropertyCollection 31 | 32 | } // namespace Itenso.Rtf 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Interpreter/IRtfFont.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfFont.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfFont 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | string Id { get; } 19 | 20 | // ---------------------------------------------------------------------- 21 | RtfFontKind Kind { get; } 22 | 23 | // ---------------------------------------------------------------------- 24 | RtfFontPitch Pitch { get; } 25 | 26 | // ---------------------------------------------------------------------- 27 | int CharSet { get; } 28 | 29 | // ---------------------------------------------------------------------- 30 | int CodePage { get; } 31 | 32 | // ---------------------------------------------------------------------- 33 | string Name { get; } 34 | 35 | } // interface IRtfFont 36 | 37 | } // namespace Itenso.Rtf 38 | // -- EOF ------------------------------------------------------------------- 39 | -------------------------------------------------------------------------------- /Interpreter/IRtfFontCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfFontCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfFontCollection : IEnumerable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Count { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | bool ContainsFontWithId( string fontId ); 23 | 24 | // ---------------------------------------------------------------------- 25 | IRtfFont this[ int index ] { get; } 26 | 27 | // ---------------------------------------------------------------------- 28 | IRtfFont this[ string id ] { get; } 29 | 30 | // ---------------------------------------------------------------------- 31 | void CopyTo( IRtfFont[] array, int index ); 32 | 33 | } // interface IRtfFontCollection 34 | 35 | } // namespace Itenso.Rtf 36 | // -- EOF ------------------------------------------------------------------- 37 | -------------------------------------------------------------------------------- /Interpreter/IRtfInterpreter.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfInterpreter.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.21 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfInterpreter 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | /// 20 | /// Adds a listener that will get notified along the interpretation process. 21 | /// 22 | /// the listener to add 23 | /// in case of a null argument 24 | void AddInterpreterListener( IRtfInterpreterListener listener ); 25 | 26 | // ---------------------------------------------------------------------- 27 | /// 28 | /// Removes a listener from this instance. 29 | /// 30 | /// the listener to remove 31 | /// in case of a null argument 32 | void RemoveInterpreterListener( IRtfInterpreterListener listener ); 33 | 34 | // ---------------------------------------------------------------------- 35 | /// 36 | /// Parses the given RTF document and informs the registered listeners about 37 | /// all occurring events. 38 | /// 39 | /// the RTF documet to interpret 40 | /// in case of an unsupported RTF structure 41 | /// in case of a null argument 42 | void Interpret( IRtfGroup rtfDocument ); 43 | 44 | } // interface IRtfInterpreter 45 | 46 | } // namespace Itenso.Rtf 47 | // -- EOF ------------------------------------------------------------------- 48 | -------------------------------------------------------------------------------- /Interpreter/IRtfInterpreterListener.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfInterpreterListener.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.21 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfInterpreterListener 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | void BeginDocument( IRtfInterpreterContext context ); 19 | 20 | // ---------------------------------------------------------------------- 21 | void InsertText( IRtfInterpreterContext context, string text ); 22 | 23 | // ---------------------------------------------------------------------- 24 | void InsertSpecialChar( IRtfInterpreterContext context, RtfVisualSpecialCharKind kind ); 25 | 26 | // ---------------------------------------------------------------------- 27 | void InsertBreak( IRtfInterpreterContext context, RtfVisualBreakKind kind ); 28 | 29 | // ---------------------------------------------------------------------- 30 | void InsertImage( IRtfInterpreterContext context, RtfVisualImageFormat format, 31 | int width, int height, int desiredWidth, int desiredHeight, 32 | int scaleWidthPercent, int scaleHeightPercent, string imageDataHex 33 | ); 34 | 35 | // ---------------------------------------------------------------------- 36 | void EndDocument( IRtfInterpreterContext context ); 37 | 38 | } // interface IRtfInterpreterListener 39 | 40 | } // namespace Itenso.Rtf 41 | // -- EOF ------------------------------------------------------------------- 42 | -------------------------------------------------------------------------------- /Interpreter/IRtfTextFormatCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfTextFormatCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.21 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfTextFormatCollection : IEnumerable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Count { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | IRtfTextFormat this[ int index ] { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | bool Contains( IRtfTextFormat format ); 26 | 27 | // ---------------------------------------------------------------------- 28 | int IndexOf( IRtfTextFormat format ); 29 | 30 | // ---------------------------------------------------------------------- 31 | void CopyTo( IRtfTextFormat[] array, int index ); 32 | 33 | } // interface IRtfTextFormatCollection 34 | 35 | } // namespace Itenso.Rtf 36 | // -- EOF ------------------------------------------------------------------- 37 | -------------------------------------------------------------------------------- /Interpreter/IRtfVisual.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfVisual.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.21 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfVisual 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | RtfVisualKind Kind { get; } 19 | 20 | // ---------------------------------------------------------------------- 21 | void Visit( IRtfVisualVisitor visitor ); 22 | 23 | } // interface IRtfVisual 24 | 25 | } // namespace Itenso.Rtf 26 | // -- EOF ------------------------------------------------------------------- 27 | -------------------------------------------------------------------------------- /Interpreter/IRtfVisualBreak.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfVisualBreak.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.22 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfVisualBreak : IRtfVisual 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | RtfVisualBreakKind BreakKind { get; } 19 | 20 | } // interface IRtfVisualBreak 21 | 22 | } // namespace Itenso.Rtf 23 | // -- EOF ------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Interpreter/IRtfVisualCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfVisualCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.21 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfVisualCollection : IEnumerable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Count { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | IRtfVisual this[ int index ] { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | void CopyTo( IRtfVisual[] array, int index ); 26 | 27 | } // interface IRtfVisualCollection 28 | 29 | } // namespace Itenso.Rtf 30 | // -- EOF ------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /Interpreter/IRtfVisualImage.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfVisualImage.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.22 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfVisualImage : IRtfVisual 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | RtfVisualImageFormat Format { get; } 19 | 20 | // ---------------------------------------------------------------------- 21 | RtfTextAlignment Alignment { get; } 22 | 23 | // ---------------------------------------------------------------------- 24 | int Width { get; } 25 | 26 | // ---------------------------------------------------------------------- 27 | int Height { get; } 28 | 29 | // ---------------------------------------------------------------------- 30 | int DesiredWidth { get; } 31 | 32 | // ---------------------------------------------------------------------- 33 | int DesiredHeight { get; } 34 | 35 | // ---------------------------------------------------------------------- 36 | int ScaleWidthPercent { get; } 37 | 38 | // ---------------------------------------------------------------------- 39 | int ScaleHeightPercent { get; } 40 | 41 | // ---------------------------------------------------------------------- 42 | string ImageDataHex { get; } 43 | 44 | // ---------------------------------------------------------------------- 45 | byte[] ImageDataBinary { get; } 46 | 47 | // ---------------------------------------------------------------------- 48 | System.Drawing.Image ImageForDrawing { get; } 49 | 50 | } // interface IRtfVisualImage 51 | 52 | } // namespace Itenso.Rtf 53 | // -- EOF ------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /Interpreter/IRtfVisualSpecialChar.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfVisualSpecialChar.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.22 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfVisualSpecialChar : IRtfVisual 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | RtfVisualSpecialCharKind CharKind { get; } 19 | 20 | } // interface IRtfVisualSpecialChar 21 | 22 | } // namespace Itenso.Rtf 23 | // -- EOF ------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Interpreter/IRtfVisualText.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfVisualText.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.22 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfVisualText : IRtfVisual 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | string Text { get; } 19 | 20 | // ---------------------------------------------------------------------- 21 | IRtfTextFormat Format { get; } 22 | 23 | } // interface IRtfVisualText 24 | 25 | } // namespace Itenso.Rtf 26 | // -- EOF ------------------------------------------------------------------- 27 | -------------------------------------------------------------------------------- /Interpreter/IRtfVisualVisitor.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfVisualVisitor.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.26 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfVisualVisitor 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | void VisitText( IRtfVisualText visualText ); 19 | 20 | // ---------------------------------------------------------------------- 21 | void VisitBreak( IRtfVisualBreak visualBreak ); 22 | 23 | // ---------------------------------------------------------------------- 24 | void VisitSpecial( IRtfVisualSpecialChar visualSpecialChar ); 25 | 26 | // ---------------------------------------------------------------------- 27 | void VisitImage( IRtfVisualImage visualImage ); 28 | 29 | } // interface IRtfVisualVisitor 30 | 31 | } // namespace Itenso.Rtf 32 | // -- EOF ------------------------------------------------------------------- 33 | -------------------------------------------------------------------------------- /Interpreter/Interpreter/RtfTextBuilder.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfTextBuilder.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.23 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Text; 10 | using Itenso.Rtf.Support; 11 | 12 | namespace Itenso.Rtf.Interpreter 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public sealed class RtfTextBuilder : RtfElementVisitorBase 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public RtfTextBuilder() 21 | : base( RtfElementVisitorOrder.DepthFirst ) 22 | { 23 | Reset(); 24 | } // RtfTextBuilder 25 | 26 | // ---------------------------------------------------------------------- 27 | public string CombinedText 28 | { 29 | get { return buffer.ToString(); } 30 | } // CombinedText 31 | 32 | // ---------------------------------------------------------------------- 33 | public void Reset() 34 | { 35 | buffer.Remove( 0, buffer.Length ); 36 | } // Reset 37 | 38 | // ---------------------------------------------------------------------- 39 | protected override void DoVisitText( IRtfText text ) 40 | { 41 | buffer.Append( text.Text ); 42 | } // DoVisitText 43 | 44 | // ---------------------------------------------------------------------- 45 | // members 46 | private readonly StringBuilder buffer = new StringBuilder(); 47 | 48 | } // class RtfTextBuilder 49 | 50 | } // namespace Itenso.Rtf.Interpreter 51 | // -- EOF ------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /Interpreter/Model/RtfColorCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfColorCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Rtf.Model 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public sealed class RtfColorCollection : ReadOnlyBaseCollection, IRtfColorCollection 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public IRtfColor this[ int index ] 20 | { 21 | get { return InnerList[ index ] as IRtfColor; } 22 | } // this[ int ] 23 | 24 | // ---------------------------------------------------------------------- 25 | public void CopyTo( IRtfColor[] array, int index ) 26 | { 27 | InnerList.CopyTo( array, index ); 28 | } // CopyTo 29 | 30 | // ---------------------------------------------------------------------- 31 | public void Add( IRtfColor item ) 32 | { 33 | if ( item == null ) 34 | { 35 | throw new ArgumentNullException( "item" ); 36 | } 37 | InnerList.Add( item ); 38 | } // Add 39 | 40 | // ---------------------------------------------------------------------- 41 | public void Clear() 42 | { 43 | InnerList.Clear(); 44 | } // Clear 45 | 46 | } // class RtfColorCollection 47 | 48 | } // namespace Itenso.Rtf.Model 49 | // -- EOF ------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /Interpreter/Model/RtfDocumentPropertyCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfDocumentPropertyCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.23 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Rtf.Model 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public sealed class RtfDocumentPropertyCollection : ReadOnlyBaseCollection, IRtfDocumentPropertyCollection 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public IRtfDocumentProperty this[ int index ] 20 | { 21 | get { return InnerList[ index ] as IRtfDocumentProperty; } 22 | } // this[ int ] 23 | 24 | // ---------------------------------------------------------------------- 25 | public IRtfDocumentProperty this[ string name ] 26 | { 27 | get 28 | { 29 | if ( name != null ) 30 | { 31 | foreach ( IRtfDocumentProperty property in InnerList ) 32 | { 33 | if ( property.Name.Equals( name ) ) 34 | { 35 | return property; 36 | } 37 | } 38 | } 39 | return null; 40 | } 41 | } // this[ string ] 42 | 43 | // ---------------------------------------------------------------------- 44 | public void CopyTo( IRtfDocumentProperty[] array, int index ) 45 | { 46 | InnerList.CopyTo( array, index ); 47 | } // CopyTo 48 | 49 | // ---------------------------------------------------------------------- 50 | public void Add( IRtfDocumentProperty item ) 51 | { 52 | if ( item == null ) 53 | { 54 | throw new ArgumentNullException( "item" ); 55 | } 56 | InnerList.Add( item ); 57 | } // Add 58 | 59 | // ---------------------------------------------------------------------- 60 | public void Clear() 61 | { 62 | InnerList.Clear(); 63 | } // Clear 64 | 65 | } // class RtfDocumentPropertyCollection 66 | 67 | } // namespace Itenso.Rtf.Model 68 | // -- EOF ------------------------------------------------------------------- 69 | -------------------------------------------------------------------------------- /Interpreter/Model/RtfFontCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfFontCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Collections; 11 | 12 | namespace Itenso.Rtf.Model 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public sealed class RtfFontCollection : ReadOnlyBaseCollection, IRtfFontCollection 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public bool ContainsFontWithId( string fontId ) 21 | { 22 | return fontByIdMap.ContainsKey( fontId ); 23 | } // ContainsFontWithId 24 | 25 | // ---------------------------------------------------------------------- 26 | public IRtfFont this[ int index ] 27 | { 28 | get { return InnerList[ index ] as IRtfFont; } 29 | } // this[ int ] 30 | 31 | // ---------------------------------------------------------------------- 32 | public IRtfFont this[ string id ] 33 | { 34 | get { return fontByIdMap[ id ] as IRtfFont; } 35 | } // this[ string ] 36 | 37 | // ---------------------------------------------------------------------- 38 | public void CopyTo( IRtfFont[] array, int index ) 39 | { 40 | InnerList.CopyTo( array, index ); 41 | } // CopyTo 42 | 43 | // ---------------------------------------------------------------------- 44 | public void Add( IRtfFont item ) 45 | { 46 | if ( item == null ) 47 | { 48 | throw new ArgumentNullException( "item" ); 49 | } 50 | InnerList.Add( item ); 51 | fontByIdMap.Add( item.Id, item ); 52 | } // Add 53 | 54 | // ---------------------------------------------------------------------- 55 | public void Clear() 56 | { 57 | InnerList.Clear(); 58 | fontByIdMap.Clear(); 59 | } // Clear 60 | 61 | // ---------------------------------------------------------------------- 62 | // members 63 | private readonly Hashtable fontByIdMap = new Hashtable(); 64 | 65 | } // class RtfFontCollection 66 | 67 | } // namespace Itenso.Rtf.Model 68 | // -- EOF ------------------------------------------------------------------- 69 | -------------------------------------------------------------------------------- /Interpreter/Model/RtfVisualBreak.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfVisualBreak.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.22 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using Itenso.Sys; 10 | 11 | namespace Itenso.Rtf.Model 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public sealed class RtfVisualBreak : RtfVisual, IRtfVisualBreak 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public RtfVisualBreak( RtfVisualBreakKind breakKind ) : 20 | base( RtfVisualKind.Break ) 21 | { 22 | this.breakKind = breakKind; 23 | } // RtfVisualBreak 24 | 25 | // ---------------------------------------------------------------------- 26 | public RtfVisualBreakKind BreakKind 27 | { 28 | get { return breakKind; } 29 | } // BreakKind 30 | 31 | // ---------------------------------------------------------------------- 32 | public override string ToString() 33 | { 34 | return breakKind.ToString(); 35 | } // ToString 36 | 37 | // ---------------------------------------------------------------------- 38 | protected override void DoVisit( IRtfVisualVisitor visitor ) 39 | { 40 | visitor.VisitBreak( this ); 41 | } // DoVisit 42 | 43 | // ---------------------------------------------------------------------- 44 | protected override bool IsEqual( object obj ) 45 | { 46 | RtfVisualBreak compare = obj as RtfVisualBreak; // guaranteed to be non-null 47 | return 48 | compare != null && 49 | base.IsEqual( compare ) && 50 | breakKind == compare.breakKind; 51 | } // IsEqual 52 | 53 | // ---------------------------------------------------------------------- 54 | protected override int ComputeHashCode() 55 | { 56 | return HashTool.AddHashCode( base.ComputeHashCode(), breakKind ); 57 | } // ComputeHashCode 58 | 59 | // ---------------------------------------------------------------------- 60 | // members 61 | private readonly RtfVisualBreakKind breakKind; 62 | 63 | } // class RtfVisualBreak 64 | 65 | } // namespace Itenso.Rtf.Model 66 | // -- EOF ------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /Interpreter/Model/RtfVisualCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfVisualCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.21 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Rtf.Model 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public sealed class RtfVisualCollection : ReadOnlyBaseCollection, IRtfVisualCollection 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public IRtfVisual this[ int index ] 20 | { 21 | get { return InnerList[ index ] as IRtfVisual; } 22 | } // this[ int ] 23 | 24 | // ---------------------------------------------------------------------- 25 | public void CopyTo( IRtfVisual[] array, int index ) 26 | { 27 | InnerList.CopyTo( array, index ); 28 | } // CopyTo 29 | 30 | // ---------------------------------------------------------------------- 31 | public void Add( IRtfVisual item ) 32 | { 33 | if ( item == null ) 34 | { 35 | throw new ArgumentNullException( "item" ); 36 | } 37 | InnerList.Add( item ); 38 | } // Add 39 | 40 | // ---------------------------------------------------------------------- 41 | public void Clear() 42 | { 43 | InnerList.Clear(); 44 | } // Clear 45 | 46 | } // class RtfVisualCollection 47 | 48 | } // namespace Itenso.Rtf.Model 49 | // -- EOF ------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /Interpreter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : AssemblyInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.05.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Security.Permissions; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle( "Itenso RTF Interpreter" )] 18 | [assembly: AssemblyDescription( "Itenso RTF Interpreter" )] 19 | [assembly: AssemblyConfiguration( "" )] 20 | [assembly: AssemblyCompany( "Itenso GmbH" )] 21 | [assembly: AssemblyProduct( "Itenso RTF Interpreter" )] 22 | [assembly: AssemblyCopyright( "Copyright © Itenso GmbH 2010" )] 23 | [assembly: AssemblyTrademark( "" )] 24 | [assembly: AssemblyCulture( "" )] 25 | [assembly: ComVisible( false )] 26 | [assembly: SecurityPermission( SecurityAction.RequestMinimum, Assertion = true )] 27 | [assembly: CLSCompliant( true )] 28 | 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /Interpreter/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.05.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Rtf.Interpreter 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Rtf.Interpreter 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Interpreter/RtfColorException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfColorException.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2009.02.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfColorException : RtfInterpreterException 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfColorException() 24 | { 25 | } // RtfColorException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfColorException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfColorException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfColorException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfColorException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfColorException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfColorException 52 | 53 | } // class RtfColorException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Interpreter/RtfFontKind.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfFontKind.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfFontKind 15 | { 16 | Nil, 17 | Roman, 18 | Swiss, 19 | Modern, 20 | Script, 21 | Decor, 22 | Tech, 23 | Bidi 24 | } // enum RtfFontKind 25 | 26 | } // namespace Itenso.Rtf 27 | // -- EOF ------------------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /Interpreter/RtfFontPitch.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfFontPitch.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfFontPitch 15 | { 16 | Default, 17 | Fixed, 18 | Variable 19 | } // enum RtfFontPitch 20 | 21 | } // namespace Itenso.Rtf 22 | // -- EOF ------------------------------------------------------------------- 23 | -------------------------------------------------------------------------------- /Interpreter/RtfInterpreterException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfInterpreterException.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2009.02.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfInterpreterException : RtfException 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfInterpreterException() 24 | { 25 | } // RtfInterpreterException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfInterpreterException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfInterpreterException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfInterpreterException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfInterpreterException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfInterpreterException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfInterpreterException 52 | 53 | } // class RtfInterpreterException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Interpreter/RtfInterpreterState.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfInterpreterState.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfInterpreterState 15 | { 16 | Init, 17 | InHeader, 18 | InDocument, 19 | Ended 20 | } // enum RtfInterpreterState 21 | 22 | } // namespace Itenso.Rtf 23 | // -- EOF ------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Interpreter/RtfInvalidDataException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfInvalidDataException.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2009.02.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfInvalidDataException : RtfInterpreterException 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfInvalidDataException() 24 | { 25 | } // RtfInvalidDataException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfInvalidDataException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfInvalidDataException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfInvalidDataException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfInvalidDataException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfInvalidDataException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfInvalidDataException 52 | 53 | } // class RtfInvalidDataException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Interpreter/RtfPropertyKind.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfPropertyKind.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.23 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfPropertyKind 15 | { 16 | Unknown, 17 | IntegerNumber, 18 | RealNumber, 19 | Date, 20 | Boolean, 21 | Text 22 | } // enum RtfPropertyKind 23 | 24 | } // namespace Itenso.Rtf 25 | // -- EOF ------------------------------------------------------------------- 26 | -------------------------------------------------------------------------------- /Interpreter/RtfTextAlignment.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfTextAlignment.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.23 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfTextAlignment 15 | { 16 | Left, 17 | Center, 18 | Right, 19 | Justify 20 | } // enum RtfTextAlignment 21 | 22 | } // namespace Itenso.Rtf 23 | // -- EOF ------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Interpreter/RtfVisualBreakKind.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfVisualBreakKind.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.22 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfVisualBreakKind 15 | { 16 | Line, 17 | Page, 18 | Paragraph, 19 | Section 20 | } // enum RtfVisualBreakKind 21 | 22 | } // namespace Itenso.Rtf 23 | // -- EOF ------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Interpreter/RtfVisualImageFormat.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfVisualImageFormat.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.23 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfVisualImageFormat 15 | { 16 | Emf, 17 | Png, 18 | Jpg, 19 | Wmf, 20 | Bmp 21 | } // enum RtfVisualImageFormat 22 | 23 | } // namespace Itenso.Rtf 24 | // -- EOF ------------------------------------------------------------------- 25 | -------------------------------------------------------------------------------- /Interpreter/RtfVisualKind.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfVisualKind.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfVisualKind 15 | { 16 | Text, 17 | Break, 18 | Special, 19 | Image 20 | } // enum RtfVisualKind 21 | 22 | } // namespace Itenso.Rtf 23 | // -- EOF ------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Interpreter/RtfVisualSpecialCharKind.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfVisualSpecialCharKind.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.22 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfVisualSpecialCharKind 15 | { 16 | Tabulator, 17 | ParagraphNumberBegin, 18 | ParagraphNumberEnd, 19 | NonBreakingSpace, 20 | EmDash, 21 | EnDash, 22 | EmSpace, 23 | EnSpace, 24 | QmSpace, 25 | Bullet, 26 | LeftSingleQuote, 27 | RightSingleQuote, 28 | LeftDoubleQuote, 29 | RightDoubleQuote, 30 | OptionalHyphen, 31 | NonBreakingHyphen 32 | } // enum RtfVisualSpecialCharKind 33 | 34 | } // namespace Itenso.Rtf 35 | // -- EOF ------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /Interpreter/Support/RtfElementVisitorOrder.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfElementVisitorOrder.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf.Support 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfElementVisitorOrder 15 | { 16 | NonRecursive, 17 | DepthFirst, 18 | BreadthFirst 19 | } // enum RtfElementVisitorOrder 20 | 21 | } // namespace Itenso.Rtf 22 | // -- EOF ------------------------------------------------------------------- 23 | -------------------------------------------------------------------------------- /InterpreterTests/Program.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : Program.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using Itenso.Sys.Test; 10 | 11 | namespace Itenso.Rtf.InterpreterTests 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | class Program 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | static void Main( string[] args ) 20 | { 21 | ConsoleRunner.Execute( typeof( Program ).Assembly, args ); 22 | } // Main 23 | 24 | } // class Program 25 | 26 | } // namespace Itenso.Rtf.InterpreterTests 27 | // -- EOF ------------------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /InterpreterTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : AssemblyInfo.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Security.Permissions; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle( "Itenso RTF Interpreter Tests" )] 18 | [assembly: AssemblyDescription( "Itenso RTF Interpreter Tests" )] 19 | [assembly: AssemblyConfiguration( "" )] 20 | [assembly: AssemblyCompany( "Itenso GmbH" )] 21 | [assembly: AssemblyProduct( "Itenso RTF Interpreter Tests" )] 22 | [assembly: AssemblyCopyright( "Copyright © Itenso GmbH 2010" )] 23 | [assembly: AssemblyTrademark( "" )] 24 | [assembly: AssemblyCulture( "" )] 25 | [assembly: ComVisible( false )] 26 | [assembly: SecurityPermission( SecurityAction.RequestMinimum, Assertion = true )] 27 | [assembly: CLSCompliant( true )] 28 | 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /InterpreterTests/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion("1.3.0.0")] 19 | 20 | namespace Itenso.Rtf.InterpreterTests 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Rtf.InterpreterTests 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest.cs -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_0.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\uc1\deff0{\fonttbl 2 | {\f0\fswiss\fcharset0\fprq2 Arial;} 3 | {\f1\fswiss\fcharset0\fprq2 Verdana;} 4 | {\f2\froman\fcharset2\fprq2 Symbol;}} 5 | {\colortbl;\red0\green0\blue0;\red255\green255\blue255;} 6 | {\stylesheet{\s0\itap0\nowidctlpar\f0\fs24 [Normal];}{\*\cs10\additive Default Paragraph Font;}} 7 | {\*\generator TX_RTF32 14.0.520.501;} 8 | \deftab1134\paperw11952\paperh16848\margl1440\margt1440\margr1440\margb1440\widowctrl\formshade\sectd 9 | \headery720\footery720\pgwsxn11952\pghsxn16848\marglsxn1440\margtsxn1440\margrsxn1440\margbsxn1440\pard\itap0\nowidctlpar\plain\f1\fs36 Hello RTF World\ 10 | } 11 | -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_0.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_0.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_1.rtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_1.rtf -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_1.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_10.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_10.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_11.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fswiss\ 2 | fcharset0 Arial;}{\f1\fmodern\fprq1\fcharset0 Courier New;} 3 | {\f2\fswiss\fprq2\fcharset0 Arial;} 4 | {\f3\fnil\fcharset2 Symbol;}} 5 | {\colortbl ;\red128\green0\blue0;\red0\green0\blue255;} 6 | \viewkind4\uc1\pard\f0\fs24 TEST \fs40 BIG \fs24 SMALL AGAIN\b 7 | \cf1 BROWN \cf2 BLUE \cf0\b0 AND \f1 ANOTHER fONT.\par 8 | \par 9 | \par 10 | \f2 This is a left-aligned paragraph\par 11 | \pard\qr right-aligned one\par 12 | \pard\qc centered one\par 13 | } 14 | -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_11.txt: -------------------------------------------------------------------------------- 1 | TEST BIG SMALL AGAIN BROWN BLUE AND ANOTHER fONT. 2 | 3 | 4 | This is a left-aligned paragraph 5 | right-aligned one 6 | centered one 7 | -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_12.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fmodern\fprq1\fcharset128 MS Gothic;}{\f1\fswiss\fcharset0 Arial;}} 2 | {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1033\kerning2\ul\b\f0\fs40\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'83\'41\'83\'62\'83\'76\'92\'8d\'95\'b6\'8f\'91\'81\'69\'8b\'e2\'8d\'73\'90\'55\'8d\'9e\'81\'6a\lang1031\kerning0\ulnone\b0\f1\fs20\par 3 | } 4 | -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_12.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_12.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_13.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_13.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_14.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_14.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_15.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Microsoft Sans Serif;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\fs16\f2\cf0 \cf0\ql{\f2 {\lang2055\ltrch a}\li0\ri0\sa0\sb0\fi0\ql\par}}} -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_15.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_15.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_16.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_16.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_17.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_17.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_18.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_18.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_19.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_19.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_2.rtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_2.rtf -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_2.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_20.rtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_20.rtf -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_20.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_20.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_22.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_22.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_23.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Segoe UI;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang26\fs18\f2\cf0 \cf0\ql{\f2 {\lang1050\highlight1\ltrch Simple text}\li0\ri0\sa0\sb0\fi0\qr\par} 2 | } 3 | } -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_23.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_23.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_3.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\uc1\deff0{\fonttbl 2 | {\f0\fswiss\fcharset0\fprq2 Arial;} 3 | {\f1\fswiss\fcharset0\fprq2 Verdana;} 4 | {\f2\froman\fcharset2\fprq2 Symbol;}} 5 | {\colortbl;\red0\green0\blue0;\red231\green222\blue173;} 6 | {\*\generator hand coded ;-) v.0.0.1;} 7 | \pard\plain\f1\fs24 left aligned\par 8 | \pard\qc centered\par 9 | \pard\qr right aligned\par 10 | \pard\qj block aligned\par 11 | } 12 | -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_3.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_3.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_4.rtf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_4.rtf.jpg -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_4.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_4.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_5.rtf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_5.rtf.png -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_5.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_5.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_6.rtf.wmf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_6.rtf.wmf -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_6.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_6.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_7.rtf.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_7.rtf.emf -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_7.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_7.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_8.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\uc1\deff0{\fonttbl 2 | {\f0\fswiss\fcharset0\fprq2 Arial;} 3 | {\f1\fswiss\fcharset0\fprq2 Verdana;} 4 | {\f2\froman\fcharset2\fprq2 Symbol;}} 5 | {\colortbl;\red0\green0\blue0;\red231\green222\blue173;} 6 | {\*\generator hand coded ;-) v.0.0.1;} 7 | \pard\plain\f1\fs24 an EMF image:\par\par 8 | before 9 | {\pict\emfblip 10 | \picw172\pich86 11 | \picwgoal720\pichgoal360 12 | \picscalex100\picscaley100 13 | d7cdc69a000000000100140a15059f05000000008e5d0100090000031b010000030012000000 14 | 0000030000001e000400000002010100050000000b0206000000050000000c0270203e400400 15 | 00000701030007000000160476203e4006000000040000000601010007000000fc0200000000 16 | 00020000040000002d01000009000000fa02050001000000000000022200040000002d010100 17 | 1200000024030700983fb702a32e4620502338199e1a6b1e6a18fe10800ae405983fb7020700 18 | 0000fc020000e0c953020000040000002d01020004000000f00100001200000024030700643c 19 | 4204162e2e1d1320861479357a07921abc0f780f6207643c420407000000fc02000020027d02 20 | 0000040000002d01000004000000f00102000c000000240304008b1e8016ec1b141bed200c18 21 | 8b1e801607000000fc020000473e9a020000040000002d01020004000000f00100000e000000 22 | 24030500541b0b18811d7e137427400d901b3f12541b0b1807000000fc020000ffff94020000 23 | 040000002d01000004000000f00102000c0000002403040038375905661353080819470d3837 24 | 590507000000fc020000b2aa60020000040000002d01020004000000f00100000c0000002403 25 | 0400d929f218742d6e1b05390207d929f21807000000fc020000000000020000040000002d01 26 | 000004000000f00102000c000000240304008f0064000d020c020c1ee4008f0064000c000000 27 | 24030400a937521fcc36a31d863e280ca937521f040000002701ffff030000000000 28 | } after.\par 29 | \par 30 | END OF DOCUMENT\par 31 | } 32 | -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_8.rtf.wmf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_8.rtf.wmf -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_8.rtf.wmf.hex: -------------------------------------------------------------------------------- 1 | d7cdc69a000000000100140a15059f05000000008e5d0100090000031b010000030012000000 2 | 0000030000001e000400000002010100050000000b0206000000050000000c0270203e400400 3 | 00000701030007000000160476203e4006000000040000000601010007000000fc0200000000 4 | 00020000040000002d01000009000000fa02050001000000000000022200040000002d010100 5 | 1200000024030700983fb702a32e4620502338199e1a6b1e6a18fe10800ae405983fb7020700 6 | 0000fc020000e0c953020000040000002d01020004000000f00100001200000024030700643c 7 | 4204162e2e1d1320861479357a07921abc0f780f6207643c420407000000fc02000020027d02 8 | 0000040000002d01000004000000f00102000c000000240304008b1e8016ec1b141bed200c18 9 | 8b1e801607000000fc020000473e9a020000040000002d01020004000000f00100000e000000 10 | 24030500541b0b18811d7e137427400d901b3f12541b0b1807000000fc020000ffff94020000 11 | 040000002d01000004000000f00102000c0000002403040038375905661353080819470d3837 12 | 590507000000fc020000b2aa60020000040000002d01020004000000f00100000c0000002403 13 | 0400d929f218742d6e1b05390207d929f21807000000fc020000000000020000040000002d01 14 | 000004000000f00102000c000000240304008f0064000d020c020c1ee4008f0064000c000000 15 | 24030400a937521fcc36a31d863e280ca937521f040000002701ffff030000000000 -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_8.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_8.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_9.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_9.txt -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_fail_0.rtf: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_fail_1.rtf: -------------------------------------------------------------------------------- 1 | {\rtf} -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_fail_2.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0} -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_fail_3.rtf: -------------------------------------------------------------------------------- 1 | {\foobar} -------------------------------------------------------------------------------- /InterpreterTests/RtfInterpreterTest/RtfInterpreterTest_fail_4.rtf: -------------------------------------------------------------------------------- 1 | {\rtf2} -------------------------------------------------------------------------------- /InterpreterTests/Strings.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : CodeResources.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Resources; 10 | using Itenso.Sys; 11 | 12 | namespace Itenso.Rtf.InterpreterTests 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Provides strongly typed resource access for this namespace. 17 | internal sealed class Strings : StringsBase 18 | { 19 | 20 | // ---------------------------------------------------------------------- 21 | public static ResourceManager Instance 22 | { 23 | get { return inst; } 24 | } // Instance 25 | 26 | // ---------------------------------------------------------------------- 27 | public static string ProgramPressAnyKeyToQuit 28 | { 29 | get { return inst.GetString( "ProgramPressAnyKeyToQuit" ); } 30 | } // ProgramPressAnyKeyToQuit 31 | 32 | // ---------------------------------------------------------------------- 33 | // members 34 | private static readonly ResourceManager inst = NewInst( typeof( Strings ) ); 35 | 36 | } // class CodeResources 37 | 38 | } // namespace Itenso.Rtf.InterpreterTests 39 | // -- EOF ------------------------------------------------------------------- 40 | -------------------------------------------------------------------------------- /MyRTF2HTML/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RTF2HTML")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("RTF2HTML")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8807ef83-d9b7-40e0-bdf2-2eeb51d68dba")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Parser/IRtfElement.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfElement.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfElement 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | RtfElementKind Kind { get; } 19 | 20 | // ---------------------------------------------------------------------- 21 | void Visit( IRtfElementVisitor visitor ); 22 | 23 | } // interface IRtfElement 24 | 25 | } // namespace Itenso.Rtf 26 | // -- EOF ------------------------------------------------------------------- 27 | -------------------------------------------------------------------------------- /Parser/IRtfElementCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfElementCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfElementCollection : IEnumerable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | int Count { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | IRtfElement this[ int index ] { get; } 23 | 24 | // ---------------------------------------------------------------------- 25 | void CopyTo( IRtfElement[] array, int index ); 26 | 27 | } // interface IRtfElementCollection 28 | 29 | } // namespace Itenso.Rtf 30 | // -- EOF ------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /Parser/IRtfElementVisitor.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfElementVisitor.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfElementVisitor 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | void VisitTag( IRtfTag tag ); 19 | 20 | // ---------------------------------------------------------------------- 21 | void VisitGroup( IRtfGroup group ); 22 | 23 | // ---------------------------------------------------------------------- 24 | void VisitText( IRtfText text ); 25 | 26 | } // interface IRtfElementVisitor 27 | 28 | } // namespace Itenso.Rtf 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /Parser/IRtfGroup.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfGroup.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfGroup : IRtfElement 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | IRtfElementCollection Contents { get; } 20 | 21 | // ---------------------------------------------------------------------- 22 | /// 23 | /// Returns the name of the first element if it is a tag, null otherwise. 24 | /// 25 | string Destination { get; } 26 | 27 | // ---------------------------------------------------------------------- 28 | /// 29 | /// Determines whether the first element is a '\*' tag. 30 | /// 31 | bool IsExtensionDestination { get; } 32 | 33 | // ---------------------------------------------------------------------- 34 | /// 35 | /// Searches for the first child group which has a tag with the given name 36 | /// as its first child, e.g. the given destination. 37 | /// 38 | /// the name of the start tag of the group to search 39 | /// the first matching group or null if nothing found 40 | /// in case of a null argument 41 | IRtfGroup SelectChildGroupWithDestination( string destination ); 42 | 43 | } // interface IRtfGroup 44 | 45 | } // namespace Itenso.Rtf 46 | // -- EOF ------------------------------------------------------------------- 47 | -------------------------------------------------------------------------------- /Parser/IRtfSource.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfSource.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.IO; 10 | 11 | namespace Itenso.Rtf 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface IRtfSource 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | TextReader Reader { get; } 20 | 21 | } // interface IRtfSource 22 | 23 | } // namespace Itenso.Rtf 24 | // -- EOF ------------------------------------------------------------------- 25 | -------------------------------------------------------------------------------- /Parser/IRtfTag.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfTag.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfTag : IRtfElement 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | /// 19 | /// Returns the name together with the concatenated value as it stands in the rtf. 20 | /// 21 | string FullName { get; } 22 | 23 | // ---------------------------------------------------------------------- 24 | string Name { get; } 25 | 26 | // ---------------------------------------------------------------------- 27 | bool HasValue { get; } 28 | 29 | // ---------------------------------------------------------------------- 30 | string ValueAsText { get; } 31 | 32 | // ---------------------------------------------------------------------- 33 | int ValueAsNumber { get; } 34 | 35 | } // interface IRtfTag 36 | 37 | } // namespace Itenso.Rtf 38 | // -- EOF ------------------------------------------------------------------- 39 | -------------------------------------------------------------------------------- /Parser/IRtfText.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IRtfText.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IRtfText : IRtfElement 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | string Text { get; } 19 | 20 | } // interface IRtfText 21 | 22 | } // namespace Itenso.Rtf 23 | // -- EOF ------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Parser/Model/ReadOnlyBaseCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ReadOnlyBaseCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | using Itenso.Sys; 11 | using Itenso.Sys.Collection; 12 | 13 | namespace Itenso.Rtf.Model 14 | { 15 | 16 | // ------------------------------------------------------------------------ 17 | public abstract class ReadOnlyBaseCollection : ReadOnlyCollectionBase 18 | { 19 | 20 | // ---------------------------------------------------------------------- 21 | public sealed override bool Equals( object obj ) 22 | { 23 | if ( obj == this ) 24 | { 25 | return true; 26 | } 27 | 28 | if ( obj == null || GetType() != obj.GetType() ) 29 | { 30 | return false; 31 | } 32 | 33 | return IsEqual( obj ); 34 | } // Equals 35 | 36 | // ---------------------------------------------------------------------- 37 | public override string ToString() 38 | { 39 | return CollectionTool.ToString( this ); 40 | } // ToString 41 | 42 | // ---------------------------------------------------------------------- 43 | protected virtual bool IsEqual( object obj ) 44 | { 45 | return CollectionTool.AreEqual( this, obj ); 46 | } // IsEqual 47 | 48 | // ---------------------------------------------------------------------- 49 | public sealed override int GetHashCode() 50 | { 51 | return HashTool.AddHashCode( GetType().GetHashCode(), ComputeHashCode() ); 52 | } // GetHashCode 53 | 54 | // ---------------------------------------------------------------------- 55 | protected virtual int ComputeHashCode() 56 | { 57 | return HashTool.ComputeHashCode( this ); 58 | } // ComputeHashCode 59 | 60 | } // class ReadOnlyBaseCollection 61 | 62 | } // namespace Itenso.Rtf.Model 63 | // -- EOF ------------------------------------------------------------------- 64 | -------------------------------------------------------------------------------- /Parser/Model/RtfElementCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfElementCollection.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Rtf.Model 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public sealed class RtfElementCollection : ReadOnlyBaseCollection, IRtfElementCollection 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public IRtfElement this[ int index ] 20 | { 21 | get { return InnerList[ index ] as IRtfElement; } 22 | } // this[ int ] 23 | 24 | // ---------------------------------------------------------------------- 25 | public void CopyTo( IRtfElement[] array, int index ) 26 | { 27 | InnerList.CopyTo( array, index ); 28 | } // CopyTo 29 | 30 | // ---------------------------------------------------------------------- 31 | public void Add( IRtfElement item ) 32 | { 33 | if ( item == null ) 34 | { 35 | throw new ArgumentNullException( "item" ); 36 | } 37 | InnerList.Add( item ); 38 | } // Add 39 | 40 | // ---------------------------------------------------------------------- 41 | public void Clear() 42 | { 43 | InnerList.Clear(); 44 | } // Clear 45 | 46 | } // class RtfElementCollection 47 | 48 | } // namespace Itenso.Rtf.Model 49 | // -- EOF ------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /Parser/Model/RtfText.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfText.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using Itenso.Sys; 11 | 12 | namespace Itenso.Rtf.Model 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public sealed class RtfText : RtfElement, IRtfText 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public RtfText( string text ) 21 | : base( RtfElementKind.Text ) 22 | { 23 | if ( text == null ) 24 | { 25 | throw new ArgumentNullException( "text" ); 26 | } 27 | this.text = text; 28 | } // RtfText 29 | 30 | // ---------------------------------------------------------------------- 31 | public string Text 32 | { 33 | get { return text; } 34 | } // Text 35 | 36 | // ---------------------------------------------------------------------- 37 | public override string ToString() 38 | { 39 | return text; 40 | } // ToString 41 | 42 | // ---------------------------------------------------------------------- 43 | protected override void DoVisit( IRtfElementVisitor visitor ) 44 | { 45 | visitor.VisitText( this ); 46 | } // DoVisit 47 | 48 | // ---------------------------------------------------------------------- 49 | protected override bool IsEqual( object obj ) 50 | { 51 | RtfText compare = obj as RtfText; // guaranteed to be non-null 52 | return compare != null && base.IsEqual( obj ) && 53 | text.Equals( compare.text ); 54 | } // IsEqual 55 | 56 | // ---------------------------------------------------------------------- 57 | protected override int ComputeHashCode() 58 | { 59 | return HashTool.AddHashCode( base.ComputeHashCode(), text ); 60 | } // ComputeHashCode 61 | 62 | // ---------------------------------------------------------------------- 63 | // members 64 | private readonly string text; 65 | 66 | } // class RtfText 67 | 68 | } // namespace Itenso.Rtf.Model 69 | // -- EOF ------------------------------------------------------------------- 70 | -------------------------------------------------------------------------------- /Parser/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : AssemblyInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.05.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Security.Permissions; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle( "Itenso RTF Parser" )] 18 | [assembly: AssemblyDescription( "Itenso RTF Parser" )] 19 | [assembly: AssemblyConfiguration( "" )] 20 | [assembly: AssemblyCompany( "Itenso GmbH" )] 21 | [assembly: AssemblyProduct( "Itenso RTF Parser" )] 22 | [assembly: AssemblyCopyright( "Copyright © Itenso GmbH 2010" )] 23 | [assembly: AssemblyTrademark( "" )] 24 | [assembly: AssemblyCulture( "" )] 25 | [assembly: ComVisible( false )] 26 | [assembly: SecurityPermission( SecurityAction.RequestMinimum, Assertion = true )] 27 | [assembly: CLSCompliant( true )] 28 | 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /Parser/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.05.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Rtf.Parser 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Rtf.Parser 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Parser/RtfBraceNestingException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfBraceNestingException.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2009.02.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfBraceNestingException : RtfStructureException 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfBraceNestingException() 24 | { 25 | } // RtfBraceNestingException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfBraceNestingException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfBraceNestingException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfBraceNestingException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfBraceNestingException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfBraceNestingException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfBraceNestingException 52 | 53 | } // class RtfBraceNestingException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Parser/RtfElementKind.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfElementKind.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Rtf 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public enum RtfElementKind 15 | { 16 | Tag, 17 | Group, 18 | Text 19 | } // enum RtfElementKind 20 | 21 | } // namespace Itenso.Rtf 22 | // -- EOF ------------------------------------------------------------------- 23 | -------------------------------------------------------------------------------- /Parser/RtfEncodingException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfEncodingException.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2009.02.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfEncodingException : RtfParserException 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfEncodingException() 24 | { 25 | } // RtfEncodingException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfEncodingException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfEncodingException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfEncodingException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfEncodingException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfEncodingException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfEncodingException 52 | 53 | } // class RtfEncodingException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Parser/RtfException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfException.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfException : Exception 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfException() 24 | { 25 | } // RtfException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfException 52 | 53 | } // class RtfException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Parser/RtfHexEncodingException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfHexEncodingException.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2009.02.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfHexEncodingException : RtfEncodingException 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfHexEncodingException() 24 | { 25 | } // RtfHexEncodingException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfHexEncodingException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfHexEncodingException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfHexEncodingException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfHexEncodingException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfHexEncodingException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfHexEncodingException 52 | 53 | } // class RtfHexEncodingException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Parser/RtfParserException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfParserException.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2009.02.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfParserException : RtfException 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfParserException() 24 | { 25 | } // RtfParserException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfParserException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfParserException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfParserException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfParserException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfParserException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfParserException 52 | 53 | } // class RtfParserException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Parser/RtfStructureException.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfStructureException.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2009.02.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | namespace Itenso.Rtf 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Thrown upon RTF specific error conditions. 17 | [Serializable] 18 | public class RtfStructureException : RtfParserException 19 | { 20 | 21 | // ---------------------------------------------------------------------- 22 | /// Creates a new instance. 23 | public RtfStructureException() 24 | { 25 | } // RtfStructureException 26 | 27 | // ---------------------------------------------------------------------- 28 | /// Creates a new instance with the given message. 29 | /// the message to display 30 | public RtfStructureException( string message ) 31 | : base( message ) 32 | { 33 | } // RtfStructureException 34 | 35 | // ---------------------------------------------------------------------- 36 | /// Creates a new instance with the given message, based on the given cause. 37 | /// the message to display 38 | /// the original cause for this exception 39 | public RtfStructureException( string message, Exception cause ) 40 | : base( message, cause ) 41 | { 42 | } // RtfStructureException 43 | 44 | // ---------------------------------------------------------------------- 45 | /// Serialization support. 46 | /// the info to use for serialization 47 | /// the context to use for serialization 48 | protected RtfStructureException( SerializationInfo info, StreamingContext context ) : 49 | base( info, context ) 50 | { 51 | } // RtfStructureException 52 | 53 | } // class RtfStructureException 54 | 55 | } // namespace Itenso.Rtf 56 | // -- EOF ------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /Parser/Support/RtfParserTool.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfParserTool.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.IO; 10 | using Itenso.Rtf.Parser; 11 | 12 | namespace Itenso.Rtf.Support 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public static class RtfParserTool 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public static IRtfGroup Parse( string rtfText, params IRtfParserListener[] listeners ) 21 | { 22 | return Parse( new RtfSource( rtfText ), listeners ); 23 | } // Parse 24 | 25 | // ---------------------------------------------------------------------- 26 | public static IRtfGroup Parse( TextReader rtfTextSource, params IRtfParserListener[] listeners ) 27 | { 28 | return Parse( new RtfSource( rtfTextSource ), listeners ); 29 | } // Parse 30 | 31 | // ---------------------------------------------------------------------- 32 | public static IRtfGroup Parse( Stream rtfTextSource, params IRtfParserListener[] listeners ) 33 | { 34 | return Parse( new RtfSource( rtfTextSource ), listeners ); 35 | } // Parse 36 | 37 | // ---------------------------------------------------------------------- 38 | public static IRtfGroup Parse( IRtfSource rtfTextSource, params IRtfParserListener[] listeners ) 39 | { 40 | RtfParserListenerStructureBuilder structureBuilder = new RtfParserListenerStructureBuilder(); 41 | RtfParser parser = new RtfParser( structureBuilder ); 42 | if ( listeners != null ) 43 | { 44 | foreach ( IRtfParserListener listener in listeners ) 45 | { 46 | if ( listener != null ) 47 | { 48 | parser.AddParserListener( listener ); 49 | } 50 | } 51 | } 52 | parser.Parse( rtfTextSource ); 53 | return structureBuilder.StructureRoot; 54 | } // Parse 55 | 56 | } // class RtfParserTool 57 | 58 | } // namespace Itenso.Rtf.Support 59 | // -- EOF ------------------------------------------------------------------- 60 | -------------------------------------------------------------------------------- /Parser/Support/RtfSource.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : RtfSource.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.20 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.IO; 11 | 12 | namespace Itenso.Rtf.Support 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public sealed class RtfSource : IRtfSource 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public RtfSource( string rtf ) 21 | { 22 | if ( rtf == null ) 23 | { 24 | throw new ArgumentNullException( "rtf" ); 25 | } 26 | reader = new StringReader( rtf ); 27 | } // RtfSource 28 | 29 | // ---------------------------------------------------------------------- 30 | public RtfSource( TextReader rtf ) 31 | { 32 | if ( rtf == null ) 33 | { 34 | throw new ArgumentNullException( "rtf" ); 35 | } 36 | reader = rtf; 37 | } // RtfSource 38 | 39 | // ---------------------------------------------------------------------- 40 | public RtfSource( Stream rtf ) 41 | { 42 | if ( rtf == null ) 43 | { 44 | throw new ArgumentNullException( "rtf" ); 45 | } 46 | reader = new StreamReader( rtf, RtfSpec.AnsiEncoding ); 47 | } // RtfSource 48 | 49 | // ---------------------------------------------------------------------- 50 | public TextReader Reader 51 | { 52 | get { return reader; } 53 | } // Reader 54 | 55 | // ---------------------------------------------------------------------- 56 | // members 57 | private readonly TextReader reader; 58 | 59 | } // class RtfSource 60 | 61 | } // namespace Itenso.Rtf.Support 62 | // -- EOF ------------------------------------------------------------------- 63 | -------------------------------------------------------------------------------- /ParserTests/Program.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : Program.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using Itenso.Sys.Test; 10 | 11 | namespace Itenso.Rtf.ParserTests 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | class Program 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | static void Main( string[] args ) 20 | { 21 | ConsoleRunner.Execute( typeof( Program ).Assembly, args ); 22 | } // Main 23 | 24 | } // class Program 25 | 26 | } // namespace Itenso.Rtf.ParserTests 27 | // -- EOF ------------------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /ParserTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : AssemblyInfo.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Security.Permissions; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle( "Itenso RTF Parser Tests" )] 18 | [assembly: AssemblyDescription( "Itenso RTF Parser Tests" )] 19 | [assembly: AssemblyConfiguration( "" )] 20 | [assembly: AssemblyCompany( "Itenso GmbH" )] 21 | [assembly: AssemblyProduct( "Itenso RTF Parser" )] 22 | [assembly: AssemblyCopyright( "Copyright © Itenso GmbH 2010" )] 23 | [assembly: AssemblyTrademark( "" )] 24 | [assembly: AssemblyCulture( "" )] 25 | [assembly: ComVisible( false )] 26 | [assembly: SecurityPermission( SecurityAction.RequestMinimum, Assertion = true )] 27 | [assembly: CLSCompliant( true )] 28 | 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /ParserTests/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion("1.3.0.0")] 19 | 20 | namespace Itenso.Rtf.ParserTests 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Rtf.ParserTests 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_0.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\deff0 2 | {\fonttbl 3 | {\f0 Times New Roman;} 4 | {\f2 Courier New;} 5 | } 6 | {\*\generator Microsoft Word 10.0.2627;} 7 | {\fs32 Hello world} in {\f2\b\fs32 \{RTF\}}\'85 8 | \par 9 | \par 10 | } 11 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_2.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\deff0{\fonttbl{\f0 Times New Roman;}{\f2 Courier New;}}{\*\generator Microsoft Word 10.0.2627;}{\fs32 Hello world} in {\f2\b\fs32 \{RTF\}}\'85\par\par} -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_4.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fmodern\fprq1\fcharset128 MS Gothic;}{\f1\fswiss\fcharset0 Arial;}} 2 | {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1033\kerning2\ul\b\f0\fs40\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'83\'41\'83\'62\'83\'76\'92\'8d\'95\'b6\'8f\'91\'81\'69\'8b\'e2\'8d\'73\'90\'55\'8d\'9e\'81\'6a\lang1031\kerning0\ulnone\b0\f1\fs20\par 3 | } 4 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_fail_0.rtf: -------------------------------------------------------------------------------- 1 | /{\rtf1\deff0 2 | {\fonttbl 3 | {\f0 Times New Roman;} 4 | {\f2 Courier New;} 5 | } 6 | {\*\generator Microsoft Word 10.0.2627;} 7 | {\fs32 Hello world} in {\f2\b\fs32 \{RTF\}}\'85 8 | \par 9 | \par 10 | } 11 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_fail_1.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\deff0 2 | {\fonttbl 3 | {\f0 Times New Roman;} 4 | {\f2 Courier New;} 5 | } 6 | {\*\generator Microsoft Word 10.0.2627;} 7 | {\fs32 Hello world} in {\f2\b\fs32 \{RTF\}}\'85 8 | \par 9 | \par 10 | }- 11 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_fail_2.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\deff0 2 | {\fonttbl 3 | {\f0 Times New Roman;} 4 | {\f2 Courier New;} 5 | } 6 | {\*\generator Microsoft Word 10.0.2627;} 7 | {\fs32 Hello world} in {\f2\b\fs32 \{RTF\}}\'85 8 | \par 9 | \par 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_fail_3.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\deff0 2 | {\fonttbl 3 | {\f0 Times New Roman;} 4 | {\f2 Courier New;} 5 | } 6 | {\*\generator Microsoft Word 10.0.2627;} 7 | {\fs32 Hello world} in {\f2\b\fs32 \{RTF\}}\'85 8 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_fail_4.rtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/ParserTests/RtfParserTest/RtfParserTest_fail_4.rtf -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_fail_5.rtf: -------------------------------------------------------------------------------- 1 | foobar 2 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/RtfParserTest_fail_6.rtf: -------------------------------------------------------------------------------- 1 | \foobar 2 | -------------------------------------------------------------------------------- /ParserTests/RtfParserTest/minimal.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1foobar} -------------------------------------------------------------------------------- /ParserTests/Strings.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : CodeResources.cs 3 | // project : RTF Framelet 4 | // created : Leon Poyyayil - 2008.05.19 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Resources; 10 | using Itenso.Sys; 11 | 12 | namespace Itenso.Rtf.ParserTests 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// Provides strongly typed resource access for this namespace. 17 | internal sealed class Strings : StringsBase 18 | { 19 | 20 | 21 | // ---------------------------------------------------------------------- 22 | public static string ProgramPressAnyKeyToQuit 23 | { 24 | get { return inst.GetString( "ProgramPressAnyKeyToQuit" ); } 25 | } // ProgramPressAnyKeyToQuit 26 | 27 | // ---------------------------------------------------------------------- 28 | // members 29 | private static readonly ResourceManager inst = NewInst( typeof( Strings ) ); 30 | 31 | } // class CodeResources 32 | 33 | } // namespace Itenso.Rtf.ParserTests 34 | // -- EOF ------------------------------------------------------------------- 35 | -------------------------------------------------------------------------------- /ReadMe.txt: -------------------------------------------------------------------------------- 1 | In this Project i made an RTF to HTML Converter Class Library based on: 2 | Writing Your Own RTF Converter 3 | By Jani Giannoudis | 26 Apr 2011 4 | http://www.codeproject.com/Articles/27431/Writing-Your-Own-RTF-Converter -------------------------------------------------------------------------------- /Rtf2Html/App.config: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Rtf2Html/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/Rtf2Html/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /Rtf2Html/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.05.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Solutions.Community.Rtf2Html 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Solutions.Community.Rtf2Html 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Rtf2Raw/App.config: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Rtf2Raw/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/Rtf2Raw/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /Rtf2Raw/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.05.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Solutions.Community.Rtf2Raw 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Solutions.Community.Rtf2Raw 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Rtf2Raw2008.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 10.00 2 | # Visual Studio 2008 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sys", "Sys\Sys2008.csproj", "{1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}" 4 | EndProject 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Parser", "Parser\Parser2008.csproj", "{210DBD13-A7B0-430A-AEB4-7E558CA61A46}" 6 | EndProject 7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interpreter", "Interpreter\Interpreter2008.csproj", "{3F1B94DC-2EE6-4674-A2DE-E60FFC63A1D9}" 8 | EndProject 9 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rtf2Raw", "Rtf2Raw\Rtf2Raw2008.csproj", "{879F1DF6-4280-4906-96EE-0B7CD1EF12A0}" 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 13 | Debug|Any CPU = Debug|Any CPU 14 | Release|Any CPU = Release|Any CPU 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 18 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Release|Any CPU.Build.0 = Release|Any CPU 21 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {3F1B94DC-2EE6-4674-A2DE-E60FFC63A1D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {3F1B94DC-2EE6-4674-A2DE-E60FFC63A1D9}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {3F1B94DC-2EE6-4674-A2DE-E60FFC63A1D9}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {3F1B94DC-2EE6-4674-A2DE-E60FFC63A1D9}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {879F1DF6-4280-4906-96EE-0B7CD1EF12A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {879F1DF6-4280-4906-96EE-0B7CD1EF12A0}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {879F1DF6-4280-4906-96EE-0B7CD1EF12A0}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {879F1DF6-4280-4906-96EE-0B7CD1EF12A0}.Release|Any CPU.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | GlobalSection(SolutionProperties) = preSolution 35 | HideSolutionNode = FALSE 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /Rtf2Xml/App.config: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Rtf2Xml/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/Rtf2Xml/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /Rtf2Xml/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.06.10 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Solutions.Community.Rtf2Xml 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Solutions.Community.Rtf2Xml 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /RtfParser2008.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sys", "Sys\Sys2008.csproj", "{1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Parser", "Parser\Parser2008.csproj", "{210DBD13-A7B0-430A-AEB4-7E558CA61A46}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParserTests", "ParserTests\ParserTests2008.csproj", "{BEED28BE-89AD-468B-ABE8-D0938A49EB87}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {BEED28BE-89AD-468B-ABE8-D0938A49EB87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {BEED28BE-89AD-468B-ABE8-D0938A49EB87}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {BEED28BE-89AD-468B-ABE8-D0938A49EB87}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {BEED28BE-89AD-468B-ABE8-D0938A49EB87}.Release|Any CPU.Build.0 = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /RtfParser2010.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2010 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sys2008", "Sys\Sys2010.csproj", "{1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}" 4 | EndProject 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Parser2008", "Parser\Parser2010.csproj", "{210DBD13-A7B0-430A-AEB4-7E558CA61A46}" 6 | EndProject 7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParserTests2008", "ParserTests\ParserTests2010.csproj", "{BEED28BE-89AD-468B-ABE8-D0938A49EB87}" 8 | EndProject 9 | Global 10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 11 | Debug|Any CPU = Debug|Any CPU 12 | Release|Any CPU = Release|Any CPU 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 16 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Debug|Any CPU.Build.0 = Debug|Any CPU 17 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Release|Any CPU.ActiveCfg = Release|Any CPU 18 | {1A9A64A4-3BDD-467D-ADB3-58BEDBBDEB4E}.Release|Any CPU.Build.0 = Release|Any CPU 19 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {210DBD13-A7B0-430A-AEB4-7E558CA61A46}.Release|Any CPU.Build.0 = Release|Any CPU 23 | {BEED28BE-89AD-468B-ABE8-D0938A49EB87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {BEED28BE-89AD-468B-ABE8-D0938A49EB87}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {BEED28BE-89AD-468B-ABE8-D0938A49EB87}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {BEED28BE-89AD-468B-ABE8-D0938A49EB87}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /RtfWinForms/Program.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : Program.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.07.30 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Windows.Forms; 11 | 12 | namespace Itenso.Solutions.Community.RtfConverter.RtfWinForms 13 | { 14 | // ------------------------------------------------------------------------ 15 | static class Program 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | [STAThread] 20 | static void Main() 21 | { 22 | Application.EnableVisualStyles(); 23 | Application.SetCompatibleTextRenderingDefault( false ); 24 | Application.Run( new RtfForm() ); 25 | } // Main 26 | 27 | } // class Program 28 | 29 | } // namespace Itenso.Solutions.Community.RtfConverter.RtfWinForms 30 | // -- EOF ------------------------------------------------------------------- -------------------------------------------------------------------------------- /RtfWinForms/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : AssemblyInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.07.30 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Security.Permissions; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle( "Itenso RTF Windows Forms" )] 18 | [assembly: AssemblyDescription( "Itenso RTF Windows Forms" )] 19 | [assembly: AssemblyConfiguration( "" )] 20 | [assembly: AssemblyCompany( "Itenso GmbH" )] 21 | [assembly: AssemblyProduct( "Itenso RTF Windows Forms" )] 22 | [assembly: AssemblyCopyright( "Copyright © Itenso GmbH 2010" )] 23 | [assembly: AssemblyTrademark( "" )] 24 | [assembly: AssemblyCulture( "" )] 25 | [assembly: ComVisible( false )] 26 | [assembly: SecurityPermission( SecurityAction.RequestMinimum, Assertion = true )] 27 | [assembly: CLSCompliant( true )] 28 | 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /RtfWinForms/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.07.30 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Solutions.Community.RtfConverter.RtfWindows 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Solutions.Community.RtfConverter.RtfWindows 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /RtfWindows/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /RtfWindows/App.xaml.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : App.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.07.29 5 | // language : c# 6 | // environment: .NET 3.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Solutions.Community.RtfConverter.RtfWindows 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public partial class App 15 | { 16 | } // class App 17 | 18 | } // namespace Itenso.Solutions.Community.RtfConverter.RtfWindows 19 | // -- EOF ------------------------------------------------------------------- -------------------------------------------------------------------------------- /RtfWindows/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : AssemblyInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.07.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Security.Permissions; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle( "Itenso RTF Windows" )] 18 | [assembly: AssemblyDescription( "Itenso RTF Windows" )] 19 | [assembly: AssemblyConfiguration( "" )] 20 | [assembly: AssemblyCompany( "Itenso GmbH" )] 21 | [assembly: AssemblyProduct( "Itenso RTF Windows" )] 22 | [assembly: AssemblyCopyright( "Copyright © Itenso GmbH 2010" )] 23 | [assembly: AssemblyTrademark( "" )] 24 | [assembly: AssemblyCulture( "" )] 25 | [assembly: ComVisible( false )] 26 | [assembly: SecurityPermission( SecurityAction.RequestMinimum, Assertion = true )] 27 | [assembly: CLSCompliant( true )] 28 | 29 | // -- EOF ------------------------------------------------------------------- 30 | -------------------------------------------------------------------------------- /RtfWindows/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : RTF Framelet 4 | // created : Jani Giannoudis - 2008.07.29 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion( "1.3.0.0" )] 19 | 20 | namespace Itenso.Solutions.Community.RtfConverter.RtfWindows 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Solutions.Community.RtfConverter.RtfWindows 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Sys/Application/ApplicationArguments.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ApplicationArguments.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2008.06.03 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Sys.Application 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public class ApplicationArguments 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public ArgumentCollection Arguments 20 | { 21 | get { return arguments; } 22 | } // Arguments 23 | 24 | // ---------------------------------------------------------------------- 25 | public bool IsValid 26 | { 27 | get { return arguments.IsValid; } 28 | } // IsValid 29 | 30 | // ---------------------------------------------------------------------- 31 | public bool IsHelpMode 32 | { 33 | get 34 | { 35 | foreach ( IArgument argument in arguments ) 36 | { 37 | if ( argument is HelpModeArgument ) 38 | { 39 | return (bool)argument.Value; 40 | } 41 | } 42 | return false; 43 | } 44 | } // IsHelpMode 45 | 46 | // ---------------------------------------------------------------------- 47 | public void Load() 48 | { 49 | string[] commandLineArgs = Environment.GetCommandLineArgs(); 50 | 51 | // skip zeron index which contians the program name 52 | for ( int i = 1; i < commandLineArgs.Length; i++ ) 53 | { 54 | string commandLineArg = commandLineArgs[ i ]; 55 | foreach ( IArgument argument in arguments ) 56 | { 57 | if ( argument.IsLoaded ) 58 | { 59 | continue; 60 | } 61 | argument.Load( commandLineArg ); 62 | if ( argument.IsLoaded ) 63 | { 64 | break; 65 | } 66 | } 67 | } 68 | } // Load 69 | 70 | // ---------------------------------------------------------------------- 71 | // members 72 | private readonly ArgumentCollection arguments = new ArgumentCollection(); 73 | 74 | } // class ApplicationArguments 75 | 76 | } // namespace Itenso.Sys.Application 77 | // -- EOF ------------------------------------------------------------------- 78 | -------------------------------------------------------------------------------- /Sys/Application/ArgumentCollection.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ArgumentCollection.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2008.06.03 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Collections; 11 | 12 | namespace Itenso.Sys.Application 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | public sealed class ArgumentCollection : ReadOnlyCollectionBase 17 | { 18 | 19 | // ---------------------------------------------------------------------- 20 | public IArgument this[ int index ] 21 | { 22 | get { return InnerList[ index ] as IArgument; } 23 | } // this[ int ] 24 | 25 | // ---------------------------------------------------------------------- 26 | public bool IsValid 27 | { 28 | get 29 | { 30 | foreach ( IArgument argument in InnerList ) 31 | { 32 | if ( !argument.IsValid ) 33 | { 34 | return false; 35 | } 36 | } 37 | 38 | return true; 39 | } 40 | } // IsValid 41 | 42 | // ---------------------------------------------------------------------- 43 | public void CopyTo( IArgument[] array, int index ) 44 | { 45 | InnerList.CopyTo( array, index ); 46 | } // CopyTo 47 | 48 | // ---------------------------------------------------------------------- 49 | public void Add( IArgument item ) 50 | { 51 | if ( item == null ) 52 | { 53 | throw new ArgumentNullException( "item" ); 54 | } 55 | InnerList.Add( item ); 56 | } // Add 57 | 58 | // ---------------------------------------------------------------------- 59 | public void Clear() 60 | { 61 | InnerList.Clear(); 62 | } // Clear 63 | 64 | } // class ArgumentCollection 65 | 66 | } // namespace Itenso.Sys.Application 67 | // -- EOF ------------------------------------------------------------------- 68 | -------------------------------------------------------------------------------- /Sys/Application/ArgumentType.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ArgumentInfo.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2008.06.03 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Sys.Application 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | [Flags] 16 | public enum ArgumentType 17 | { 18 | None = 0x00000000, 19 | Mandatory = 0x00000001, 20 | HasName = 0x00000002, 21 | ContainsValue = 0x00000004, 22 | } // class ArgumentType 23 | 24 | } // namespace Itenso.Sys.Application 25 | // -- EOF ------------------------------------------------------------------- 26 | -------------------------------------------------------------------------------- /Sys/Application/HelpModeArgument.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : HelpModeArgument.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2008.06.03 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | namespace Itenso.Sys.Application 10 | { 11 | 12 | // ------------------------------------------------------------------------ 13 | public class HelpModeArgument : ToggleArgument 14 | { 15 | 16 | // ---------------------------------------------------------------------- 17 | public const string HelpModeArgumentName = "?"; 18 | 19 | // ---------------------------------------------------------------------- 20 | public HelpModeArgument() 21 | : base( HelpModeArgumentName, false ) 22 | { 23 | } // HelpModeArgument 24 | 25 | } // class HelpModeArgument 26 | 27 | } // namespace Itenso.Sys.Application 28 | // -- EOF ------------------------------------------------------------------- 29 | -------------------------------------------------------------------------------- /Sys/Application/IArgument.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : IArgument.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2008.06.03 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Sys.Application 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public interface IArgument 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | string Name { get; } 19 | 20 | // ---------------------------------------------------------------------- 21 | object Value { get; } 22 | 23 | // ---------------------------------------------------------------------- 24 | object DefaultValue { get; } 25 | 26 | // ---------------------------------------------------------------------- 27 | bool IsMandatory { get; } 28 | 29 | // ---------------------------------------------------------------------- 30 | bool HasName { get; } 31 | 32 | // ---------------------------------------------------------------------- 33 | bool IsValid { get; } 34 | 35 | // ---------------------------------------------------------------------- 36 | bool IsLoaded { get; } 37 | 38 | // ---------------------------------------------------------------------- 39 | void Load( string commandLineArg ); 40 | 41 | } // interface IArgument 42 | 43 | } // namespace Itenso.Sys.Application 44 | // -- EOF ------------------------------------------------------------------- 45 | -------------------------------------------------------------------------------- /Sys/Application/NamedValueArgument.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : NamedValueArgument.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2008.06.03 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Sys.Application 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public class NamedValueArgument : Argument 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public NamedValueArgument( string name ) 20 | : this( ArgumentType.None, name, null ) 21 | { 22 | } // NamedValueArgument 23 | 24 | // ---------------------------------------------------------------------- 25 | public NamedValueArgument( string name, object defaultValue ) 26 | : this( ArgumentType.None, name, defaultValue ) 27 | { 28 | } // NamedValueArgument 29 | 30 | // ---------------------------------------------------------------------- 31 | public NamedValueArgument( ArgumentType argumentType, string name, object defaultValue ) 32 | : base( argumentType | ArgumentType.ContainsValue | ArgumentType.HasName, name, defaultValue ) 33 | { 34 | } // NamedValueArgument 35 | 36 | // ---------------------------------------------------------------------- 37 | public new string Value 38 | { 39 | get { return base.Value as string; } 40 | } // Value 41 | 42 | // ---------------------------------------------------------------------- 43 | public override string ToString() 44 | { 45 | return Name + "=" + Value; 46 | } // ToString 47 | 48 | // ---------------------------------------------------------------------- 49 | protected override bool OnLoad( string commandLineArg ) 50 | { 51 | // format: /name:value 52 | string valueName = Name + ":"; 53 | if ( !commandLineArg.StartsWith( valueName, StringComparison.InvariantCultureIgnoreCase ) ) 54 | { 55 | return false; 56 | } 57 | 58 | base.Value = commandLineArg.Substring( valueName.Length ); 59 | return true; 60 | } // OnLoad 61 | 62 | } // class NamedValueArgument 63 | 64 | } // namespace Itenso.Sys.Application 65 | // -- EOF ------------------------------------------------------------------- 66 | -------------------------------------------------------------------------------- /Sys/Application/ValueArgument.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ValueArgument.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2008.06.03 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Sys.Application 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public class ValueArgument : Argument 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | public ValueArgument() 19 | : this( ArgumentType.None ) 20 | { 21 | } // ValueArgument 22 | 23 | // ---------------------------------------------------------------------- 24 | public ValueArgument( ArgumentType argumentType ) 25 | : base( argumentType | ArgumentType.ContainsValue, null, null ) 26 | { 27 | } // ValueArgument 28 | 29 | // ---------------------------------------------------------------------- 30 | public new string Value 31 | { 32 | get { return base.Value as string; } 33 | } // Value 34 | 35 | // ---------------------------------------------------------------------- 36 | public override string ToString() 37 | { 38 | return Value; 39 | } // ToString 40 | 41 | // ---------------------------------------------------------------------- 42 | protected override bool OnLoad( string commandLineArg ) 43 | { 44 | base.Value = commandLineArg; 45 | return true; 46 | } // OnLoad 47 | 48 | } // class ValueArgument 49 | 50 | } // namespace Itenso.Sys.Application 51 | // -- EOF ------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /Sys/CompareTool.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : CompareTool.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2005.05.12 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Sys 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | public static class CompareTool 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | public static bool AreEqual( object left, object right ) 19 | { 20 | return left == right || ( left != null && left.Equals( right ) ); 21 | } // AreEqual 22 | 23 | } // class CompareTool 24 | 25 | } // namespace Itenso.Sys 26 | // -- EOF ------------------------------------------------------------------- 27 | -------------------------------------------------------------------------------- /Sys/HashTool.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : HashTool.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2005.12.01 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Collections; 11 | 12 | namespace Itenso.Sys 13 | { 14 | 15 | // ------------------------------------------------------------------------ 16 | /// 17 | /// Some hash utility methods for collections. 18 | /// 19 | public static class HashTool 20 | { 21 | 22 | // ---------------------------------------------------------------------- 23 | public static int AddHashCode( int hash, object obj ) 24 | { 25 | int combinedHash = obj != null ? obj.GetHashCode() : 0; 26 | if ( hash != 0 ) // perform this check to prevent FxCop warning 'op could overflow' 27 | { 28 | combinedHash += hash * 31; 29 | } 30 | return combinedHash; 31 | } // AddHashCode 32 | 33 | // ---------------------------------------------------------------------- 34 | public static int AddHashCode( int hash, int objHash ) 35 | { 36 | int combinedHash = objHash; 37 | if ( hash != 0 ) // perform this check to prevent FxCop warning 'op could overflow' 38 | { 39 | combinedHash += hash * 31; 40 | } 41 | return combinedHash; 42 | } // AddHashCode 43 | 44 | // ---------------------------------------------------------------------- 45 | public static int ComputeHashCode( IEnumerable enumerable ) 46 | { 47 | int hash = 1; 48 | if ( enumerable == null ) 49 | { 50 | throw new ArgumentNullException( "enumerable" ); 51 | } 52 | foreach ( object item in enumerable ) 53 | { 54 | hash = hash * 31 + ( item != null ? item.GetHashCode() : 0 ); 55 | } 56 | return hash; 57 | } // ComputeHashCode 58 | 59 | } // class HashTool 60 | 61 | } // namespace Itenso.Sys 62 | // -- EOF ------------------------------------------------------------------- 63 | -------------------------------------------------------------------------------- /Sys/Logging/ILoggerEvent.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ILoggerEvent.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2006.05.12 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Sys.Logging 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public interface ILoggerEvent 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | /// the level of the logger event, always defined 20 | LoggerLevel Level { get; } 21 | 22 | // ---------------------------------------------------------------------- 23 | /// the source which generated the logger event, never null or empty 24 | string Source { get; } 25 | 26 | // ---------------------------------------------------------------------- 27 | /// the context in which the logger event occurred, never null but possibly empty 28 | string Context { get; } 29 | 30 | // ---------------------------------------------------------------------- 31 | /// the message of the logger event, never null but possibly empty 32 | string Message { get; } 33 | 34 | // ---------------------------------------------------------------------- 35 | /// the exception of the logger event, possibly null 36 | Exception CaughtException { get; } 37 | 38 | } // interface ILoggerEvent 39 | 40 | } // namespace Itenso.Sys.Logging 41 | // -- EOF ------------------------------------------------------------------- 42 | -------------------------------------------------------------------------------- /Sys/Logging/ILoggerListener.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ILoggerListener.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2006.05.12 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | namespace Itenso.Sys.Logging 10 | { 11 | 12 | // ------------------------------------------------------------------------ 13 | public interface ILoggerListener 14 | { 15 | 16 | // ---------------------------------------------------------------------- 17 | /// 18 | /// Called by an ILoggerMonitor to handle an event. 19 | /// 20 | /// the event to handle 21 | void Handle( ILoggerEvent loggerEvent ); 22 | 23 | } // interface ILoggerListener 24 | 25 | } // namespace Itenso.Sys.Logging 26 | // -- EOF ------------------------------------------------------------------- 27 | -------------------------------------------------------------------------------- /Sys/Logging/ILoggerMonitor.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ILoggerMonitor.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2006.05.12 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Sys.Logging 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | /// 15 | /// Allows monitoring ILogger instances for events they generate. 16 | /// 17 | /// 18 | /// A ILoggerListener may register itself for multiple contexts. 19 | /// When doing so it will need to unregister itself for each context for which 20 | /// it had registered itself previously. 21 | /// 22 | public interface ILoggerMonitor 23 | { 24 | 25 | // ---------------------------------------------------------------------- 26 | /// 27 | /// Registers a listener to handle events occurring in a given context. 28 | /// 29 | /// the listener to register 30 | /// the context for which to register the listener 31 | /// when given a null argument 32 | /// when given an empty context 33 | void Register( ILoggerListener loggerListener, string context ); 34 | 35 | // ---------------------------------------------------------------------- 36 | /// 37 | /// Unregisters a listener from handling events occurring in a given context. 38 | /// 39 | /// the listener to unregister 40 | /// the context for which to unregister the listener 41 | /// when given a null argument 42 | /// when given an empty context 43 | void Unregister( ILoggerListener loggerListener, string context ); 44 | 45 | } // interface ILoggerMonitor 46 | 47 | } // namespace Itenso.Sys.Logging 48 | // -- EOF ------------------------------------------------------------------- 49 | -------------------------------------------------------------------------------- /Sys/Logging/LoggerBase.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : LoggerBase.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2006.05.11 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Sys.Logging 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public abstract class LoggerBase 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public virtual string Context 20 | { 21 | get { return string.Empty; } 22 | } // Context 23 | 24 | // ---------------------------------------------------------------------- 25 | public virtual bool IsSupportedException( Exception exception ) 26 | { 27 | bool supported = true; 28 | 29 | if ( exception is System.Threading.ThreadAbortException ) 30 | { 31 | supported = false; 32 | } 33 | 34 | return supported; 35 | } // IsSupportedException 36 | 37 | // ---------------------------------------------------------------------- 38 | public virtual IDisposable PushContext( string context ) 39 | { 40 | if ( context == null ) 41 | { 42 | throw new ArgumentNullException( "context" ); 43 | } 44 | return new LoggerContextDisposable( Logger ); 45 | } // PushContext 46 | 47 | // ---------------------------------------------------------------------- 48 | public virtual int ContextDepth 49 | { 50 | get { return 0; } 51 | } // ContextDepth 52 | 53 | // ---------------------------------------------------------------------- 54 | public virtual void PopContext() 55 | { 56 | } // PopContext 57 | 58 | // ---------------------------------------------------------------------- 59 | protected abstract ILogger Logger { get; } 60 | 61 | } // class LoggerBase 62 | 63 | } // namespace Itenso.Sys.Logging 64 | // -- EOF ------------------------------------------------------------------- 65 | -------------------------------------------------------------------------------- /Sys/Logging/LoggerContextDisposable.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : LoggerContextDisposable.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2006.05.11 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | 11 | namespace Itenso.Sys.Logging 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | internal sealed class LoggerContextDisposable : IDisposable 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public LoggerContextDisposable( ILogger logger ) 20 | { 21 | this.logger = logger; 22 | } // LoggerContextDisposable 23 | 24 | // ---------------------------------------------------------------------- 25 | void IDisposable.Dispose() 26 | { 27 | if ( logger != null ) 28 | { 29 | logger.PopContext(); 30 | } 31 | } // Dispose 32 | 33 | // ---------------------------------------------------------------------- 34 | // members 35 | private readonly ILogger logger; 36 | 37 | } // class LoggerContextDisposable 38 | 39 | } // namespace Itenso.Sys.Logging 40 | // -- EOF ------------------------------------------------------------------- 41 | -------------------------------------------------------------------------------- /Sys/Logging/LoggerFactoryNone.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : LoggerFactoryNone.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2005.05.04 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Sys.Logging 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | internal sealed class LoggerFactoryNone : LoggerFactory 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | public override ILogger GetLogger( string name ) 19 | { 20 | if ( logger == null ) 21 | { 22 | lock ( mutex ) 23 | { 24 | if ( logger == null ) 25 | { 26 | logger = new LoggerNone(); 27 | } 28 | } 29 | } 30 | return logger; 31 | } // GetLogger 32 | 33 | // ---------------------------------------------------------------------- 34 | // members 35 | private static readonly object mutex = new object(); 36 | private static LoggerNone logger; 37 | 38 | } // class LoggerFactoryNone 39 | 40 | } // namespace Itenso.Sys.Logging 41 | // -- EOF ------------------------------------------------------------------- 42 | -------------------------------------------------------------------------------- /Sys/Logging/LoggerFactoryTrace.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : LoggerFactoryTrace.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2005.05.04 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Collections; 10 | 11 | namespace Itenso.Sys.Logging 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | internal sealed class LoggerFactoryTrace : LoggerFactory 16 | { 17 | 18 | // ---------------------------------------------------------------------- 19 | public override ILogger GetLogger( string name ) 20 | { 21 | ILogger logger = (ILogger)loggers[ name ]; 22 | if ( logger == null ) 23 | { 24 | lock ( this ) 25 | { 26 | logger = (ILogger)loggers[ name ]; 27 | if ( logger == null ) 28 | { 29 | ILogger newLogger = new LoggerTrace( name ); 30 | loggers.Add( name, newLogger ); 31 | logger = newLogger; 32 | } 33 | } 34 | } 35 | return logger; 36 | } // GetLogger 37 | 38 | // ---------------------------------------------------------------------- 39 | // members 40 | private static readonly Hashtable loggers = new Hashtable(); 41 | 42 | } // class LoggerFactoryTrace 43 | 44 | } // namespace Itenso.Sys.Logging 45 | // -- EOF ------------------------------------------------------------------- 46 | -------------------------------------------------------------------------------- /Sys/Logging/LoggerLevel.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : LoggerLevel.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2005.05.05 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using Itenso.Sys.Collection; 10 | 11 | namespace Itenso.Sys.Logging 12 | { 13 | 14 | // ------------------------------------------------------------------------ 15 | public enum LoggerLevel 16 | { 17 | Fatal = 0, 18 | Error = 1, 19 | Warn = 2, 20 | Info = 3, 21 | Debug = 4 22 | } // enum LoggerLevel 23 | 24 | // ------------------------------------------------------------------------ 25 | public static class LoggerLevelEnumHelper 26 | { 27 | 28 | // ---------------------------------------------------------------------- 29 | public static LoggerLevel Parse( string value ) 30 | { 31 | return (LoggerLevel)CollectionTool.ParseEnumValue( typeof( LoggerLevel ), value, true ); 32 | } // Parse 33 | 34 | // ---------------------------------------------------------------------- 35 | public static string Format( LoggerLevel value ) 36 | { 37 | return value.ToString(); 38 | } // Format 39 | 40 | // ---------------------------------------------------------------------- 41 | public static string PossibleValues() 42 | { 43 | return CollectionTool.EnumValuesToString( typeof( LoggerLevel ) ); 44 | } // PossibleValues 45 | 46 | } // class LoggerLevelEnumHelper 47 | 48 | } // namespace Itenso.Sys.Logging 49 | // -- EOF ------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /Sys/Logging/LoggerMonitorAppender.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : LoggerMonitorAppender.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2006.05.12 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using log4net.Core; 11 | using log4net.Appender; 12 | 13 | namespace Itenso.Sys.Logging 14 | { 15 | 16 | // ------------------------------------------------------------------------ 17 | internal sealed class LoggerMonitorAppender : AppenderSkeleton 18 | { 19 | 20 | // ---------------------------------------------------------------------- 21 | protected override void Append( LoggingEvent loggingEvent ) 22 | { 23 | LoggerMonitorLog4net monitor = Logger.Monitor as LoggerMonitorLog4net; 24 | if ( monitor != null ) 25 | { 26 | LoggerLevel level = LoggerLevel.Fatal; 27 | int loggingEventLevelValue = loggingEvent.Level.Value; 28 | if ( loggingEventLevelValue <= Level.Debug.Value ) 29 | { 30 | level = LoggerLevel.Debug; 31 | } 32 | else if ( loggingEventLevelValue <= Level.Info.Value ) 33 | { 34 | level = LoggerLevel.Info; 35 | } 36 | else if ( loggingEventLevelValue <= Level.Warn.Value ) 37 | { 38 | level = LoggerLevel.Warn; 39 | } 40 | else if ( loggingEventLevelValue <= Level.Error.Value ) 41 | { 42 | level = LoggerLevel.Error; 43 | } 44 | 45 | string message = "" + loggingEvent.MessageObject; 46 | string source = loggingEvent.LoggerName; 47 | string context = Logger.GetLogger( source ).Context; 48 | Exception caughtException = loggingEvent.ExceptionObject; 49 | 50 | LoggerEvent loggerEvent = new LoggerEvent( level, source, context, message, caughtException ); 51 | monitor.Handle( loggerEvent ); 52 | } 53 | } // Append 54 | 55 | } // class LoggerMonitorAppender 56 | 57 | } // namespace Itenso.Sys.Logging 58 | // -- EOF ------------------------------------------------------------------- 59 | -------------------------------------------------------------------------------- /Sys/Logging/LoggerMonitorNone.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : LoggerMonitorNone.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2006.05.12 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | 10 | namespace Itenso.Sys.Logging 11 | { 12 | 13 | // ------------------------------------------------------------------------ 14 | internal sealed class LoggerMonitorNone : ILoggerMonitor 15 | { 16 | 17 | // ---------------------------------------------------------------------- 18 | public void Register( ILoggerListener loggerListener, string context ) 19 | { 20 | logger.Warn( "ignoring registration of " + loggerListener + " for context " + context ); 21 | } // Register 22 | 23 | // ---------------------------------------------------------------------- 24 | public void Unregister( ILoggerListener loggerListener, string context ) 25 | { 26 | logger.Warn( "ignoring unregistration of " + loggerListener + " for context " + context ); 27 | } // Unregister 28 | 29 | // ---------------------------------------------------------------------- 30 | // members 31 | private static readonly ILogger logger = Logger.GetLogger( typeof( LoggerMonitorNone ) ); 32 | 33 | } // class LoggerMonitorNone 34 | 35 | } // namespace Itenso.Sys.Logging 36 | // -- EOF ------------------------------------------------------------------- 37 | -------------------------------------------------------------------------------- /Sys/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/Sys/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /Sys/Properties/VersionInfo.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : VersionInfo.cs 3 | // project : System Framelet 4 | // created : Leon Poyyayil - 2007.01.12 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System.Reflection; 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | [assembly: AssemblyVersion("2.3.0.0")] 19 | 20 | namespace Itenso.Sys 21 | { 22 | 23 | // ------------------------------------------------------------------------ 24 | public sealed class VersionInfo 25 | { 26 | 27 | /// Provides easy access to the assemblies version as a string. 28 | public static readonly string AssemblyVersion = typeof( VersionInfo ).Assembly.GetName().Version.ToString(); 29 | 30 | } // class VersionInfo 31 | 32 | } // namespace Itenso.Sys 33 | // -- EOF ------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Sys/Test/ConsoleRunner.cs: -------------------------------------------------------------------------------- 1 | // -- FILE ------------------------------------------------------------------ 2 | // name : ConsoleRunner.cs 3 | // project : System Framelet 4 | // created : Jani Giannoudis - 2008.06.02 5 | // language : c# 6 | // environment: .NET 2.0 7 | // copyright : (c) 2004-2010 by Itenso GmbH, Switzerland 8 | // -------------------------------------------------------------------------- 9 | using System; 10 | using System.Reflection; 11 | using NUnit.ConsoleRunner; 12 | 13 | namespace Itenso.Sys.Test 14 | { 15 | 16 | // ------------------------------------------------------------------------ 17 | public class ConsoleRunner 18 | { 19 | 20 | // ---------------------------------------------------------------------- 21 | static public void Execute( Assembly assembly, string[] args ) 22 | { 23 | if ( assembly == null ) 24 | { 25 | throw new ArgumentNullException( "assembly" ); 26 | } 27 | 28 | bool waitAtEnd = false; 29 | bool waitBecauseOfError = false; 30 | Console.WriteLine( "===== Test::begin =====" ); 31 | try 32 | { 33 | if ( args != null && args.Length > 0 ) 34 | { 35 | foreach ( string arg in args ) 36 | { 37 | if ( "-wait".Equals( arg ) ) 38 | { 39 | waitAtEnd = true; 40 | } 41 | } 42 | } 43 | // ReSharper disable RedundantExplicitArrayCreation 44 | string[] nunitArgs = new string[]{ assembly.GetName().Name + ".exe" }; 45 | // ReSharper restore RedundantExplicitArrayCreation 46 | ConsoleUi.Main( nunitArgs ); 47 | } 48 | catch ( Exception e ) 49 | { 50 | Console.WriteLine( e.Message ); 51 | Console.WriteLine( e.StackTrace ); 52 | waitBecauseOfError = true; 53 | } 54 | finally 55 | { 56 | Console.WriteLine( "===== Test::end =====" ); 57 | } 58 | if ( waitAtEnd || waitBecauseOfError ) 59 | { 60 | Console.WriteLine( Strings.ProgramPressAnyKeyToQuit ); 61 | Console.ReadKey( true ); 62 | } 63 | } // Execute 64 | 65 | } // class ConsoleRunner 66 | 67 | } // namespace Itenso.Sys.Test 68 | // -- EOF ------------------------------------------------------------------- 69 | -------------------------------------------------------------------------------- /docu/Word2007RTFSpec9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/docu/Word2007RTFSpec9.pdf -------------------------------------------------------------------------------- /ext/log4net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/ext/log4net.dll -------------------------------------------------------------------------------- /ext/nunit-console-runner.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/ext/nunit-console-runner.dll -------------------------------------------------------------------------------- /ext/nunit.core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/ext/nunit.core.dll -------------------------------------------------------------------------------- /ext/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/ext/nunit.framework.dll -------------------------------------------------------------------------------- /ext/nunit.util.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/ext/nunit.util.dll -------------------------------------------------------------------------------- /keys/ItensoRtfConverter.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shereef/RTF-to-HTML-Converter-Class-Library-DLL/a7bff4b99c375314575f2bd5e00eacb2fae1df4f/keys/ItensoRtfConverter.snk --------------------------------------------------------------------------------