Ejemplo n.º 1
0
        public override int Execute()
        {
            IConnection conn = null;

            try
            {
                conn = FeatureAccessManager.GetConnectionManager().CreateConnection(_provider);
            }
            catch (OSGeo.FDO.Common.Exception ex)
            {
                WriteException(ex);
                return((int)CommandStatus.E_FAIL_CREATE_CONNECTION);
            }

            if (Array.IndexOf <int>(conn.CommandCapabilities.Commands, (int)OSGeo.FDO.Commands.CommandType.CommandType_DestroyDataStore) < 0)
            {
                Console.Error.WriteLine("This provider does not support destroying data stores");
                return((int)CommandStatus.E_FAIL_UNSUPPORTED_CAPABILITY);
            }

            using (IDestroyDataStore destroy = conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_DestroyDataStore) as IDestroyDataStore)
            {
                IDataStorePropertyDictionary dict = destroy.DataStoreProperties;
                Console.WriteLine("Data Store Properties:");
                WriteProperties(dict);
            }

            if (conn.ConnectionState != ConnectionState.ConnectionState_Closed)
            {
                conn.Close();
            }
            return((int)CommandStatus.E_OK);
        }
Ejemplo n.º 2
0
 private void WriteProperties(IDataStorePropertyDictionary dict)
 {
     foreach (string name in dict.PropertyNames)
     {
         Console.WriteLine("\nProperty Name: {0}\n\n\tLocalized Name: {1}", name, dict.GetLocalizedName(name));
         Console.WriteLine("\tRequired: {0}\n\tProtected: {1}\n\tEnumerable: {2}",
                           dict.IsPropertyRequired(name),
                           dict.IsPropertyProtected(name),
                           dict.IsPropertyEnumerable(name));
         if (dict.IsPropertyEnumerable(name))
         {
             Console.WriteLine("\tValues for property:");
             try
             {
                 string[] values = dict.EnumeratePropertyValues(name);
                 foreach (string str in values)
                 {
                     Console.WriteLine("\t\t- {0}", str);
                 }
             }
             catch (OSGeo.FDO.Common.Exception)
             {
                 Console.Error.WriteLine("\t\tProperty values not available");
             }
         }
     }
 }
 private void WriteProperties(IDataStorePropertyDictionary dict)
 {
     foreach (string name in dict.PropertyNames)
     {
         Console.WriteLine("\nProperty Name: {0}\n\n\tLocalized Name: {1}", name, dict.GetLocalizedName(name));
         Console.WriteLine("\tRequired: {0}\n\tProtected: {1}\n\tEnumerable: {2}",
             dict.IsPropertyRequired(name),
             dict.IsPropertyProtected(name),
             dict.IsPropertyEnumerable(name));
         if (dict.IsPropertyEnumerable(name))
         {
             Console.WriteLine("\tValues for property:");
             try
             {
                 string[] values = dict.EnumeratePropertyValues(name);
                 foreach (string str in values)
                 {
                     Console.WriteLine("\t\t- {0}", str);
                 }
             }
             catch (OSGeo.FDO.Common.Exception)
             {
                 Console.Error.WriteLine("\t\tProperty values not available");
             }
         }
     }
 }