Esempio n. 1
0
 private void printMSDConnections(string msd)
 {
     try
     {
         IMSDHelper helper = new MSDHelper();
         helper.Open(msd);
         var maps = helper.GetMaps();
         for (var i = 0; i < maps.Count; i++)
         {
             var layers = helper.GetLayers(maps.Element[i]);
             for (var j = 0; j < layers.Count; j++)
             {
                 List <string> dbconns = helper.GetWorkspaceConnectionStringFromLayer(layers.Element[j]).Split(';').ToList <string>();
                 foreach (string param in dbconns)
                 {
                     this.richTextBox1.Text += param + "\n";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 2
0
        private void UpdateDBConnection(string msdFilepath, string sde)
        {
            IWorkspaceFactory2 wf = new SdeWorkspaceFactoryClass();
            IWorkspace ws = wf.OpenFromFile(sde, 0);
            IDataset ds = (IDataset)ws;
            IWorkspaceName2 wn = (IWorkspaceName2)ds.FullName;
            string conn = wn.ConnectionString;

            IMSDHelper helper = new MSDHelper();
            helper.Open(msdFilepath);
            var maps = helper.GetMaps();
            for (var i = 0; i < maps.Count; i++)
            {
                var layers = helper.GetLayers(maps.Element[i]);
                for (var j = 0; j < layers.Count; j++)
                {
                    helper.PutWorkspaceConnectionStringInLayer(layers.Element[i], conn, false);
                }
            }
        }
Esempio n. 3
0
        private void UpdateDBConnection(string msdFilepath, string sde)
        {
            IWorkspaceFactory2 wf   = new SdeWorkspaceFactoryClass();
            IWorkspace         ws   = wf.OpenFromFile(sde, 0);
            IDataset           ds   = (IDataset)ws;
            IWorkspaceName2    wn   = (IWorkspaceName2)ds.FullName;
            string             conn = wn.ConnectionString;

            IMSDHelper helper = new MSDHelper();

            helper.Open(msdFilepath);
            var maps = helper.GetMaps();

            for (var i = 0; i < maps.Count; i++)
            {
                var layers = helper.GetLayers(maps.Element[i]);
                for (var j = 0; j < layers.Count; j++)
                {
                    helper.PutWorkspaceConnectionStringInLayer(layers.Element[i], conn, false);
                }
            }
        }
Esempio n. 4
0
 private void printMSDConnections(string msd)
 {
     try
     {
         IMSDHelper helper = new MSDHelper();
         helper.Open(msd);
         var maps = helper.GetMaps();
         for (var i = 0; i < maps.Count; i++)
         {
             var layers = helper.GetLayers(maps.Element[i]);
             for (var j = 0; j < layers.Count; j++)
             {
                 List<string> dbconns = helper.GetWorkspaceConnectionStringFromLayer(layers.Element[j]).Split(';').ToList<string>();
                 foreach (string param in dbconns)
                 {
                     this.richTextBox1.Text += param + "\n";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }