Ejemplo n.º 1
0
 public static CatalogDatabaseConn[] GetCatalogDatabaseConns()
 {
     try
     {
         if (!File.Exists(ConfigFilename))
         {
             return(null);
         }
         string[] lines = File.ReadAllLines(ConfigFilename, Encoding.Default);
         List <CatalogDatabaseConn> items = new List <CatalogDatabaseConn>();
         foreach (string ln in lines)
         {
             //SPATIAL CONNECTION:name,description,connectionstring
             if (ln.ToUpper().Contains("SPATIAL CONNECTION@"))
             {
                 string[] parts = ln.Split('@');
                 parts = parts[1].Split(',');
                 SpatialDatabaseConn conn = new SpatialDatabaseConn(parts[0], parts[1], parts[2]);
                 CatalogDatabaseConn cdc  = new CatalogDatabaseConn(parts[0], conn, parts[1]);
                 items.Add(cdc);
             }
         }
         return(items.Count > 0 ? items.ToArray() : null);
     }
     catch (Exception ex)
     {
         Log.WriterException(ex);
         return(null);
     }
 }
Ejemplo n.º 2
0
        private void LoadSubCatalogItems()
        {
            SpatialDatabaseConn conn = _tag as SpatialDatabaseConn;

            if (conn == null)
            {
                return;
            }
            //datasets
            ICatalogEntity[] datasets = conn.GetSpatialFeatureDatasets();
            if (datasets != null && datasets.Length > 0)
            {
                foreach (SpatialFeatureDataset ds in datasets)
                {
                    CatalogFeatureDataset dsIt = new CatalogFeatureDataset(ds.Name, ds, ds.Description);
                    AddChild(dsIt);
                }
            }
            //fetclass
            ICatalogEntity[] fetclasses = conn.GetSpatialFeatureClasses();
            if (fetclasses != null && fetclasses.Length > 0)
            {
                foreach (SpatialFeatureClass fetc in fetclasses)
                {
                    CatalogFeatureClass fetcIt = new CatalogFeatureClass(fetc.Name, fetc, fetc.Description);
                    AddChild(fetcIt);
                }
            }
            //
            Refresh();
        }