Beispiel #1
0
        public static string[] GetFormatResult
        (
            [NotNull] ServerResponse response,
            int itemCount
        )
        {
            Sure.NotNull(response, nameof(response));

            List <string> result = new List <string>();

            if (itemCount == 1)
            {
                string line = response.RemainingUtfText();
                if (!string.IsNullOrEmpty(line))
                {
                    line = line.Trim();
                }
                result.Add(line);
            }
            else
            {
                while (true)
                {
                    string line = response.GetUtfString();
                    if (ReferenceEquals(line, null))
                    {
                        break;
                    }
                    int index = line.IndexOf('#');
                    if (index > 0)
                    {
                        string mfnPart = line.Substring(0, index);
                        int    mfn     = mfnPart.SafeToInt32();
                        if (mfn > 0)
                        {
                            line = line.Substring(index + 1);
                        }
                    }

                    line = IrbisText.IrbisToWindows(line);
                    if (!string.IsNullOrEmpty(line))
                    {
                        line = line.Trim();
                    }
                    result.Add(line);
                }
            }

            return(result.ToArray());
        }
Beispiel #2
0
        /// <inheritdoc cref="AbstractCommand.Execute" />
        public override ServerResponse Execute
        (
            ClientQuery query
        )
        {
            Sure.NotNull(query, nameof(query));

            ServerResponse result = base.Execute(query);

            Result = "{\\rtf1 "
                     + result.RemainingUtfText()
                     + "}";

            return(result);
        }