コード例 #1
0
        // Converts an rtf content to xaml content.
        internal static MemoryStream ConvertRtfToXaml(string rtfContent)
        {
            MemoryStream memoryStream = new MemoryStream();
            WpfPayload   wpfPayload   = WpfPayload.CreateWpfPayload(memoryStream);

            using (wpfPayload.Package)
            {
                using (Stream xamlStream = wpfPayload.CreateXamlStream())
                {
                    // Create XamlRtfConverter to process the converting from Rtf to Xaml
                    XamlRtfConverter xamlRtfConverter = new XamlRtfConverter();
                    xamlRtfConverter.WpfPayload = wpfPayload;

                    string xamlContent = xamlRtfConverter.ConvertRtfToXaml(rtfContent);
                    if (xamlContent != string.Empty)
                    {
                        StreamWriter streamWriter = new StreamWriter(xamlStream);
                        using (streamWriter)
                        {
                            streamWriter.Write(xamlContent);
                        }
                    }
                    else
                    {
                        memoryStream = null;
                    }
                } // This closes xamlStream
            }     // This closes the package

            return(memoryStream);
        }
コード例 #2
0
        // Token: 0x06003855 RID: 14421 RVA: 0x000FBE94 File Offset: 0x000FA094
        internal static MemoryStream ConvertRtfToXaml(string rtfContent)
        {
            MemoryStream memoryStream = new MemoryStream();
            WpfPayload   wpfPayload   = WpfPayload.CreateWpfPayload(memoryStream);

            using (wpfPayload.Package)
            {
                using (Stream stream = wpfPayload.CreateXamlStream())
                {
                    string text = new XamlRtfConverter
                    {
                        WpfPayload = wpfPayload
                    }.ConvertRtfToXaml(rtfContent);
                    if (text != string.Empty)
                    {
                        StreamWriter streamWriter = new StreamWriter(stream);
                        using (streamWriter)
                        {
                            streamWriter.Write(text);
                            return(memoryStream);
                        }
                    }
                    memoryStream = null;
                }
            }
            return(memoryStream);
        }
コード例 #3
0
        // Token: 0x06003854 RID: 14420 RVA: 0x000FBE68 File Offset: 0x000FA068
        internal static string ConvertXamlToRtf(string xamlContent, Stream wpfContainerMemory)
        {
            XamlRtfConverter xamlRtfConverter = new XamlRtfConverter();

            if (wpfContainerMemory != null)
            {
                xamlRtfConverter.WpfPayload = WpfPayload.OpenWpfPayload(wpfContainerMemory);
            }
            return(xamlRtfConverter.ConvertXamlToRtf(xamlContent));
        }
コード例 #4
0
        // Converts xaml content to rtf content.
        internal static string ConvertXamlToRtf(string xamlContent, Stream wpfContainerMemory)
        {
            // Create XamlRtfConverter to process the converting from Xaml to Rtf
            XamlRtfConverter xamlRtfConverter = new XamlRtfConverter();

            if (wpfContainerMemory != null)
            {
                xamlRtfConverter.WpfPayload = WpfPayload.OpenWpfPayload(wpfContainerMemory);
            }

            // Process Xaml-Rtf converting
            string rtfContent = xamlRtfConverter.ConvertXamlToRtf(xamlContent);

            return(rtfContent);
        }
コード例 #5
0
        // Converts an rtf content to xaml content.
        internal static MemoryStream ConvertRtfToXaml(string rtfContent)
        {
            MemoryStream memoryStream = new MemoryStream();
            WpfPayload wpfPayload = WpfPayload.CreateWpfPayload(memoryStream);
            using (wpfPayload.Package)
            {
                using (Stream xamlStream = wpfPayload.CreateXamlStream())
                {
                    // Create XamlRtfConverter to process the converting from Rtf to Xaml
                    XamlRtfConverter xamlRtfConverter = new XamlRtfConverter();
                    xamlRtfConverter.WpfPayload = wpfPayload;

                    string xamlContent = xamlRtfConverter.ConvertRtfToXaml(rtfContent);
                    if (xamlContent != string.Empty)
                    {
                        StreamWriter streamWriter = new StreamWriter(xamlStream);
                        using (streamWriter)
                        {
                            streamWriter.Write(xamlContent);
                        }
                    }
                    else
                    {
                        memoryStream = null;
                    }
                } // This closes xamlStream
            } // This closes the package

            return memoryStream;
        }
コード例 #6
0
        // Converts xaml content to rtf content.
        internal static string ConvertXamlToRtf(string xamlContent, Stream wpfContainerMemory)
        {
            // Create XamlRtfConverter to process the converting from Xaml to Rtf
            XamlRtfConverter xamlRtfConverter = new XamlRtfConverter();
            if (wpfContainerMemory != null)
            {
                xamlRtfConverter.WpfPayload = WpfPayload.OpenWpfPayload(wpfContainerMemory);
            }

            // Process Xaml-Rtf converting
            string rtfContent = xamlRtfConverter.ConvertXamlToRtf(xamlContent);

            return rtfContent;
        }