示例#1
0
        public static ServerStat Parse
        (
            [NotNull] ServerResponse response
        )
        {
            ServerStat result = new ServerStat
            {
                TotalCommandCount = response.RequireInt32(),
                ClientCount       = response.RequireInt32(),
                Unknown           = response.RequireInt32()
            };

            List <ClientInfo> clients = new List <ClientInfo>();

            while (true)
            {
                string number    = response.GetAnsiString();
                string ipAddress = response.GetAnsiString();
                if (string.IsNullOrEmpty(number) ||
                    string.IsNullOrEmpty(ipAddress))
                {
                    break;
                }

                ClientInfo client = new ClientInfo
                {
                    Number        = number,
                    IPAddress     = ipAddress,
                    Port          = response.RequireAnsiString(),
                    Name          = response.RequireAnsiString(),
                    ID            = response.RequireAnsiString(),
                    Workstation   = response.RequireAnsiString(),
                    Registered    = response.RequireAnsiString(),
                    Acknowledged  = response.RequireAnsiString(),
                    LastCommand   = response.RequireAnsiString(),
                    CommandNumber = response.RequireAnsiString()
                };
                clients.Add(client);
            }
            result.RunningClients = clients.ToArray();

            return(result);
        }
示例#2
0
        public string[] GetFileText
        (
            [NotNull] ServerResponse response
        )
        {
            Sure.NotNull(response, nameof(response));

            int count = Files.Count;

            string[] result = new string[count];

            for (int i = 0; i < count; i++)
            {
                string text = response.GetAnsiString();
                text      = IrbisText.IrbisToWindows(text);
                result[i] = text;
            }

            return(result);
        }
示例#3
0
        public static ProtocolLine[] Parse
        (
            [NotNull] ServerResponse response
        )
        {
            Sure.NotNull(response, nameof(response));

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

            while (true)
            {
                string line = response.GetAnsiString();
                if (ReferenceEquals(line, null) || line.Length == 0)
                {
                    break;
                }

                ProtocolLine item = Parse(line);
                result.Add(item);
            }

            return(result.ToArray());
        }
示例#4
0
        public static DatabaseInfo ParseServerResponse
        (
            [NotNull] ServerResponse response
        )
        {
            Sure.NotNull(response, nameof(response));

            DatabaseInfo result = new DatabaseInfo
            {
                PhysicallyDeletedRecords = _ParseLine(response.GetAnsiString()),
                LogicallyDeletedRecords  = _ParseLine(response.GetAnsiString()),
                NonActualizedRecords     = _ParseLine(response.GetAnsiString()),
                LockedRecords            = _ParseLine(response.GetAnsiString()),
                MaxMfn         = _ParseLine(response.GetAnsiString()).GetItem(0, 0),
                DatabaseLocked = _ParseLine(response.GetAnsiString()).GetItem(0, 0) != 0
            };

            return(result);
        }