/// <summary> /// Initializes a new instance of RemoteError /// </summary> /// <param name="errorCode">The error that occured</param> public RemoteError(RemoteErrorCode errorCode) { XmlNames.Init(xmlNamespace); this.CallId = Guid.Empty; this.ErrorCode = errorCode; }
/// <summary> /// Stores the list of component manifests as an XML element /// </summary> /// <param name="manifests"></param> /// <returns></returns> public static XElement SerializeComponents(IEnumerable <ComponentManifest> manifests) { if (manifests == null) { throw new ArgumentNullException(nameof(manifests)); } List <XElement> list = new List <XElement>(); XmlSerializer xmlSerializer = new XmlSerializer(typeof(ComponentManifest), XmlNames.ProjectManifestNamespace); foreach (ComponentManifest manifest in manifests) { XElement item = SerializeComponent(xmlSerializer, manifest); list.Add(item); } XElement components = new XElement(XmlNames.GetComponentXName(XmlNames.Components)); foreach (XElement xElement in list) { components.Add(xElement); } return(components); }
public Permission() { XmlNames.Init(xmlNamespace); Path = ""; PermittedClients = new List <string>(); }
public MountInfo() { XmlNames.Init(xmlNamespace); this.MountPoint = ""; this.LocalPath = ""; }
public ClientInfo() { this.TrustLevel = -1; this.Profiles = new List <Profile>(); //Initialize XmlNames helper class XmlNames.Init(xmlNamespace); }
private static void SaveTags(List <string> tags, XElement componentElement) { string tagsString = string.Join(";", tags); XElement tagsElement = new XElement(XmlNames.GetComponentXName(XmlNames.Tags)); tagsElement.Add(new XAttribute(XmlNames.Value, tagsString)); componentElement.Add(tagsElement); }
/// <summary> /// Serializes the object into XML /// </summary> /// <returns>Returns a XML representation of the object</returns> public override XElement Serialize() { XmlNames.Init(xmlNamespace); XElement result = new XElement(XmlNames.SnapshotInfo); result.Add(new XElement(XmlNames.Id, this.Id)); result.Add(new XElement(XmlNames.Time, this.Time.ToUniversalTime().ToString("o"))); return(result); }
/// <summary> /// Changes the XML namespace of all elements that do not specify a namespace to the configuration namespace /// </summary> void UpgradeNamespace(XDocument document) { if (String.IsNullOrEmpty(document.Root.Name.NamespaceName)) { m_Logger.Debug("Updating XML Namespace"); document.Root.ReplaceNamespace("", XmlNames.GetNamespace()); } else if (document.Root.Name.Namespace.Equals(XmlNames.GetLegacyNamespace())) { m_Logger.Debug("Updating XML Namespace"); document.Root.ReplaceNamespace(XmlNames.GetLegacyNamespace(), XmlNames.GetNamespace()); } }
/// <summary> /// Serializes ProjectInfo as XML /// </summary> /// <param name="infoElement"></param> /// <returns></returns> public static ProjectInfo DeserializeProjectInfo(XElement infoElement) { if (infoElement == null) { throw new ArgumentNullException(nameof(infoElement)); } XmlSerializer xmlSerializer = new XmlSerializer(typeof(ProjectInfo), XmlNames.ProjectManifestNamespace); ProjectInfo info = (ProjectInfo)xmlSerializer.Deserialize(infoElement.CreateReader()); LoadTags(infoElement, info.Tags); LoadProperties(infoElement, info.Properties); XElement componentsElement = infoElement.Element(XmlNames.GetComponentXName(XmlNames.Components)); List <ComponentManifest> components = DeserializeComponents(componentsElement); info.Components.AddRange(components); return(info); }
private static void SaveProperties(PropertiesCollection properties, XElement element) { XElement props = new XElement(XmlNames.GetComponentXName(XmlNames.Properties)); if (properties != null) { foreach (var manifestProperty in properties) { XElement propertyElement = new XElement(XmlNames.GetComponentXName(XmlNames.Property)); propertyElement.Add(new XAttribute(XmlNames.Key, manifestProperty.Key)); if (manifestProperty.ValueList != null && manifestProperty.ValueList.Any()) { propertyElement.Value = Json.Serialize(manifestProperty.ValueList); } else { propertyElement.Value = Json.Serialize(manifestProperty.Value); } props.Add(propertyElement); } } element.Add(props); }
public RemoteMethodCall() { XmlNames.Init(xmlNamespace); Parameters = new List <object>(); }
public RemoteMethodResponse() { XmlNames.Init(xmlNamespace); }
public FilesystemObject() { XmlNames.Init(xmlNamespace); }
/// <summary> /// Initializes a new instace of SnapshotInfo /// </summary> public SnapshotInfo() { XmlNames.Init(xmlNamespace); this.Id = Guid.NewGuid(); }