Example #1
0
        private static VivoActiveTable ParseSingleTable(string tableString)
        {
            VivoActiveTable result = new VivoActiveTable();

            int position = tableString.IndexOf(PropertyResaultHistory + ValueSEPARATOR);

            if (position > -1)
            {
                result.ResultHistory = tableString.Substring(position + PropertyResaultHistory.Length + ValueSEPARATOR.Length);
                // Remove ResultHistory
                tableString = tableString.Remove(position);
            }

            string[] properties = tableString.Split(new string[] { PropertySEPARATOR }, StringSplitOptions.RemoveEmptyEntries).Where(x => !string.IsNullOrEmpty(x.Trim())).ToArray();
            if (properties != null)
            {
                result.TableID     = GetPropertyValue <long>(properties, PropertyTableID);
                result.LimitName   = GetPropertyValue <string>(properties, PropertyLimitName);
                result.LimitID     = GetPropertyValue <long>(properties, PropertyLimitID);
                result.LimitMin    = GetPropertyValue <int>(properties, PropertyLimitMin);
                result.LimitMax    = GetPropertyValue <int>(properties, PropertyLimitMax);
                result.DealerName  = GetPropertyValue <string>(properties, PropertyDealerName);
                result.TableStatus = GetPropertyValue <string>(properties, PropertyTableStatus);
            }

            return(result);
        }
Example #2
0
        private static List <VivoActiveTable> ParseResponse(string responseText)
        {
            if (string.IsNullOrEmpty(responseText))
            {
                return(null);
            }

            string[] lines = responseText.Split(new string[] { LineSEPARATOR }, StringSplitOptions.RemoveEmptyEntries).Where(x => !string.IsNullOrEmpty(x.Trim())).ToArray();
            if (lines == null || lines.Length == 0)
            {
                return(null);
            }

            List <VivoActiveTable> tables = new List <VivoActiveTable>();

            foreach (string line in lines)
            {
                VivoActiveTable table = ParseSingleTable(line);
                if (table != null)
                {
                    tables.Add(table);
                }
            }
            return(tables);
        }