コード例 #1
0
        public static List <FoundItem> ParseServerResponse
        (
            [NotNull] ServerResponse response,
            int sizeHint
        )
        {
            Sure.NotNull(response, "response");

            List <FoundItem> result = sizeHint > 0
                ? new List <FoundItem>(sizeHint)
                : new List <FoundItem>();

            string line;

            while ((line = response.GetUtfString()) != null)
            {
                FoundItem item = ParseLine(line);
                result.Add(item);
            }

            return(result);
        }
コード例 #2
0
        public static FoundItem ParseLine
        (
            [NotNull] string line
        )
        {
            Sure.NotNull(line, nameof(line));

            string[]  parts  = line.Split(_delimiters, 2);
            FoundItem result = new FoundItem
            {
                Mfn = int.Parse(parts[0])
            };

            if (parts.Length > 1)
            {
                string text = parts[1].EmptyToNull();
                text        = IrbisText.IrbisToWindows(text);
                result.Text = text;
            }

            return(result);
        }