Exemple #1
0
        /// <summary>
        /// Table : Field( Value [:Description] )+
        /// </summary>
        /// <param name="cfg"></param>
        public void Parse_TableStatus(string cfg)
        {
            this.TableStatuses.Clear();

            if (string.IsNullOrWhiteSpace(cfg))
                return;

            StringReader r = new StringReader(cfg);
            string line = null;
            while ((line = r.ReadLine()) != null)
            {
                try
                {
                    var tableStatus = new TableStatus();
                    tableStatus.Parse(line);

                    List<TableStatus> list = null;
                    if (this.TableStatuses.ContainsKey(tableStatus.Table))
                    {
                        list = this.TableStatuses[tableStatus.Table];
                    }
                    else
                    {
                        list = new List<TableStatus>();
                        this.TableStatuses.Add(tableStatus.Table, list);
                    }

                    foreach (var unit in list)
                    {
                        if (unit.Field.Equals(tableStatus.Field))
                        {
                            throw new Exception(string.Format("重复定义:{0}", tableStatus.Field));
                        }
                    }

                    list.Add(tableStatus);

                }
                catch (Exception e)
                {
                    ConnectionManager.FireValidateError(this.ConnectionString, e.Message);
                }
            }
        }