This article provides example code for a program to convert Description text exported using SystemWeaver XML to RTF or plain text. The variable BinaryBase64Description is an example of how a SystemWeaver XML export of a description looks like.


Prerequisites


using System;
using SystemWeaver.Common;
using SystemWeaverAPI; 

namespace DescriptionConverter
{
    class Program
    {
        private const string BinaryBase64Description = "AQAAAAACxwIAAHiczZbLctMwFIbVXBxfxm7LbcGw8JZFmDjtNO0yKUMbSkMhvczASrXlVlPF8shO" +
"aJhhyZ6HYNk34DFY8BI8BJLsJnbakNCB0smMIh0dn/Od39JJquu2Y6/YdVOvbvBZLf04K6a+scaN" +
"Db6oju1VZ63RaNQdR/rXpU2MTs3U3x524yFBfOuiDIC1cG8fncfS9OwFDeIO7CGl3GQYEmu808Uf" +
"UUG39iCDiWEfHkcWKElvpUNZD5LSDg68isYGUXwmHJX28z1Gw9KTrZ9V8Js0i5k0YjQUP2pR4oHJ" +
"/EsPx/m7IXRRC/mUcfuDCXvTjxErlJbH5tdhjGkQGctsEEK6g1B4hOPTDo8PHmW8+jHBAXqFBogU" +
"FqZUq50i6OHgxHZU7oCCuO3JEhUR7XKelv7lqPbeOoQEeyKWMEXGIkfAGXxrtJbYS2KZBZSGLBlI" +
"IgpxkogqG/hYKCQnUrqb6K36UTvmkd0rwlu3KnxhlvD12cL/+Pb10/8QXheTVMW/cubNW5W+OEv6" +
"ldnSrxvfi3f/zBt+dBB4iIkMILO7SQllFcUlLdJH8zZAbXsYylBn2R4oHjbe9LF71nRdFEXqpUKP" +
"310UJusxRRkjIk2sJIos72W/FwIA8q0828kPi6KTa3IpiYykJdsxT6BOaHF/VMQ+6oUExih9g5WD" +
"ALvUQ1opqRZkI1a2kyMwGa2cP7/lnIBzpzJ3qYd9jLzM2xXxxkKAHI3e7R+f/iFQBw6G/wxI3UHD" +
"D5R50RSccXNNgVSX7EJGaXBTpEyrmQaliIPDf6euR8pdgZSq4pIthtA8UCL2FLQ5DvNVzPpdxMzf" +
"uXr2zn0G4s4tXpe9lDSH/AHZ5G0TMeRd+4TWJPgk6HEX0Txg4puGuUod4pH7JOJqFrEgEEFN/mFc" +
"Fy6m3gYxQKAHbODx7wi4gAEMQm7FgIKA28X+OR+f2r8A3NJfYQ==";

        static void Main(string[] args)
        {
            SWConnection instance = SWConnection.Instance;
            instance.LoginName = "yourLoginName";
            instance.Password = "yourSecretPassword";
            instance.ServerMachineName = "yourHost";
            instance.ServerPort = 1768;
            instance.Login();

            byte[] rvfzBytes = System.Convert.FromBase64String(BinaryBase64Description);

            ToRtf(rvfzBytes, instance.Broker);
            DescriptionToRtf(rvfzBytes, instance.Broker);

            ToPlainText(rvfzBytes, instance.Broker);
            DescriptionToPlainText(rvfzBytes, instance.Broker);
        }

        private static void ToRtf(byte[] rvfzBytes, IswBroker broker)
        {
            var rtfText = SWUtility.RvfzToRtf(rvfzBytes, broker);

            Console.WriteLine($"Rtf using SWUtility: {rtfText}");
        }

        private static void DescriptionToRtf(byte[] rvfzBytes, IswBroker broker)
        {
            var descr = SWDescription.MakeDescription(rvfzBytes);
            var rtfText = SWDescription.DescriptionToRtf(descr, broker);

            Console.WriteLine($"Rtf using SWDescription: {rtfText}");
        }

        private static void ToPlainText(byte[] rvfzBytes, IswBroker broker)
        {
            var plainText = SWUtility.RvfzToPlainText(rvfzBytes, broker);

            Console.WriteLine($"Plain text using SWUtility: {plainText}");
        }

        private static void DescriptionToPlainText(byte[] rvfzBytes, IswBroker broker)
        {
            var descr = SWDescription.MakeDescription(rvfzBytes);
            var plainText = SWDescription.DescriptionToPlainText(descr, broker);

            Console.WriteLine($"Plain text using SWDescription: {plainText}");
        }
    }
}

Example of exported SystemWeaver XML