Exemplo n.º 1
0
        internal MapServerServiceExplorerObject(MapServerConnectionExplorerObject parent, string name, string connectionString, MapServiceType type)
            : base(parent, typeof(MapServerClass), 2)
        {
            _menuitems = new ToolStripItem[] {
                new ToolStripMenuItem("Pre-Render Tiles...", null, this.MapServerServiceExplorerObject_PreRenderTiles)
            };

            switch (_type = type)
            {
            case MapServiceType.MXL:
                _icon = new MapServiceIcon();
                break;

            case MapServiceType.SVC:
                _icon = new MapServiceIcon2();
                break;

            case MapServiceType.GDI:
                _icon = new MapServiceIcon3();
                break;
            }

            _name             = name;
            _connectionString = connectionString;
            _parent           = parent;
        }
Exemplo n.º 2
0
        async public override Task <bool> Refresh()
        {
            await base.Refresh();

            try
            {
                ServerConnection service = new ServerConnection(ConfigTextStream.ExtractValue(_connectionString, "server"));
                //string axl = service.ServiceRequest("catalog", "<GETCLIENTSERVICES/>", "BB294D9C-A184-4129-9555-398AA70284BC",
                //    ConfigTextStream.ExtractValue(_connectionString, "user"),
                //    Identity.HashPassword(ConfigTextStream.ExtractValue(_connectionString, "pwd")));
                string axl = WebFunctions.HttpSendRequest("http://" + ConfigTextStream.ExtractValue(_connectionString, "server") + "/catalog?format=xml", "GET", null,
                                                          ConfigTextStream.ExtractValue(_connectionString, "user"),
                                                          ConfigTextStream.ExtractValue(_connectionString, "pwd"));

                if (String.IsNullOrEmpty(axl))
                {
                    return(false);
                }

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(axl);
                foreach (XmlNode mapService in doc.SelectNodes("//SERVICE[@name]"))
                {
                    MapServiceType type = MapServiceType.MXL;
                    if (mapService.Attributes["servicetype"] != null)
                    {
                        switch (mapService.Attributes["servicetype"].Value.ToLower())
                        {
                        case "mxl":
                            type = MapServiceType.MXL;
                            break;

                        case "svc":
                            type = MapServiceType.SVC;
                            break;

                        case "gdi":
                            type = MapServiceType.GDI;
                            break;
                        }
                    }

                    base.AddChildObject(new MapServerServiceExplorerObject(this, mapService.Attributes["name"].Value, _connectionString, type));
                }

                return(true);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);

                return(false);
            }
        }
Exemplo n.º 3
0
 private void AddMapService(string mapName, MapServiceType type)
 {
     foreach (IMapService service in IMS.mapServices)
     {
         if (service.Name == mapName)
         {
             return;
         }
     }
     IMS.mapServices.Add(new MapService(mapName, type));
 }
Exemplo n.º 4
0
 public MapService(string filename, MapServiceType type)
 {
     _type = type;
     try
     {
         _filename = filename;
         FileInfo fi = new FileInfo(filename);
         _name = fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length);
     }
     catch { }
 }
Exemplo n.º 5
0
 public MapService(MapServiceManager mss, string filename, string folder, MapServiceType type)
 {
     _mss  = mss;
     _type = type;
     try
     {
         _filename = filename;
         if (type == MapServiceType.Folder)
         {
             DirectoryInfo di = new DirectoryInfo(_filename);
             _name = di.Name.ToLower();
         }
         else
         {
             FileInfo fi = new FileInfo(filename);
             _name = fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length);
         }
         _folder = (folder ?? String.Empty).ToLower();
     }
     catch { }
 }
        private void FormAddServiceCollection_Load(object sender, EventArgs e)
        {
            MapServerConnection service = new MapServerConnection(ConfigTextStream.ExtractValue(_connectionString, "server"));
            string axl = service.Send("catalog", "<GETCLIENTSERVICES/>", "BB294D9C-A184-4129-9555-398AA70284BC",
                                      ConfigTextStream.ExtractValue(_connectionString, "user"),
                                      Identity.HashPassword(ConfigTextStream.ExtractValue(_connectionString, "pwd")));

            if (axl == "")
            {
                return;
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(axl);
            foreach (XmlNode mapService in doc.SelectNodes("//SERVICE[@name]"))
            {
                MapServiceType type = MapServiceType.MXL;
                if (mapService.Attributes["servicetype"] != null)
                {
                    switch (mapService.Attributes["servicetype"].Value.ToLower())
                    {
                    case "mxl":
                        type = MapServiceType.MXL;
                        break;

                    case "svc":
                        type = MapServiceType.SVC;
                        break;

                    default:
                        continue;
                    }
                }

                lstAvailServices.Items.Add(
                    new ListViewItem(mapService.Attributes["name"].Value,
                                     (type == MapServiceType.MXL) ? 0 : 1));
            }
        }
Exemplo n.º 7
0
        public void AddMapService(string mapName, MapServiceType type)
        {
            foreach (IMapService service in MapServices)
            {
                if (service.Fullname == mapName)
                {
                    return;
                }
            }
            string folder = String.Empty;

            if (mapName.Contains("/"))
            {
                if (mapName.Split('/').Length > 2)
                {
                    throw new Exception("Invalid map name: " + mapName);
                }
                folder  = mapName.Split('/')[0];
                mapName = mapName.Split('/')[1];
            }
            MapServices.Add(new MapService(this, mapName.Trim(), folder.Trim(), type));
        }
Exemplo n.º 8
0
 public MapServiceAlias(string alias, MapServiceType type, string serviceName)
     : base(alias, type)
 {
     _serviceName = serviceName;
 }
Exemplo n.º 9
0
 internal MapService(string name, MapServiceType type)
 {
     _name = name;
     _type = type;
 }