Beispiel #1
0
        public static GblResult[] Parse
        (
            [NotNull] IEnumerable <string> lines
        )
        {
            List <GblResult> result = new List <GblResult>();

            foreach (string line in lines)
            {
                GblResult gblResult = Parse(line);
                if (gblResult != null)
                {
                    result.Add(gblResult);
                }
            }

            return(result.ToArray());
        }
Beispiel #2
0
        public static GblResult Parse
        (
            [CanBeNull] string line
        )
        {
            if (string.IsNullOrEmpty(line))
            {
                return(null);
            }

            GblResult result = new GblResult
            {
                Text    = line,
                Success = true
            };

            string[] parts = line.Split('#');
            foreach (string part in parts)
            {
                string[] p = part.Split('=');
                if (p.Length > 0)
                {
                    string name  = p[0].ToUpperInvariant();
                    string value = string.Empty;
                    if (p.Length > 1)
                    {
                        value = p[1];
                    }
                    switch (name)
                    {
                    case "DBN":
                        result.Database = value;
                        break;

                    case "MFN":
                        result.Mfn = value.SafeParseInt32();
                        break;

                    case "AUTOIN":
                        result.Autoin = value;
                        break;

                    case "UPDATE":
                        result.Update = value;
                        break;

                    case "STATUS":
                        result.Status = value;
                        break;

                    case "UPDUF":
                        result.UpdUf = value;
                        break;

                    case "GBL_ERROR":
                        result.Error   = value;
                        result.Success = false;
                        break;
                    }
                }
            }
            return(result);
        }