/// <summary> /// Deserializes xml markup from file into an ResourceFolderHeaderType object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output ResourceFolderHeaderType object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out ResourceFolderHeaderType obj, out System.Exception exception) { exception = null; obj = default(ResourceFolderHeaderType); try { obj = LoadFromFile(fileName); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
/// <summary> /// Deserializes workflow markup into an ResourceFolderHeaderType object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output ResourceFolderHeaderType object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out ResourceFolderHeaderType obj, out System.Exception exception) { exception = null; obj = default(ResourceFolderHeaderType); try { obj = Deserialize(xml); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
/// <summary> /// Deserializes workflow markup into an ResourceFolderHeaderType object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output ResourceFolderHeaderType object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out ResourceFolderHeaderType obj, out System.Exception exception) { exception = null; obj = default(ResourceFolderHeaderType); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } }
public static bool LoadFromFile(string fileName, out ResourceFolderHeaderType obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); }
/// <summary> /// Deserializes xml markup from file into an ResourceFolderHeaderType object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output ResourceFolderHeaderType object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out ResourceFolderHeaderType obj, out System.Exception exception) { exception = null; obj = default(ResourceFolderHeaderType); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } }
public static bool Deserialize(string xml, out ResourceFolderHeaderType obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); }
public override void UpdateRepository(string resourceId, ResourceFolderHeaderType header) { try { System.Net.WebRequest req = m_reqBuilder.UpdateRepository(resourceId, this.SerializeObject(header)); req.Credentials = _cred; req.GetRequestStream().Flush(); req.GetRequestStream().Close(); byte[] buf = new byte[1]; System.IO.Stream s = req.GetResponse().GetResponseStream(); s.Read(buf, 0, 1); s.Close(); } catch (Exception ex) { if (typeof(WebException).IsAssignableFrom(ex.GetType())) LogFailedRequest((WebException)ex); Exception ex2 = Utility.ThrowAsWebException(ex); if (ex2 != ex) throw ex2; else throw; } }
public override void UpdateRepository(string resourceId, ResourceFolderHeaderType header) { MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService; if (header == null) { res.UpdateRepository(new MgResourceIdentifier(resourceId), null, null); LogMethodCall("MgResourceService::UpdateRepository", true, resourceId, "null", "null"); } else { byte[] data = this.SerializeObject(header).ToArray(); MgByteReader rd = new MgByteReader(data, data.Length, "text/xml"); res.UpdateRepository(new MgResourceIdentifier(resourceId), null, rd); LogMethodCall("MgResourceService::UpdateRepository", true, resourceId, "null", "MgByteReader"); } }
/// <summary> /// Raises the System.Windows.Forms.Form.Load event /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { Dictionary<string, ListViewItem> ul = new Dictionary<string, ListViewItem>(); Dictionary<string, ListViewItem> gl = new Dictionary<string, ListViewItem>(); UsersAndGroups.Items.Clear(); var site = (ISiteService)m_connection.GetService((int)ServiceType.Site); foreach (UserListUser u in site.EnumerateUsers().Items) { ListViewItem lvi = new ListViewItem(new string[] { u.FullName, u.Description, StatusNames[IHUSER] }, IHUSER); lvi.Tag = u; UsersAndGroups.Items.Add(lvi); ul.Add(u.Name, lvi); } foreach (GroupListGroup g in site.EnumerateGroups().Group) { ListViewItem lvi = new ListViewItem(new string[] { g.Name, g.Description, StatusNames[IHGROUP] }, IHGROUP); lvi.Tag = g; UsersAndGroups.Items.Add(lvi); gl.Add(g.Name, lvi); } if (m_resourceId.IsFolder) { m_folderHeader = m_connection.ResourceService.GetFolderHeader(m_resourceId); if (m_folderHeader.Security.Users != null && m_folderHeader.Security.Users.User != null) foreach (ResourceSecurityTypeUsersUser u in m_folderHeader.Security.Users.User) if (ul.ContainsKey(u.Name)) UpdateListItem(u, ul[u.Name]); if (m_folderHeader.Security.Groups != null && m_folderHeader.Security.Groups.Group != null) foreach (ResourceSecurityTypeGroupsGroup g in m_folderHeader.Security.Groups.Group) if (gl.ContainsKey(g.Name)) UpdateListItem(g, gl[g.Name]); UseInherited.Checked = m_folderHeader.Security.Inherited; tabControl1.TabPages.Remove(WMSTab); tabControl1.TabPages.Remove(WFSTab); tabControl1.TabPages.Remove(CustomTab); tabControl1.TabPages.Remove(ReferenceTab); } else { m_resourceHeader = m_connection.ResourceService.GetResourceHeader(m_resourceId); if (m_resourceHeader.Security.Users != null && m_resourceHeader.Security.Users.User != null) foreach (ResourceSecurityTypeUsersUser u in m_resourceHeader.Security.Users.User) if (ul.ContainsKey(u.Name)) UpdateListItem(u, ul[u.Name]); if (m_resourceHeader.Security.Groups != null && m_resourceHeader.Security.Groups.Group != null) foreach (ResourceSecurityTypeGroupsGroup g in m_resourceHeader.Security.Groups.Group) if (gl.ContainsKey(g.Name)) UpdateListItem(g, gl[g.Name]); UseInherited.Checked = m_resourceHeader.Security.Inherited; if (m_resourceId.Extension != ResourceTypes.LayerDefinition.ToString()) tabControl1.TabPages.Remove(WMSTab); else UpdateWMSDisplay(); if (m_resourceId.Extension != ResourceTypes.FeatureSource.ToString()) tabControl1.TabPages.Remove(WFSTab); else UpdateWFSDisplay(); } //Hide the tabControl if it only has one tab if (tabControl1.TabCount == 1) { foreach (Control c in new System.Collections.ArrayList(tabControl1.TabPages[0].Controls)) { tabControl1.Controls.Remove(c); c.Top += tabControl1.Top; this.Controls.Add(c); } this.Controls.Remove(tabControl1); } this.Text = m_resourceId; UseInherited_CheckedChanged(null, null); }
public static bool LoadFromFile(string fileName, out ResourceFolderHeaderType obj) { System.Exception exception = null; return(LoadFromFile(fileName, out obj, out exception)); }
public static bool Deserialize(string xml, out ResourceFolderHeaderType obj) { System.Exception exception = null; return(Deserialize(xml, out obj, out exception)); }
public void LoadFolderHeader(ResourceFolderHeaderType folderHeader) { txtXml.Text = folderHeader.Serialize(); _serializer = new XmlSerializer(typeof(ResourceFolderHeaderType)); isFolder = true; }