예제 #1
0
 internal GeoServicesFolderExplorerObject(GeoServicesConnectionExplorerObject parent, string name, string connectionString)
     : base(parent, null, 1)
 {
     _name             = name;
     _connectionString = connectionString;
     _parent           = parent;
 }
예제 #2
0
        async public Task <IExplorerObject> CreateInstanceByFullName(string fullName, ISerializableExplorerObjectCache cache)
        {
            if (cache != null && cache.Contains(fullName))
            {
                return(cache[fullName]);
            }

            fullName = fullName.Replace("/", @"\");

            GeoServicesExplorerObjects          group = new GeoServicesExplorerObjects();
            GeoServicesConnectionExplorerObject connectionExObject = null;

            foreach (var connectionObject in (await group.ChildObjects()).OrderByDescending(e => e.FullName.Length))
            {
                if (fullName.StartsWith($@"{ connectionObject.FullName }\"))
                {
                    connectionExObject = connectionObject as GeoServicesConnectionExplorerObject;
                    break;
                }
            }

            if (connectionExObject == null)
            {
                return(null);
            }

            string name = fullName.Substring(connectionExObject.FullName.Length + 1), folderName = "";

            IExplorerObject parentExObject = null;

            if (name.Contains(@"\"))
            {
                folderName     = name.Substring(0, name.LastIndexOf(@"\"));
                name           = name.Substring(name.LastIndexOf(@"\") + 1);
                parentExObject = await new GeoServicesFolderExplorerObject(null, String.Empty, String.Empty).CreateInstanceByFullName($@"{ connectionExObject.FullName }\{ folderName }", null);
            }
            else
            {
                parentExObject = connectionExObject;
            }


            var serviceExObject            = new GeoServicesServiceExplorerObject(parentExObject, name, folderName, connectionExObject._connectionString);

            if (serviceExObject != null)
            {
                if (cache != null)
                {
                    cache.Append(serviceExObject);
                }

                return(serviceExObject);
            }

            return(null);
        }
예제 #3
0
        async public Task <IExplorerObject> CreateInstanceByFullName(string fullName, ISerializableExplorerObjectCache cache)
        {
            if (cache != null && cache.Contains(fullName))
            {
                return(cache[fullName]);
            }

            fullName = fullName.Replace("/", @"\");

            GeoServicesExplorerObjects          group = new GeoServicesExplorerObjects();
            GeoServicesConnectionExplorerObject connectionExObject = null;

            foreach (var connectionObject in (await group.ChildObjects()).OrderByDescending(e => e.FullName.Length))
            {
                if (fullName.StartsWith($@"{ connectionObject.FullName }\"))
                {
                    connectionExObject = connectionObject as GeoServicesConnectionExplorerObject;
                    break;
                }
            }

            if (connectionExObject == null)
            {
                return(null);
            }

            string name = fullName.Substring(connectionExObject.FullName.Length + 1);

            if (name.Contains(@"\"))
            {
                return(null);
            }

            var folderExObject = new GeoServicesFolderExplorerObject(connectionExObject, name, connectionExObject._connectionString);

            if (folderExObject != null)
            {
                if (cache != null)
                {
                    cache.Append(folderExObject);
                }

                return(folderExObject);
            }

            return(null);
        }