From 21c0638d0a8bbb026331f46b2cd7b19c86fe0a71 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Thu, 5 Sep 2013 18:05:22 +0200 Subject: [PATCH] pre split --- .../CampusAppWP8/Utility/ICSClasses.cs | 3380 +++++++++++------ 1 file changed, 2254 insertions(+), 1126 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Utility/ICSClasses.cs b/CampusAppWP8/CampusAppWP8/Utility/ICSClasses.cs index e118aca9..e0fce22f 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/ICSClasses.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/ICSClasses.cs @@ -11,49 +11,65 @@ namespace CampusAppWP8.Utility using System.Collections.Generic; using System.Linq; using System.Text; - using System.Text.RegularExpressions; - using System.Threading.Tasks; - using System.Windows.Shapes; - using System.Xml.Serialization; + /// ICS structure classes. + /// Fiedler, 05.09.2013. public class ICSClasses { + /// Basic interface class. + /// Fiedler, 05.09.2013. public abstract class Interface { + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// The value string. + /// The parameter string. public virtual void Set(string valueStr, string paramStr) { this.Set(valueStr, paramStr.Split(';')); } - + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// The value string. + /// List of parameter strings. public abstract void Set(string valueStr, string[] paramStrList); - + + /// Gets the bytes. + /// Fiedler, 05.09.2013. + /// An array of byte. public virtual byte[] GetBytes() { return Encoding.UTF8.GetBytes(this.GetString()); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public abstract string GetString(); + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public abstract string GetName(); } - // - /* - public class DEFAULT : Interface - { - public static readonly string Name; - } - */ - // - + /// Begin property class + /// Fiedler, 05.09.2013. + /// public class Begin : Interface { - // ??? + /// The name. public static readonly string Name = ICSTag.BEGIN; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + + /// The values. public static readonly List PValues - = new List(new string[] { + = new List(new string[] + { ICSTag.VCALENDAR, ICSTag.VEVENT, ICSTag.VTODO, @@ -65,12 +81,42 @@ namespace CampusAppWP8.Utility ICSTag.VALARM }); + /// The value. private string value = string.Empty; - + + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Begin() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + if (PValues.IndexOf(value) >= 0) + { + this.value = value; + } + else + { + throw new NotSupportedException("value (" + value + ") is not supported"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { if (paramStrList != null && paramStrList.Count() > 0) @@ -88,6 +134,9 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -97,39 +146,31 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - if (PValues.IndexOf(value) >= 0) - { - this.value = value; - } - else - { - throw new NotSupportedException("value (" + value + ") is not supported"); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Begin.Name; } } + /// End property class. + /// Fiedler, 05.09.2013. + /// public class End : Begin // same { - // ??? - public static readonly string Name = ICSTag.END; - public static readonly List> PParams + /// The name. + public static new readonly string Name = ICSTag.END; + + /// Options for controlling the operation. + public static new readonly List> PParams = new List>(); - public static readonly List PValues - = new List(new string[] { + + /// The values. + public static new readonly List PValues + = new List(new string[] + { ICSTag.VCALENDAR, ICSTag.VEVENT, ICSTag.VTODO, @@ -141,31 +182,111 @@ namespace CampusAppWP8.Utility ICSTag.VALARM }); + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public End() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return End.Name; } } + /// Version property class. + /// Fiedler, 05.09.2013. + /// public class Version : Interface { - // 3.7.4. + /// The name. public static readonly string Name = ICSTag.VERSION; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); - private float maxVer = -1.0f; // also used for single val + /// also used for single val. + private float maxVer = -1.0f; + + /// The minimum version. private float minVer = -1.0f; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Version() { } + /// Gets or sets the value. + /// The value. + public float Value + { + get + { + return this.maxVer; + } + + set + { + if (value >= 0.0f) + { + this.maxVer = value; + this.minVer = -1.0f; + } + else + { + throw new NotSupportedException("value (" + value + ") is not supported"); + } + } + } + + /// Gets or sets the minimum version. + /// The minimum version. + public float MinVersion + { + get + { + return this.minVer; + } + + set + { + if (value >= 0.0f) + { + this.minVer = value; + } + else + { + throw new NotSupportedException("value (" + value + ") is not supported"); + } + } + } + + /// Gets or sets the maximum version. + /// The maximum version. + public float MaxVersion + { + get + { + return this.Value; + } + + set + { + this.Value = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { if (paramStrList != null && paramStrList.Count() > 0) @@ -190,6 +311,9 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -206,76 +330,56 @@ namespace CampusAppWP8.Utility return retValue; } - public float Value - { - get - { - return this.maxVer; - } - set - { - if (value >= 0.0f) - { - this.maxVer = value; - this.minVer = -1.0f; - } - else - { - throw new NotSupportedException("value (" + value + ") is not supported"); - } - } - } - - public float MinVersion - { - get - { - return this.minVer; - } - set - { - if (value >= 0.0f) - { - this.minVer = value; - } - else - { - throw new NotSupportedException("value (" + value + ") is not supported"); - } - } - } - - public float MaxVersion - { - get - { - return this.Value; - } - set - { - this.Value = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Version.Name; } } + /// Product identifier. + /// Fiedler, 05.09.2013. + /// public class ProductID : Interface { - // 3.7.3. + /// The name. public static readonly string Name = ICSTag.PRODUCT_ID; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public ProductID() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { if (paramStrList != null && paramStrList.Count() > 0) @@ -286,6 +390,9 @@ namespace CampusAppWP8.Utility this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -295,41 +402,70 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return ProductID.Name; } } + /// Calendar scale. + /// Fiedler, 05.09.2013. + /// public class CalendarScale : Interface { - // 3.7.1. + /// The name. public static readonly string Name = ICSTag.CAL_SCALE; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(); + = new List>(); + + /// The values. public static readonly List PValues - = new List(new string[] { + = new List(new string[] + { ICSValue.GREGORIAN }); + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public CalendarScale() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + if (PValues.IndexOf(value) >= 0) + { + this.value = value; + } + else + { + throw new NotSupportedException("value (" + value + ") is not supported"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { if (paramStrList != null && paramStrList.Count() > 0) @@ -347,6 +483,9 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -356,44 +495,56 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - if (PValues.IndexOf(value) >= 0) - { - this.value = value; - } - else - { - throw new NotSupportedException("value (" + value + ") is not supported"); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return CalendarScale.Name; } } + /// Method property class. + /// Fiedler, 05.09.2013. + /// public class Method : Interface { - // 3.7.2. + /// The name. public static readonly string Name = ICSTag.METHOD; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Method() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { if (paramStrList != null && paramStrList.Count() > 0) @@ -404,6 +555,9 @@ namespace CampusAppWP8.Utility this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -413,76 +567,168 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Method.Name; } } - // - + /// Attachment property class. + /// Fiedler, 05.09.2013. + /// public class Attachment : Interface { - // 3.8.1.1. + /// The name. public static readonly string Name = ICSTag.ATTACHMENT; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { + = new List>(new Tuple[] + { new Tuple(ICSParam.FORMAT_TYPE, null), - new Tuple(ICSParam.ENCODING, new string[] { + new Tuple(ICSParam.ENCODING, new string[] + { ICSParamValue.BIT8, ICSParamValue.BASE64 }), - new Tuple(ICSParam.VALUE_TYPE, new string[] { + new Tuple(ICSParam.VALUE_TYPE, new string[] + { ICSParamValue.BINARY }) }); + /// Type of the value. private string valueType = string.Empty; + + /// Type of the encoding. private string encodingType = string.Empty; + + /// Type of the format. private string formatType = string.Empty; + + /// The value. private byte[] value; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Attachment() { } + /// Gets or sets the value bytes. + /// The value bytes. + public byte[] ValueBytes + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Gets or sets the value string. + /// The value string. + public string ValueString + { + get + { + return Encoding.UTF8.GetString(this.value, 0, this.value.Length); + } + + set + { + this.value = Encoding.UTF8.GetBytes(value); + } + } + + /// Gets or sets the type of the encoding. + /// The type of the encoding. + public string EncodingType + { + get + { + return this.encodingType; + } + + set + { + if (value.Equals(ICSParamValue.BIT8) || value.Equals(ICSParamValue.BASE64)) + { + this.encodingType = value; + } + } + } + + /// Gets or sets the type of the value. + /// The type of the value. + public string ValueType + { + get + { + return this.valueType; + } + + set + { + if (value.Equals(ICSParamValue.BINARY)) + { + this.valueType = value; + } + } + } + + /// Gets or sets the type of the format. + /// The type of the format. + public string FormatType + { + get + { + return this.formatType; + } + + set + { + this.formatType = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { - foreach (string p in paramStrList) + foreach (string param in paramStrList) { - string[] pSplit = p.Split('='); + string[] p = param.Split('='); - if (pSplit.Length != 2) + if (p.Length != 2) { - throw new NotSupportedException("the number of '=' in the parameter (" + p + ") is less or greater then 1"); + throw new NotSupportedException("the number of '=' in the parameter (" + param + ") is less or greater then 1"); } - switch (pSplit[0]) + switch (p[0]) { case ICSParam.FORMAT_TYPE: - this.formatType = pSplit[1]; + this.formatType = p[1]; break; case ICSParam.ENCODING: - this.encodingType = pSplit[1]; + this.encodingType = p[1]; break; case ICSParam.VALUE_TYPE: - this.valueType = pSplit[1]; + this.valueType = p[1]; break; default: - throw new NotSupportedException("Parameter with tag (" + pSplit[0] + ") is not supported"); + throw new NotSupportedException("Parameter with tag (" + p[0] + ") is not supported"); } } @@ -490,12 +736,15 @@ namespace CampusAppWP8.Utility { this.value = Convert.FromBase64String(valueStr); } - else //if (this.encodingType.Equals(ICSParamValue.BIT8)) + else //// if (this.encodingType.Equals(ICSParamValue.BIT8)) { this.value = Encoding.UTF8.GetBytes(valueStr); } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -506,10 +755,12 @@ namespace CampusAppWP8.Utility { retValue += ";" + ICSParam.FORMAT_TYPE + "=" + this.formatType; } + if (this.encodingType.Equals(string.Empty) == false) { retValue += ";" + ICSParam.ENCODING + "=" + this.encodingType; } + if (this.valueType.Equals(string.Empty) == false) { retValue += ";" + ICSParam.VALUE_TYPE + "=" + this.valueType; @@ -520,95 +771,78 @@ namespace CampusAppWP8.Utility return retValue; } - public byte[] ValueBytes - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - - public string ValueString - { - get - { - return Encoding.UTF8.GetString(this.value, 0, this.value.Length); - } - set - { - this.value = Encoding.UTF8.GetBytes(value); - } - } - - public string EncodingType - { - get - { - return this.encodingType; - } - set - { - if (value.Equals(ICSParamValue.BIT8) || value.Equals(ICSParamValue.BASE64)) - { - this.encodingType = value; - } - } - } - - public string ValueType - { - get - { - return this.valueType; - } - set - { - if (value.Equals(ICSParamValue.BINARY)) - { - this.valueType = value; - } - } - } - - public string FormatType - { - get - { - return this.formatType; - } - set - { - this.formatType = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Attachment.Name; } } + /// Categories property class. + /// Fiedler, 05.09.2013. + /// public class Categories : Interface { - // 3.8.1.2 + /// The name. public static readonly string Name = ICSTag.CATEGORIES; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { + = new List>(new Tuple[] + { new Tuple(ICSParam.LANGUAGE, null) }); + /// List of values. private List valueList = null; + + /// Type of the language. private string languageType = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Categories() { this.valueList = new List(); } + /// Gets or sets the value. + /// The value. + public List Value + { + get + { + return this.valueList; + } + + set + { + this.valueList = value; + } + } + + /// Gets or sets the language. + /// The language. + public string Language + { + get + { + return this.languageType; + } + + set + { + this.languageType = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { if (paramStrList.Count() > 1) @@ -617,27 +851,30 @@ namespace CampusAppWP8.Utility } else if (paramStrList.Count() == 1) { - string[] pSplit = paramStrList[0].Split('='); + string[] p = paramStrList[0].Split('='); - if (pSplit.Length != 2) + if (p.Length != 2) { throw new NotSupportedException("the number of '=' in the parameter (" + paramStrList[0] + ") is less or greater then 1"); } - switch (pSplit[0]) + switch (p[0]) { case ICSParam.LANGUAGE: - this.languageType = pSplit[1]; + this.languageType = p[1]; break; default: - throw new NotSupportedException("Parameter with tag (" + pSplit[0] + ") is not supported"); + throw new NotSupportedException("Parameter with tag (" + p[0] + ") is not supported"); } } this.valueList.AddRange(valueStr.Split(',')); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -651,7 +888,7 @@ namespace CampusAppWP8.Utility retValue += ":" + this.valueList.First(); - for(int i = 1; i < this.valueList.Count(); i++) + for (int i = 1; i < this.valueList.Count(); i++) { retValue += "," + this.valueList[i]; } @@ -659,18 +896,9 @@ namespace CampusAppWP8.Utility return retValue; } - public List Value - { - get - { - return this.valueList; - } - set - { - this.valueList = value; - } - } - + /// Adds a category. + /// Fiedler, 05.09.2013. + /// Name of the category. public void AddCategory(string categoryName) { if (this.valueList.IndexOf(categoryName) < 0) @@ -679,50 +907,81 @@ namespace CampusAppWP8.Utility } } + /// Removes the category described by categoryName. + /// Fiedler, 05.09.2013. + /// Name of the category. public void RemoveCategory(string categoryName) { this.valueList.Remove(categoryName); } - public string Language - { - get - { - return this.languageType; - } - set - { - this.languageType = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Categories.Name; } } + /// Access class. + /// Fiedler, 05.09.2013. + /// public class AccessClass : Interface { - // 3.8.1.3. + /// The name. public static readonly string Name = ICSTag.ACCESS_CLASS; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// List of values. public readonly List ValueList = null; + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public AccessClass() { this.ValueList = new List(); - this.ValueList.AddRange(new string[] { + this.ValueList.AddRange(new string[] + { ICSValue.PUBLIC, ICSValue.PRIVATE, ICSValue.CONFIDENTIAL }); } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + if (this.ValueList.IndexOf(value) >= 0) + { + this.value = value; + } + else + { + throw new NotSupportedException("value (" + value + ") is not supported"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { if (paramStrList.Count() > 0) @@ -740,83 +999,136 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { - return (Name + ":" + this.value); - } - - public string Value - { - get - { - return this.value; - } - set - { - if (this.ValueList.IndexOf(value) >= 0) - { - this.value = value; - } - else - { - throw new NotSupportedException("value (" + value + ") is not supported"); - } - } + return Name + ":" + this.value; } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return AccessClass.Name; } } + /// Comment property class. + /// Fiedler, 05.09.2013. + /// public class Comment : Interface { - // 3.8.1.4 + /// The name. public static readonly string Name = ICSTag.COMMENT; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { + = new List>(new Tuple[] + { new Tuple(ICSParam.ALT_REPRESENTATION, null), new Tuple(ICSParam.LANGUAGE, null) }); + /// The alternative representation. private string altrep = string.Empty; + + /// Type of the language. private string languageType = string.Empty; + + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Comment() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Gets or sets the alternate representation. + /// The alternate representation. + public string AltRepresentation + { + get + { + return this.altrep; + } + + set + { + this.altrep = value; + } + } + + /// Gets or sets the language. + /// The language. + public string Language + { + get + { + return this.languageType; + } + + set + { + this.languageType = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// List of parameter strings. public override void Set(string valueStr, string[] paramStrList) { - foreach (string p in paramStrList) + foreach (string param in paramStrList) { - string[] pSplit = p.Split('='); + string[] p = param.Split('='); - if (pSplit.Count() != 2) + if (p.Count() != 2) { - throw new NotSupportedException("the number of '=' in the parameter (" + p + ") is less or greater then 1"); + throw new NotSupportedException("the number of '=' in the parameter (" + param + ") is less or greater then 1"); } - switch (pSplit[0]) + switch (p[0]) { case ICSParam.LANGUAGE: - this.languageType = pSplit[1]; + this.languageType = p[1]; break; case ICSParam.ALT_REPRESENTATION: // TODO: test, remove DQUOTES " - this.altrep = pSplit[1]; + this.altrep = p[1]; break; default: - throw new NotSupportedException("Parameter with tag (" + pSplit[0] + ") is not supported"); + throw new NotSupportedException("Parameter with tag (" + p[0] + ") is not supported"); } } this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -828,6 +1140,7 @@ namespace CampusAppWP8.Utility // TODO: add DQUOTES " retValue += ";" + ICSParam.ALT_REPRESENTATION + "=" + this.altrep; } + if (this.languageType.Equals(string.Empty) == false) { retValue += ";" + ICSParam.LANGUAGE + "=" + this.languageType; @@ -838,79 +1151,82 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - - public string AltRepresentation - { - get - { - return this.altrep; - } - set - { - this.altrep = value; - } - } - - public string Langauge - { - get - { - return this.languageType; - } - set - { - this.languageType = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Comment.Name; } } + /// Description property class. + /// Fiedler, 05.09.2013. + /// public class Description : Comment // because the structure is the same { - // 3.8.1.5 - public static readonly string Name = ICSTag.DESCRIPTION; + /// The name. + public static new readonly string Name = ICSTag.DESCRIPTION; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Description() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Description.Name; } } + /// Geo property class. + /// Fiedler, 05.09.2013. + /// public class Geo : Interface { - // 3.8.1.6 + /// The name. public static readonly string Name = ICSTag.GEO; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private Tuple value = null; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Geo() { } + /// Gets or sets the value. + /// The value. + public Tuple Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { - if ((paramStr == null) || (paramStr.Equals(string.Empty))) + if (paramStr == null || paramStr.Equals(string.Empty)) { this.Set(valueStr); } @@ -920,6 +1236,12 @@ namespace CampusAppWP8.Utility } } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the format of the ? is incorrect. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -937,6 +1259,10 @@ namespace CampusAppWP8.Utility this.value = new Tuple(float.Parse(valSplit[0]), float.Parse(valSplit[1])); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -953,55 +1279,89 @@ namespace CampusAppWP8.Utility return retValue; } - public Tuple Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Geo.Name; } } + /// Location property class. + /// Fiedler, 05.09.2013. + /// public class Location : Comment // because the structure is the same { - // 3.8.1.7. - public static readonly string Name = ICSTag.LOCATION; + /// The name. + public static new readonly string Name = ICSTag.LOCATION; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Location() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Location.Name; } } + /// Percent complete. + /// Fiedler, 05.09.2013. + /// public class PercentComplete : Interface { - // 3.8.1.8 + /// The name. public static readonly string Name = ICSTag.PERCENT; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private int value = -1; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public PercentComplete() { } + /// Gets or sets the value. + /// The value. + public int Value + { + get + { + return this.value; + } + + set + { + if ((value >= 0) && (value <= 100)) + { + this.value = value; + } + else + { + throw new ArgumentOutOfRangeException("value must be in rang of [0..100] in (" + Name + ")"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { - if ((paramStr == null) || (paramStr.Equals(string.Empty))) + if (paramStr == null || paramStr.Equals(string.Empty)) { this.Set(valueStr); } @@ -1011,6 +1371,11 @@ namespace CampusAppWP8.Utility } } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1021,6 +1386,10 @@ namespace CampusAppWP8.Utility this.value = int.Parse(valueStr); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1037,47 +1406,66 @@ namespace CampusAppWP8.Utility return retValue; } - public int Value - { - get - { - return this.value; - } - set - { - if ((value >= 0) && (value <= 100)) - { - this.value = value; - } - else - { - throw new ArgumentOutOfRangeException("value must be in rang of [0..100] in (" + Name + ")"); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return PercentComplete.Name; } } + /// Priority property class. + /// Fiedler, 05.09.2013. + /// public class Priority : Interface { - // 3.8.1.9. + /// The name. public static readonly string Name = ICSTag.PRIORITY; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private int value = -1; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Priority() { } + /// Gets or sets the value. + /// The value. + public int Value + { + get + { + return this.value; + } + + set + { + if (value >= 0 && value <= 9) + { + this.value = value; + } + else + { + throw new ArgumentOutOfRangeException("value must be in rage of [0..9] in (" + Name + ")"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { - if ((paramStr == null) || (paramStr.Equals(string.Empty))) + if (paramStr == null || paramStr.Equals(string.Empty)) { this.Set(valueStr); } @@ -1087,6 +1475,14 @@ namespace CampusAppWP8.Utility } } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not + /// supported. + /// Thrown when one or more arguments are outside the + /// required range. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1102,6 +1498,10 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1118,70 +1518,77 @@ namespace CampusAppWP8.Utility return retValue; } - public int Value - { - get - { - return this.value; - } - set - { - if (value >= 0 && value <= 9) - { - this.value = value; - } - else - { - throw new ArgumentOutOfRangeException("value must be in rage of [0..9] in (" + Name + ")"); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Priority.Name; } } + /// Resources property class. + /// Fiedler, 05.09.2013. + /// public class Resources : Comment // because the structure is the same { - // 3.8.1.10. - public static readonly string Name = ICSTag.RESOURCES; + /// The name. + public static new readonly string Name = ICSTag.RESOURCES; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Resources() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Resources.Name; } } + /// Status property class. + /// Fiedler, 05.09.2013. + /// public class Status : Interface { - // 3.8.1.11. + /// The name. public static readonly string Name = ICSTag.STATUS; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value list event. public readonly List ValueListEvent = null; + + /// The value list to do. public readonly List ValueListToDo = null; + + /// The value list journal. public readonly List ValueListJournal = null; + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Status() { this.ValueListEvent = new List(); - this.ValueListEvent.AddRange(new string[] { + this.ValueListEvent.AddRange(new string[] + { ICSValue.TENTATIVE, ICSValue.CONFIRMED, ICSValue.CANCELLED }); this.ValueListToDo = new List(); - this.ValueListToDo.AddRange(new string[] { + this.ValueListToDo.AddRange(new string[] + { ICSValue.NEEDS_ACTION, ICSValue.COMPLETED, ICSValue.IN_PROCESS, @@ -1189,16 +1596,46 @@ namespace CampusAppWP8.Utility }); this.ValueListJournal = new List(); - this.ValueListJournal.AddRange(new string[] { + this.ValueListJournal.AddRange(new string[] + { ICSValue.DRAFT, ICSValue.FINAL, ICSValue.CANCELLED }); } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + if ((this.ValueListEvent.IndexOf(value) >= 0) + || (this.ValueListToDo.IndexOf(value) >= 0) + || (this.ValueListJournal.IndexOf(value) >= 0)) + { + this.value = value; + } + else + { + throw new NotSupportedException("value (" + value + ") is not supported in (" + Name + ")"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { - if ((paramStr == null) || (paramStr.Equals(string.Empty))) + if (paramStr == null || paramStr.Equals(string.Empty)) { this.Set(valueStr); } @@ -1208,6 +1645,11 @@ namespace CampusAppWP8.Utility } } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1225,6 +1667,9 @@ namespace CampusAppWP8.Utility this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1234,65 +1679,83 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - if ((this.ValueListEvent.IndexOf(value) >= 0) - || (this.ValueListToDo.IndexOf(value) >= 0) - || (this.ValueListJournal.IndexOf(value) >= 0)) - { - this.value = value; - } - else - { - throw new NotSupportedException("value (" + value + ") is not supported in (" + Name + ")"); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Status.Name; } } + /// Summary property class. + /// Fiedler, 05.09.2013. + /// public class Summary : Comment // because the structure is the same { - // 3.8.1.12. - public static readonly string Name = ICSTag.SUMMARY; + /// The name. + public static new readonly string Name = ICSTag.SUMMARY; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Summary() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Summary.Name; } } + /// DTCompleted property class. + /// Fiedler, 05.09.2013. + /// public class DTCompleted : Interface { - // 3.8.2.1. + /// The name. public static readonly string Name = ICSTag.COMPLETED; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// Date/Time of the value. private DateTime value = DateTime.MinValue; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public DTCompleted() { } + /// Gets or sets the Date/Time of the value. + /// The value. + public DateTime Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { - if ((paramStr == null) || (paramStr.Equals(string.Empty))) + if (paramStr == null || paramStr.Equals(string.Empty)) { this.Set(valueStr); } @@ -1302,6 +1765,11 @@ namespace CampusAppWP8.Utility } } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1312,6 +1780,9 @@ namespace CampusAppWP8.Utility this.value = UTCStringToDateTime(valueStr); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1321,45 +1792,134 @@ namespace CampusAppWP8.Utility return retValue; } - public DateTime Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return DTCompleted.Name; } } + /// DTEnd property class. + /// Fiedler, 05.09.2013. + /// public class DTEnd : Interface { - // 3.8.2.2. + /// The name. public static readonly string Name = ICSTag.DT_END; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { - new Tuple(ICSParam.VALUE_TYPE, new string[] { + = new List>(new Tuple[] + { + new Tuple(ICSParam.VALUE_TYPE, new string[] + { ICSParamValue.DATE_TIME, ICSParamValue.DATE }), new Tuple(ICSParam.TIME_ZONE_ID, null) }); + /// Date/Time of the value. private DateTime value = DateTime.MinValue; + + /// List of parameters. private List> paramList = null; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public DTEnd() { this.paramList = new List>(); } + /// Gets or sets the Date/Time of the value. + /// The value. + public DateTime Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Gets or sets a value indicating whether this object is date. + /// true if this object is date, false if not. + public bool IsDate + { + get + { + bool isDate = false; + int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); + + if (pos >= 0 && this.paramList[pos].Item2.Equals(ICSParamValue.DATE)) + { + isDate = true; + } + + return isDate; + } + + set + { + int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); + + if (pos < 0) + { + this.paramList.Add(new Tuple(ICSParam.VALUE_TYPE, (value == true) ? ICSParamValue.DATE : ICSParamValue.DATE_TIME)); + } + else + { + this.paramList[pos] = new Tuple(ICSParam.VALUE_TYPE, (value == true) ? ICSParamValue.DATE : ICSParamValue.DATE_TIME); + } + } + } + + /// Gets or sets the time zone. + /// The time zone. + public string TimeZone + { + get + { + int pos = CheckParam(ICSParam.TIME_ZONE_ID, this.paramList.ToArray()); + + if (pos >= 0) + { + return this.paramList[pos].Item2; + } + else + { + return string.Empty; + } + } + + set + { + int pos = CheckParam(ICSParam.TIME_ZONE_ID, this.paramList.ToArray()); + + if (pos < 0) + { + this.paramList.Add(new Tuple(ICSParam.TIME_ZONE_ID, value)); + } + else + { + this.paramList[pos] = new Tuple(ICSParam.TIME_ZONE_ID, value); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the format of the ? is incorrect. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1369,7 +1929,7 @@ namespace CampusAppWP8.Utility throw new NotSupportedException("too many params in (" + Name + ")"); } - for(int i = 0; i < paramStrList.Count(); i++) + for (int i = 0; i < paramStrList.Count(); i++) { string[] p = paramStrList[i].Split('='); @@ -1382,9 +1942,9 @@ namespace CampusAppWP8.Utility { int pos = CheckParam(p[0], this.paramList.ToArray()); - if(pos < 0) + if (pos < 0) { - this.paramList.Add(new Tuple(p[0], p[1])); + this.paramList.Add(new Tuple(p[0], p[1])); } else { @@ -1402,7 +1962,7 @@ namespace CampusAppWP8.Utility bool isDate = false; int posVal = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); - if(posVal >= 0 && this.paramList[posVal].Item2.Equals(ICSParamValue.DATE)) + if (posVal >= 0 && this.paramList[posVal].Item2.Equals(ICSParamValue.DATE)) { isDate = true; } @@ -1415,13 +1975,16 @@ namespace CampusAppWP8.Utility this.value = UTCStringToDateTime(valueStr); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; retValue += Name; - for(int i = 0; i < this.paramList.Count(); i++) + for (int i = 0; i < this.paramList.Count(); i++) { retValue += ";" + this.paramList[i].Item1 + "=" + this.paramList[i].Item2; } @@ -1441,134 +2004,131 @@ namespace CampusAppWP8.Utility return retValue; } - public DateTime Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - - public bool IsDate - { - get - { - bool isDate = false; - int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); - - if (pos >= 0 && this.paramList[pos].Item2.Equals(ICSParamValue.DATE)) - { - isDate = true; - } - - return isDate; - } - set - { - int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); - - if (pos < 0) - { - this.paramList.Add(new Tuple(ICSParam.VALUE_TYPE, (value == true) ? ICSParamValue.DATE : ICSParamValue.DATE_TIME)); - } - else - { - this.paramList[pos] = new Tuple(ICSParam.VALUE_TYPE, (value == true) ? ICSParamValue.DATE : ICSParamValue.DATE_TIME); - } - } - } - - public string TimeZone - { - get - { - int pos = CheckParam(ICSParam.TIME_ZONE_ID, this.paramList.ToArray()); - - if (pos >= 0) - { - return this.paramList[pos].Item2; - } - else - { - return string.Empty; - } - } - set - { - int pos = CheckParam(ICSParam.TIME_ZONE_ID, this.paramList.ToArray()); - - if (pos < 0) - { - this.paramList.Add(new Tuple(ICSParam.TIME_ZONE_ID, value)); - } - else - { - this.paramList[pos] = new Tuple(ICSParam.TIME_ZONE_ID, value); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return DTEnd.Name; } } + /// DTDue property class. + /// Fiedler, 05.09.2013. + /// public class DTDue : DTEnd // because the structure is the same { - // 3.8.2.3. - public static readonly string Name = ICSTag.DUE; + /// The name. + public static new readonly string Name = ICSTag.DUE; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public DTDue() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return DTDue.Name; } } + /// DTStart property class. + /// Fiedler, 05.09.2013. + /// public class DTStart : DTEnd // because the structure is the same { - // 3.8.2.4. - public static readonly string Name = ICSTag.DT_START; + /// The name. + public static new readonly string Name = ICSTag.DT_START; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public DTStart() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return DTStart.Name; } } + /// Duration property class. + /// Fiedler, 05.09.2013. + /// public class Duration : Interface { - // 3.8.2.5. + /// The name. public static readonly string Name = ICSTag.DURATION; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private TimeSpan value = TimeSpan.Zero; + + /// true if this object is negative. private bool isNegative = false; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Duration() { } + /// Gets or sets the value. + /// The value. + public TimeSpan Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Gets or sets a value indicating whether this object is negative. + /// true if this object is negative, false if not. + public bool IsNegative + { + get + { + return this.isNegative; + } + + set + { + this.isNegative = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { this.Set(valueStr); } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1585,6 +2145,9 @@ namespace CampusAppWP8.Utility this.value = StringToTimeSpan(valueStr); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1594,43 +2157,29 @@ namespace CampusAppWP8.Utility return retValue; } - public TimeSpan Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - - public bool IsNegative - { - get - { - return this.isNegative; - } - set - { - this.isNegative = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Duration.Name; } } + /// Free busy time property class. + /// Fiedler, 05.09.2013. + /// public class FreeBusyTime : Interface { - // 3.8.2.6. + /// The name. public static readonly string Name = ICSTag.FREEBUSY; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { - new Tuple(ICSParam.FREE_BUSY_TIME_TYPE, new string[] { + = new List>(new Tuple[] + { + new Tuple(ICSParam.FREE_BUSY_TIME_TYPE, new string[] + { ICSParamValue.FREE, ICSParamValue.BUSY, ICSParamValue.BUSY_UNAVAILABLE, @@ -1638,14 +2187,62 @@ namespace CampusAppWP8.Utility }) }); + /// Type of the free busy. private string freebusyType = string.Empty; - private List> valueList = null; + /// List of values. + private List> valueList = null; + + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public FreeBusyTime() { this.valueList = new List>(); } + /// Gets or sets a list of values. + /// A List of values. + public List> ValueList + { + get + { + return this.valueList; + } + + set + { + this.valueList = value; + } + } + + /// Gets or sets the type of the free busy. + /// The type of the free busy. + public string FreeBusyType + { + get + { + return this.freebusyType; + } + + set + { + if (!CheckParamAndParamValue(ICSParam.FREE_BUSY_TIME_TYPE, value, PParams.ToArray())) + { + throw new NotSupportedException("param value (" + value + ") is not supported"); + } + else + { + this.freebusyType = value; + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the format of the ? is incorrect. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null && paramStrList.Count() > 0) @@ -1655,27 +2252,27 @@ namespace CampusAppWP8.Utility throw new NotSupportedException("there is only 1 param in (" + Name + ") supported"); } - string[] pSplit = paramStrList[0].Split('='); + string[] p = paramStrList[0].Split('='); - if (pSplit.Count() != 2) + if (p.Count() != 2) { throw new FormatException("parameter string (" + paramStrList[0] + ") is wrong"); } - if (CheckParamAndParamValue(pSplit[0], pSplit[1], PParams.ToArray())) + if (CheckParamAndParamValue(p[0], p[1], PParams.ToArray())) { if (this.freebusyType.Equals(string.Empty)) { - this.freebusyType = pSplit[1]; + this.freebusyType = p[1]; } else { - throw new FormatException("param (" + pSplit[0] + ") sould only occure once"); + throw new FormatException("param (" + p[0] + ") sould only occure once"); } } else { - throw new NotSupportedException("unsupported param (" + pSplit[0] + ")"); + throw new NotSupportedException("unsupported param (" + p[0] + ")"); } } @@ -1695,7 +2292,7 @@ namespace CampusAppWP8.Utility DateTime partDTEnd = DateTime.MinValue; bool partTSDurNegative = false; - if ((subSplit[1][subSplit[1].Length - 1].Equals('Z')) + if (subSplit[1][subSplit[1].Length - 1].Equals('Z') || (subSplit[1][subSplit[1].Length - 1] >= '0' && subSplit[1][subSplit[1].Length - 1] <= '9')) { partDTEnd = UTCStringToDateTime(subSplit[1]); @@ -1707,6 +2304,7 @@ namespace CampusAppWP8.Utility partTSDurNegative = subSplit[1][0].Equals('-'); subSplit[1] = subSplit[1].Remove(0, 1); } + partTSDur = StringToTimeSpan(subSplit[1]); } @@ -1714,6 +2312,9 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1729,7 +2330,7 @@ namespace CampusAppWP8.Utility for (int i = 0; i < this.valueList.Count(); i++) { - if(i > 0) + if (i > 0) { retValue += ","; } @@ -1749,78 +2350,100 @@ namespace CampusAppWP8.Utility return retValue; } - public List> ValueList + /// Adds a value. + /// Fiedler, 05.09.2013. + /// Date/Time of the start. + /// The duration. + /// (Optional) the is negative. + public void AddValue(DateTime datetimeStart, TimeSpan timespanDur, bool isNegative = false) { - get - { - return this.valueList; - } - set - { - this.valueList = value; - } + this.valueList.Add(new Tuple(datetimeStart, timespanDur, DateTime.MinValue, isNegative)); } - public string FreeBusyType + /// Adds a value. + /// Fiedler, 05.09.2013. + /// Date/Time of the start. + /// Date/Time of the end. + public void AddValue(DateTime datetimeStart, DateTime datetimeEnd) { - get - { - return this.freebusyType; - } - set - { - if (!CheckParamAndParamValue(ICSParam.FREE_BUSY_TIME_TYPE, value, PParams.ToArray())) - { - throw new NotSupportedException("param value (" + value + ") is not supported"); - } - else - { - this.freebusyType = value; - } - } - } - - public void AddValue(DateTime dtStart, TimeSpan tsDur, bool isNegative = false) - { - this.valueList.Add(new Tuple(dtStart, tsDur, DateTime.MinValue, isNegative)); - } - - public void AddValue(DateTime dtStart, DateTime dtEnd) - { - this.ValueList.Add(new Tuple(dtStart, TimeSpan.Zero, dtEnd, false)); + this.ValueList.Add(new Tuple(datetimeStart, TimeSpan.Zero, datetimeEnd, false)); } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return FreeBusyTime.Name; } } + /// Time transparency property class. + /// Fiedler, 05.09.2013. + /// public class TimeTransparency : Interface { - // 3.8.2.7. + /// The name. public static readonly string Name = ICSTag.TRANSP; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// List of values. public readonly List ValueList = null; + /// The value. private string value = ICSValue.OPAQUE; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public TimeTransparency() { this.ValueList = new List(); - this.ValueList.AddRange(new string[] { + this.ValueList.AddRange(new string[] + { ICSValue.OPAQUE, ICSValue.TRANSPARENT }); } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + if (this.ValueList.IndexOf(value) < 0) + { + throw new NotSupportedException("value (" + value + ") is not supported"); + } + else + { + this.value = value; + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { this.Set(valueStr); } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1836,6 +2459,9 @@ namespace CampusAppWP8.Utility this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1845,49 +2471,65 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - if (this.ValueList.IndexOf(value) < 0) - { - throw new NotSupportedException("value (" + value + ") is not supported"); - } - else - { - this.value = value; - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return TimeTransparency.Name; } } + /// Time zone identifier property class. + /// Fiedler, 05.09.2013. + /// public class TimeZoneIdentifier : Interface { - // 3.8.3.1. + /// The name. public static readonly string Name = ICSTag.TIME_ZONE_ID; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public TimeZoneIdentifier() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { this.Set(valueStr); } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1898,6 +2540,9 @@ namespace CampusAppWP8.Utility this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1907,40 +2552,78 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return TimeZoneIdentifier.Name; } } + /// Time zone name property class. + /// Fiedler, 05.09.2013. + /// public class TimeZoneName : Interface { - // 3.8.3.2. + /// The name. public static readonly string Name = ICSTag.TIME_ZONE_NAME; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { + = new List>(new Tuple[] + { new Tuple(ICSParam.LANGUAGE, null) }); + /// The language. private string language = string.Empty; + + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public TimeZoneName() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Gets or sets the language. + /// The language. + public string Language + { + get + { + return this.language; + } + + set + { + this.language = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the format of the ? is incorrect. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -1952,20 +2635,20 @@ namespace CampusAppWP8.Utility if (paramStrList.Count() == 1) { - string[] pSplit = paramStrList[0].Split('='); + string[] p = paramStrList[0].Split('='); - if (pSplit.Count() != 2) + if (p.Count() != 2) { throw new FormatException("unsupported format in param (" + paramStrList[0] + ")"); } - if (pSplit[0].Equals(ICSParam.LANGUAGE)) + if (p[0].Equals(ICSParam.LANGUAGE)) { - this.language = pSplit[1]; + this.language = p[1]; } else { - throw new NotSupportedException("unsupported param (" + pSplit[0] + ")"); + throw new NotSupportedException("unsupported param (" + p[0] + ")"); } } } @@ -1973,6 +2656,9 @@ namespace CampusAppWP8.Utility this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -1989,55 +2675,84 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - - public string Language - { - get - { - return this.language; - } - set - { - this.language = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return TimeZoneName.Name; } } + /// Time zone offset from property class. + /// Fiedler, 05.09.2013. + /// public class TimeZoneOffsetFrom : Interface { - // 3.8.3.3. + /// The name. public static readonly string Name = ICSTag.TIME_ZONE_OFFSET_FROM; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// true if this object is negative. private bool isNegative = false; + + /// The value. private TimeSpan value = TimeSpan.Zero; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public TimeZoneOffsetFrom() { } + /// Gets or sets the value. + /// The value. + public TimeSpan Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Gets or sets a value indicating whether this object is negative. + /// true if this object is negative, false if not. + public bool IsNegative + { + get + { + return this.isNegative; + } + + set + { + this.isNegative = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { this.Set(valueStr); } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the requested operation is unimplemented. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -2045,11 +2760,11 @@ namespace CampusAppWP8.Utility throw new NotSupportedException("no param supported in (" + Name + ")"); } - if(valueStr[0].Equals('+')) + if (valueStr[0].Equals('+')) { this.isNegative = false; } - else if(valueStr[0].Equals('-')) + else if (valueStr[0].Equals('-')) { this.isNegative = true; } @@ -2058,82 +2773,104 @@ namespace CampusAppWP8.Utility throw new NotImplementedException("unhandled starting char (" + valueStr + ")"); } - this.value = new TimeSpan(int.Parse(valueStr.Substring(1, 2)), int.Parse(valueStr.Substring(3, 2)), ((valueStr.Length > 5) ? int.Parse(valueStr.Substring(5, 2)) : 0)); + this.value = new TimeSpan(int.Parse(valueStr.Substring(1, 2)), int.Parse(valueStr.Substring(3, 2)), (valueStr.Length > 5) ? int.Parse(valueStr.Substring(5, 2)) : 0); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; - retValue += Name + ":" + ((this.isNegative) ? "-" : "+") + string.Format("{0:HHmm}", this.value); + retValue += Name + ":" + (this.isNegative ? "-" : "+") + string.Format("{0:HHmm}", this.value); return retValue; } - public TimeSpan Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - - public bool IsNegative - { - get - { - return this.isNegative; - } - set - { - this.isNegative = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return TimeZoneOffsetFrom.Name; } } + /// Time zone offset to property class. + /// Fiedler, 05.09.2013. + /// public class TimeZoneOffsetTo : TimeZoneOffsetFrom // because the structure is the same { - // 3.8.3.4. - public static readonly string Name = ICSTag.TIME_ZONE_OFFSET_TO; - + /// The name. + public static new readonly string Name = ICSTag.TIME_ZONE_OFFSET_TO; + + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public TimeZoneOffsetTo() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return TimeZoneOffsetTo.Name; } } + /// Time zone url property class. + /// Fiedler, 05.09.2013. + /// public class TimeZoneUrl : Interface // INTERFACE: string value only { - // 3.8.3.5. + /// The name. public static readonly string Name = ICSTag.TIME_ZONE_URL; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public TimeZoneUrl() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// The value string. + /// The parameter string. public override void Set(string valueStr, string paramStr) { this.Set(valueStr); } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) @@ -2144,6 +2881,9 @@ namespace CampusAppWP8.Utility this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -2153,31 +2893,29 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return TimeZoneUrl.Name; } } + /// Attendee property class. + /// Fiedler, 05.09.2013. + /// public class Attendee : Interface { - // 3.8.4.1. + /// The name. public static readonly string Name = ICSTag.ATTENDEE; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { - new Tuple(ICSParam.CALENDAR_USER_TYPE, new string[] { + = new List>(new Tuple[] + { + new Tuple(ICSParam.CALENDAR_USER_TYPE, new string[] + { ICSParamValue.INDIVIDUAL, ICSParamValue.GROUP, ICSParamValue.RESOURCE, @@ -2185,25 +2923,28 @@ namespace CampusAppWP8.Utility ICSParamValue.UNKNOWN }), new Tuple(ICSParam.MEMBER, null), - new Tuple(ICSParam.PARTICIPATION_ROLE, new string[] { + new Tuple(ICSParam.PARTICIPATION_ROLE, new string[] + { ICSParamValue.CHAIR, ICSParamValue.REQ_PARTICIPANT, ICSParamValue.OPT_PARTICIPANT, ICSParamValue.NON_PARTICIPANT }), - new Tuple(ICSParam.PARTICIPATION_STATUS, new string[] { - // event + new Tuple(ICSParam.PARTICIPATION_STATUS, new string[] + { + //// event ICSParamValue.NEEDS_ACTION, ICSParamValue.ACCEPTED, ICSParamValue.DECLINED, ICSParamValue.TENTATIVE, ICSParamValue.DELEGATED, - // todo + //// todo ICSParamValue.COMPLETED, ICSParamValue.IN_PROCESS - // journat + //// journat }), - new Tuple(ICSParam.REPLY_EXPECTATION, new string[] { + new Tuple(ICSParam.REPLY_EXPECTATION, new string[] + { ICSParamValue.TRUE, ICSParamValue.FALSE }), @@ -2215,30 +2956,79 @@ namespace CampusAppWP8.Utility new Tuple(ICSParam.LANGUAGE, null) }); - protected List> paramList = null; - protected string value = string.Empty; + /// List of parameters. + private List> paramList = null; + + /// The value. + private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Attendee() { this.paramList = new List>(); } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Gets or sets the parameter. + /// The parameter. + public List> Param + { + get + { + return this.paramList; + } + + set + { + for (int i = 0; i < value.Count(); i++) + { + if (!CheckParamAndParamValue(value[i].Item1, value[i].Item2, PParams.ToArray())) + { + throw new NotSupportedException("param (" + value[i] + ") is not supported"); + } + } + + this.paramList = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the format of the ? is incorrect. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null) { for (int i = 0; i < paramStrList.Count(); i++) { - string[] pSplit = paramStrList[i].Split('='); + string[] p = paramStrList[i].Split('='); - if (pSplit.Count() != 2) + if (p.Count() != 2) { throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")"); } - if(CheckParamAndParamValue(pSplit[0], pSplit[1], PParams.ToArray())) + if (CheckParamAndParamValue(p[0], p[1], PParams.ToArray())) { - this.paramList.Add(new Tuple(pSplit[0], pSplit[1])); + this.paramList.Add(new Tuple(p[0], p[1])); } else { @@ -2250,6 +3040,9 @@ namespace CampusAppWP8.Utility this.value = valueStr; } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -2266,38 +3059,10 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - - public List> Param - { - get - { - return this.paramList; - } - set - { - for (int i = 0; i < value.Count(); i++) - { - if (!CheckParamAndParamValue(value[i].Item1, value[i].Item2, PParams.ToArray())) - { - throw new NotSupportedException("param (" + value[i] + ") is not supported"); - } - } - - this.paramList = value; - } - } - + /// Adds a parameter to value string. + /// Fiedler, 05.09.2013. + /// The parameter string. + /// The value string. public void AddParam(string paramStr, string valueStr) { if (CheckParamAndParamValue(paramStr, valueStr, PParams.ToArray())) @@ -2308,6 +3073,9 @@ namespace CampusAppWP8.Utility } } + /// Removes the parameter described by parameter string. + /// Fiedler, 05.09.2013. + /// The parameter string. public void RemoveParam(string paramStr) { int pos = CheckParam(paramStr, this.paramList.ToArray()); @@ -2318,151 +3086,152 @@ namespace CampusAppWP8.Utility } } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Attendee.Name; } } + /// Contact property class. + /// Fiedler, 05.09.2013. + /// public class Contact : Comment // because the structure is the same { - // 3.8.4.2. - public static readonly string Name = ICSTag.CONTACT; + /// The name. + public static new readonly string Name = ICSTag.CONTACT; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Contact() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Contact.Name; } } + /// Organizer property class. + /// Fiedler, 05.09.2013. + /// public class Organizer : Attendee // nearly the same structure { - // 3.8.4.3. - public static readonly string Name = ICSTag.ORGANIZER; - public static readonly List> PParams - = new List>(new Tuple[] { + /// The name. + public static new readonly string Name = ICSTag.ORGANIZER; + + /// Options for controlling the operation. + public static new readonly List> PParams + = new List>(new Tuple[] + { new Tuple(ICSParam.COMMON_NAME, null), new Tuple(ICSParam.DIR_REFERENCE, null), new Tuple(ICSParam.SENT_BY, null), new Tuple(ICSParam.LANGUAGE, null) }); + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Organizer() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Organizer.Name; } } + /// Recurrence identifier property class. + /// Fiedler, 05.09.2013. + /// public class RecurrenceID : DTEnd // because the structure is the same { - // 3.8.4.4. - public static readonly string Name = ICSTag.RECURRENCE_ID; + /// The name. + public static new readonly string Name = ICSTag.RECURRENCE_ID; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public RecurrenceID() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return RecurrenceID.Name; } } + /// Related to property class. + /// Fiedler, 05.09.2013. + /// public class RelatedTo : Interface { - // 3.8.4.5. + /// The name. public static readonly string Name = ICSTag.RELATED; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { - new Tuple(ICSParam.RELATIONSHIP_TYPE, new string[] { + = new List>(new Tuple[] + { + new Tuple(ICSParam.RELATIONSHIP_TYPE, new string[] + { ICSParamValue.PARENT, ICSParamValue.CHILD, ICSParamValue.SIBLING }) }); + /// The value. private string value = string.Empty; + + /// Type of the real. private string realType = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public RelatedTo() { } - public override void Set(string valueStr, string[] paramStrList = null) - { - if (paramStrList != null && paramStrList.Count() > 0) - { - if (paramStrList.Count() > 1) - { - throw new NotSupportedException("there is only 1 param supported"); - } - else - { - string[] pSplit = paramStrList[0].Split('='); - - if (pSplit.Count() != 2) - { - throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")"); - } - - if (CheckParamAndParamValue(pSplit[0], pSplit[1], PParams.ToArray())) - { - this.realType = pSplit[1]; - } - else - { - throw new NotSupportedException("unsupported param (" + paramStrList[0] + ") in (" + Name + ")"); - } - } - } - - this.value = valueStr; - } - - public override string GetString() - { - string retValue = string.Empty; - - retValue += Name; - - if(!this.realType.Equals(string.Empty)) - { - retValue += ";" + ICSParam.RELATIONSHIP_TYPE + "=" + this.realType; - } - - retValue += ":" + this.value; - - return retValue; - } - + /// Gets or sets the value. + /// The value. public string Value { get { return this.value; } + set { this.value = value; } } + /// Gets or sets the type of the real. + /// The type of the real. public string RealType { get { return this.realType; } + set { if (CheckParamAndParamValue(ICSParam.RELATIONSHIP_TYPE, value, PParams.ToArray())) @@ -2476,83 +3245,12 @@ namespace CampusAppWP8.Utility } } - public override string GetName() - { - return RelatedTo.Name; - } - } - - public class Url : TimeZoneUrl // because structure is the same - { - // 3.8.4.6. - public static readonly string Name = ICSTag.URL; - - public Url() - : base() - { - } - - public override string GetName() - { - return Url.Name; - } - } - - public class UniqueID : TimeZoneUrl // because structure is the same - { - // 3.8.4.7. - public static readonly string Name = ICSTag.UNIQUE_ID; - - public UniqueID() - : base() - { - } - - public override string GetName() - { - return UniqueID.Name; - } - } - - public class DTException : DTEnd // because structure is the same - { - // 3.8.5.1. - public static readonly string Name = ICSTag.EXDATE; - - public DTException() - : base() - { - } - - public override string GetName() - { - return DTException.Name; - } - } - - public class DTRecurrence : Interface - { - // 3.8.5.2. - public static readonly string Name = ICSTag.RDATE; - public static readonly List> PParams - = new List>(new Tuple[] { - new Tuple(ICSParam.VALUE_TYPE, new string[] { - ICSParamValue.DATE_TIME, - ICSParamValue.DATE, - ICSParamValue.PERIOD - }), - new Tuple(ICSParam.TIME_ZONE_ID, null) - }); - - private List> values = null; - private List> paramList = null; - - public DTRecurrence() - { - this.values = new List>(); - this.paramList = new List>(); - } - + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the format of the ? is incorrect. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null && paramStrList.Count() > 0) @@ -2563,16 +3261,244 @@ namespace CampusAppWP8.Utility } else { - string[] pSplit = paramStrList[0].Split('='); + string[] p = paramStrList[0].Split('='); - if (pSplit.Count() != 2) + if (p.Count() != 2) { throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")"); } - if (CheckParamAndParamValue(pSplit[0], pSplit[1], PParams.ToArray())) + if (CheckParamAndParamValue(p[0], p[1], PParams.ToArray())) { - this.paramList.Add(new Tuple(pSplit[0], pSplit[1])); + this.realType = p[1]; + } + else + { + throw new NotSupportedException("unsupported param (" + paramStrList[0] + ") in (" + Name + ")"); + } + } + } + + this.value = valueStr; + } + + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. + public override string GetString() + { + string retValue = string.Empty; + + retValue += Name; + + if (!this.realType.Equals(string.Empty)) + { + retValue += ";" + ICSParam.RELATIONSHIP_TYPE + "=" + this.realType; + } + + retValue += ":" + this.value; + + return retValue; + } + + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. + public override string GetName() + { + return RelatedTo.Name; + } + } + + /// Url property class. + /// Fiedler, 05.09.2013. + /// + public class Url : TimeZoneUrl // because structure is the same + { + /// The name. + public static new readonly string Name = ICSTag.URL; + + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. + public Url() + : base() + { + } + + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. + public override string GetName() + { + return Url.Name; + } + } + + /// Unique identifier property class. + /// Fiedler, 05.09.2013. + /// + public class UniqueID : TimeZoneUrl // because structure is the same + { + /// The name. + public static new readonly string Name = ICSTag.UNIQUE_ID; + + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. + public UniqueID() + : base() + { + } + + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. + public override string GetName() + { + return UniqueID.Name; + } + } + + /// DTException property class. + /// Fiedler, 05.09.2013. + /// + public class DTException : DTEnd // because structure is the same + { + /// The name. + public static new readonly string Name = ICSTag.EXDATE; + + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. + public DTException() + : base() + { + } + + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. + public override string GetName() + { + return DTException.Name; + } + } + + /// DTRecurrence property class. + /// Fiedler, 05.09.2013. + /// + public class DTRecurrence : Interface + { + /// The name. + public static readonly string Name = ICSTag.RDATE; + + /// Options for controlling the operation. + public static readonly List> PParams + = new List>(new Tuple[] + { + new Tuple(ICSParam.VALUE_TYPE, new string[] + { + ICSParamValue.DATE_TIME, + ICSParamValue.DATE, + ICSParamValue.PERIOD + }), + new Tuple(ICSParam.TIME_ZONE_ID, null) + }); + + /// The values. + private List> values = null; + + /// List of parameters. + private List> paramList = null; + + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. + public DTRecurrence() + { + this.values = new List>(); + this.paramList = new List>(); + } + + /// Gets or sets the value. + /// The value. + public List> Value + { + get + { + return this.values; + } + + set + { + this.values = value; + } + } + + /// Gets or sets the type of the value. + /// The type of the value. + public string ValueType + { + get + { + int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); + + if (pos < 0) + { + return string.Empty; + } + else + { + return this.paramList[pos].Item2; + } + } + + set + { + if (CheckParamAndParamValue(ICSParam.VALUE_TYPE, value, PParams.ToArray())) + { + int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); + + if (pos < 0) + { + this.paramList.Add(new Tuple(ICSParam.VALUE_TYPE, value)); + } + else + { + this.paramList[pos] = new Tuple(ICSParam.VALUE_TYPE, value); + } + } + else + { + throw new NotSupportedException("param value (" + value + ") is not supported"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the format of the ? is incorrect. + /// Thrown when the requested operation is unimplemented. + /// The value string. + /// (Optional) List of parameter strings. + public override void Set(string valueStr, string[] paramStrList = null) + { + if (paramStrList != null && paramStrList.Count() > 0) + { + if (paramStrList.Count() > 1) + { + throw new NotSupportedException("there is only 1 param supported"); + } + else + { + string[] p = paramStrList[0].Split('='); + + if (p.Count() != 2) + { + throw new FormatException("unsupported param format (" + paramStrList + ") in (" + Name + ")"); + } + + if (CheckParamAndParamValue(p[0], p[1], PParams.ToArray())) + { + this.paramList.Add(new Tuple(p[0], p[1])); } else { @@ -2585,9 +3511,9 @@ namespace CampusAppWP8.Utility int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); - if ((pos < 0) - || (this.paramList[pos].Item2.Equals(ICSParamValue.DATE_TIME)) - || (this.paramList[pos].Item2.Equals(ICSParamValue.DATE))) + if (pos < 0 + || this.paramList[pos].Item2.Equals(ICSParamValue.DATE_TIME) + || this.paramList[pos].Item2.Equals(ICSParamValue.DATE)) { for (int i = 0; i < valSplit.Count(); i++) { @@ -2616,8 +3542,8 @@ namespace CampusAppWP8.Utility this.values.Add( new Tuple( UTCStringToDateTime(subVal[0]), - ((subVal[1][0].Equals('P') == false) ? UTCStringToDateTime(subVal[1]) : DateTime.MinValue), - ((subVal[1][0].Equals('P') == true) ? StringToTimeSpan(subVal[1]) : TimeSpan.Zero), + subVal[1][0].Equals('P') == false ? UTCStringToDateTime(subVal[1]) : DateTime.MinValue, + subVal[1][0].Equals('P') == true ? StringToTimeSpan(subVal[1]) : TimeSpan.Zero, isNegative)); } } @@ -2627,13 +3553,17 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The string. public override string GetString() { string retValue = string.Empty; retValue += Name; - for(int i = 0; i < this.paramList.Count(); i++) + for (int i = 0; i < this.paramList.Count(); i++) { retValue += ";" + this.paramList[i].Item1 + "=" + this.paramList[i].Item2; } @@ -2649,19 +3579,19 @@ namespace CampusAppWP8.Utility retValue += ','; } - if((pos < 0) || (this.paramList[pos].Item2.Equals(ICSParamValue.DATE_TIME))) + if (pos < 0 || this.paramList[pos].Item2.Equals(ICSParamValue.DATE_TIME)) { retValue += DateTimeToString(this.values[i].Item1); } - else if(this.paramList[pos].Item2.Equals(ICSParamValue.DATE)) + else if (this.paramList[pos].Item2.Equals(ICSParamValue.DATE)) { retValue += DateTimeToString(this.values[i].Item1, true); } - else if(this.paramList[pos].Item2.Equals(ICSParamValue.PERIOD)) + else if (this.paramList[pos].Item2.Equals(ICSParamValue.PERIOD)) { retValue += DateTimeToString(this.values[i].Item1) + "/"; - if(this.values[i].Item3.Equals(TimeSpan.Zero)) + if (this.values[i].Item3.Equals(TimeSpan.Zero)) { retValue += DateTimeToString(this.values[i].Item2); } @@ -2679,70 +3609,33 @@ namespace CampusAppWP8.Utility return retValue; } - public List> Value - { - get - { - return this.values; - } - set - { - this.values = value; - } - } - - public string ValueType - { - get - { - int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); - - if (pos < 0) - { - return string.Empty; - } - else - { - return this.paramList[pos].Item2; - } - } - set - { - if (CheckParamAndParamValue(ICSParam.VALUE_TYPE, value, PParams.ToArray())) - { - int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); - - if (pos < 0) - { - this.paramList.Add(new Tuple(ICSParam.VALUE_TYPE, value)); - } - else - { - this.paramList[pos] = new Tuple(ICSParam.VALUE_TYPE, value); - } - } - else - { - throw new NotSupportedException("param value (" + value + ") is not supported"); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return DTRecurrence.Name; } } + /// Recurrence rule property class. + /// Fiedler, 05.09.2013. + /// public class RecurrenceRule : Interface { - // 3.8.5.3. + /// The name. public static readonly string Name = ICSTag.RRULE; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + + /// The values. public static readonly List> PValues - = new List>(new Tuple[] { - new Tuple(ICSValue.FREQ, new string[] { + = new List>(new Tuple[] + { + new Tuple(ICSValue.FREQ, new string[] + { ICSValueValue.SECONDLY, ICSValueValue.MINUTELY, ICSValueValue.HOURLY, @@ -2751,7 +3644,8 @@ namespace CampusAppWP8.Utility ICSValueValue.MONTHLY, ICSValueValue.YEARLY }), - new Tuple(ICSValue.UNTIL, new string[] { + new Tuple(ICSValue.UNTIL, new string[] + { ICSValueValue.DATE, ICSValueValue.DATE_TIME }), @@ -2766,7 +3660,8 @@ namespace CampusAppWP8.Utility new Tuple(ICSValue.BY_WEEK_NO, null), new Tuple(ICSValue.BY_MONTH, null), new Tuple(ICSValue.BY_SET_POS, null), - new Tuple(ICSValue.WKST, new string[] { + new Tuple(ICSValue.WKST, new string[] + { ICSValueValue.DAY_SU, ICSValueValue.DAY_MO, ICSValueValue.DAY_TU, @@ -2777,13 +3672,37 @@ namespace CampusAppWP8.Utility }) }); + /// The values. private List>> values = null; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public RecurrenceRule() { this.values = new List>>(); } + /// Gets or sets the value. + /// The value. + public List>> Value + { + get + { + return this.values; + } + + set + { + this.values = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the format of the ? is incorrect. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null && paramStrList.Count() > 0) @@ -2797,7 +3716,7 @@ namespace CampusAppWP8.Utility { string[] subVal = valSplit[i].Split('='); - if(subVal.Count() != 2) + if (subVal.Count() != 2) { throw new FormatException("unsupported format (" + valSplit[i] + ")"); } @@ -2815,6 +3734,9 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -2832,7 +3754,7 @@ namespace CampusAppWP8.Utility for (int k = 0; k < this.values[i].Item2.Count(); k++) { - if(k > 0) + if (k > 0) { retValue += ","; } @@ -2844,43 +3766,72 @@ namespace CampusAppWP8.Utility return retValue; } - public List>> Value - { - get - { - return this.values; - } - set - { - this.values = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return RecurrenceRule.Name; } } + /// Action property class. + /// Fiedler, 05.09.2013. + /// public class Action : Interface { - // 3.8.6.1. + /// The name. public static readonly string Name = ICSTag.ACTION; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + + /// The values. public static readonly List PValues - = new List(new string[] { + = new List(new string[] + { ICSValue.AUDIO, ICSValue.DISP, ICSValue.EMAIL }); + /// The value. private string value = string.Empty; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Action() { } + /// Gets or sets the value. + /// The value. + public string Value + { + get + { + return this.value; + } + + set + { + if (PValues.IndexOf(value) >= 0) + { + this.value = value; + } + else + { + throw new NotSupportedException("unsupported value"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null && paramStrList.Count() > 0) @@ -2900,6 +3851,9 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -2909,69 +3863,45 @@ namespace CampusAppWP8.Utility return retValue; } - public string Value - { - get - { - return this.value; - } - set - { - if (PValues.IndexOf(value) >= 0) - { - this.value = value; - } - else - { - throw new NotSupportedException("unsupported value"); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Action.Name; } } + /// Repeat count property class. + /// Fiedler, 05.09.2013. + /// public class RepeatCount : Interface { - // 3.8.6.2. + /// The name. public static readonly string Name = ICSTag.REPEAT; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// The value. private int value; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public RepeatCount() { } - public override void Set(string valueStr, string[] paramStrList = null) - { - if (paramStrList != null && paramStrList.Count() > 0) - { - throw new NotSupportedException("there is no param supported"); - } - - this.value = int.Parse(valueStr); - } - - public override string GetString() - { - string retValue = string.Empty; - - retValue += Name + ":" + this.value.ToString(); - - return retValue; - } - + /// Gets or sets the value. + /// The value. public int Value { get { return this.value; } + set { if (value < 0) @@ -2983,54 +3913,160 @@ namespace CampusAppWP8.Utility } } + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. + public override void Set(string valueStr, string[] paramStrList = null) + { + if (paramStrList != null && paramStrList.Count() > 0) + { + throw new NotSupportedException("there is no param supported"); + } + + this.value = int.Parse(valueStr); + } + + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. + public override string GetString() + { + string retValue = string.Empty; + + retValue += Name + ":" + this.value.ToString(); + + return retValue; + } + + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return RepeatCount.Name; } } + /// Trigger property class. + /// Fiedler, 05.09.2013. + /// public class Trigger : Interface { - // 3.8.6.3. + /// The name. public static readonly string Name = ICSTag.TRIGGER; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { - new Tuple(ICSParam.VALUE_TYPE, new string[] { + = new List>(new Tuple[] + { + new Tuple(ICSParam.VALUE_TYPE, new string[] + { ICSParamValue.DURATION, ICSParamValue.DATE_TIME }), - new Tuple(ICSParam.ALARM_TRIGGER_RELATIONSHIP, new string[] { + new Tuple(ICSParam.ALARM_TRIGGER_RELATIONSHIP, new string[] + { ICSParamValue.START, ICSParamValue.END }) }); + /// List of parameters. private List> paramList = null; + + /// Date/Time of the value. private DateTime valueDT = DateTime.MinValue; + + /// The value. private TimeSpan valueTS = TimeSpan.Zero; + + /// true to value negative. private bool valueTSNegative = false; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public Trigger() { this.paramList = new List>(); } + /// Gets or sets the Date/Time of the value. + /// The value. + public DateTime ValueDT + { + get + { + return this.valueDT; + } + + set + { + this.valueDT = value; + } + } + + /// Gets or sets the value. + /// The value. + public TimeSpan ValueTS + { + get + { + return this.valueTS; + } + + set + { + this.valueTS = value; + } + } + + /// Gets or sets options for controlling the operation. + /// The parameters. + public List> Params + { + get + { + return this.paramList; + } + + set + { + for (int i = 0; i < value.Count(); i++) + { + if (!CheckParamAndParamValue(value[i].Item1, value[i].Item2, PParams.ToArray())) + { + throw new NotSupportedException("unsupported param (" + value[i].Item1 + ") with value (" + value[i].Item2 + ")"); + } + } + + this.paramList = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the format of the ? is incorrect. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null && paramStrList.Count() > 0) { for (int i = 0; i < paramStrList.Count(); i++) { - string[] pSplit = paramStrList[i].Split('='); + string[] p = paramStrList[i].Split('='); - if(pSplit.Count() != 2) + if (p.Count() != 2) { throw new FormatException("unsupported param format (" + paramStrList[i] + ")"); } - if (CheckParamAndParamValue(pSplit[0], pSplit[1], PParams.ToArray())) + if (CheckParamAndParamValue(p[0], p[1], PParams.ToArray())) { - this.paramList.Add(new Tuple(pSplit[0], pSplit[1])); + this.paramList.Add(new Tuple(p[0], p[1])); } else { @@ -3041,7 +4077,7 @@ namespace CampusAppWP8.Utility int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); - if((pos < 0) || (this.paramList[pos].Item2.Equals(ICSParamValue.DURATION))) + if (pos < 0 || this.paramList[pos].Item2.Equals(ICSParamValue.DURATION)) { if (valueStr[0].Equals('-') || valueStr[0].Equals('+')) { @@ -3061,6 +4097,10 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -3076,7 +4116,7 @@ namespace CampusAppWP8.Utility int pos = CheckParam(ICSParam.VALUE_TYPE, this.paramList.ToArray()); - if ((pos < 0) || (this.paramList[pos].Item2.Equals(ICSParamValue.DURATION))) + if (pos < 0 || this.paramList[pos].Item2.Equals(ICSParamValue.DURATION)) { retValue += TimeSpanToString(this.valueTS, this.valueTSNegative); } @@ -3092,69 +4132,56 @@ namespace CampusAppWP8.Utility return retValue; } - public DateTime ValueDT - { - get - { - return this.valueDT; - } - set - { - this.valueDT = value; - } - } - - public TimeSpan ValeTS - { - get - { - return this.valueTS; - } - set - { - this.valueTS = value; - } - } - - public List> Params - { - get - { - return this.paramList; - } - set - { - for (int i = 0; i < value.Count(); i++) - { - if (!CheckParamAndParamValue(value[i].Item1, value[i].Item2, PParams.ToArray())) - { - throw new NotSupportedException("unsupported param (" + value[i].Item1 + ") with value (" + value[i].Item2 + ")"); - } - } - - this.paramList = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return Trigger.Name; } } + /// DTCreated property class. + /// Fiedler, 05.09.2013. + /// public class DTCreated : Interface { - // 3.8.7.1. + /// The name. public static readonly string Name = ICSTag.DT_CREATED; + + /// Options for controlling the operation. public static readonly List> PParams = new List>(); + /// Date/Time of the value. private DateTime value = DateTime.MinValue; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public DTCreated() { } + /// Gets or sets the Date/Time of the value. + /// The value. + public DateTime Value + { + get + { + return this.value; + } + + set + { + this.value = value; + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null && paramStrList.Count() > 0) @@ -3165,6 +4192,9 @@ namespace CampusAppWP8.Utility this.value = UTCStringToDateTime(valueStr); } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -3174,102 +4204,184 @@ namespace CampusAppWP8.Utility return retValue; } - public DateTime Value - { - get - { - return this.value; - } - set - { - this.value = value; - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return DTCreated.Name; } } + /// DTStamp property class. + /// Fiedler, 05.09.2013. + /// public class DTStamp : DTCreated // because has same structure { - // 3.8.7.2. - public static readonly string Name = ICSTag.DT_STAMP; + /// The name. + public static new readonly string Name = ICSTag.DT_STAMP; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public DTStamp() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return DTStamp.Name; } } + /// Last modified property class. + /// Fiedler, 05.09.2013. + /// public class LastModified : DTCreated // because has same structure { - // 3.8.7.3. - public static readonly string Name = ICSTag.DT_MODIFIED; + /// The name. + public static new readonly string Name = ICSTag.DT_MODIFIED; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public LastModified() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return LastModified.Name; } } + /// Sequence number property class. + /// Fiedler, 05.09.2013. + /// public class SequenceNumber : RepeatCount { - // 3.8.7.4. - public static readonly string Name = ICSTag.SEQUENCE; + /// The name. + public static new readonly string Name = ICSTag.SEQUENCE; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public SequenceNumber() : base() { } + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return SequenceNumber.Name; } } - public class IANAPropertie + /// IANA property class. + /// Fiedler, 05.09.2013. + public class IANAProperty { // 3.8.8.1. // TODO } - public class NonStandardPropertie + /// Non standard property class. + /// Fiedler, 05.09.2013. + public class NonStandardProperty { // 3.8.8.2. // TODO } + /// Request status property class. + /// Fiedler, 05.09.2013. + /// public class RequestStatus : Interface { - // 3.8.8.3. + /// The name. public static readonly string Name = ICSTag.RSTATUS; + + /// Options for controlling the operation. public static readonly List> PParams - = new List>(new Tuple[] { + = new List>(new Tuple[] + { new Tuple(ICSParam.LANGUAGE, null) }); + /// List of parameters. private List> paramList = null; + + /// The value code. private float valueCode = 0.0f; + + /// List of values. private List valueList = null; + /// Initializes a new instance of the class. + /// Fiedler, 05.09.2013. public RequestStatus() { this.paramList = new List>(); this.valueList = new List(); } + /// Gets or sets the value. + /// The value. + public List Value + { + get + { + return this.valueList; + } + + set + { + if (value.Count() >= 1) + { + this.valueList = value; + } + else + { + throw new NotSupportedException("not enougth params"); + } + } + } + + /// Gets or sets the code. + /// The code. + public float Code + { + get + { + return this.valueCode; + } + + set + { + if (value < 5.0) + { + this.valueCode = value; + } + else + { + throw new NotSupportedException("code value has to be lower then 5.0"); + } + } + } + + /// Sets the property/class values. Used for import from a ICS file. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// Thrown when the format of the ? is incorrect. + /// The value string. + /// (Optional) List of parameter strings. public override void Set(string valueStr, string[] paramStrList = null) { if (paramStrList != null && paramStrList.Count() > 0) @@ -3311,6 +4423,9 @@ namespace CampusAppWP8.Utility } } + /// Gets the string. + /// Fiedler, 05.09.2013. + /// The string. public override string GetString() { string retValue = string.Empty; @@ -3332,53 +4447,20 @@ namespace CampusAppWP8.Utility return retValue; } - public List Value - { - get - { - return this.valueList; - } - set - { - if (value.Count() >= 1) - { - this.valueList = value; - } - else - { - throw new NotSupportedException("not enougth params"); - } - } - } - - public float Code - { - get - { - return this.valueCode; - } - set - { - if (value < 5.0) - { - this.valueCode = value; - } - else - { - throw new NotSupportedException("code value has to be lower then 5.0"); - } - } - } - + /// Gets the name. + /// Fiedler, 05.09.2013. + /// The name. public override string GetName() { return RequestStatus.Name; } } - - - // functions + /// Check parameter. + /// Fiedler, 05.09.2013. + /// The parameter string. + /// The list. + /// -1 if parameter is not in the list, otherwise index. private static int CheckParam(string paramStr, Tuple[] list) { int retValue = -1; @@ -3393,14 +4475,19 @@ namespace CampusAppWP8.Utility return retValue; } - + + /// Check parameter. + /// Fiedler, 05.09.2013. + /// The parameter string. + /// The list. + /// -1 if parameter is not in the list, otherwise index. private static int CheckParam(string paramStr, Tuple[] list) { int retValue = -1; - for(int i = 0; i < list.Count(); i++) + for (int i = 0; i < list.Count(); i++) { - if(paramStr.Equals(list[i].Item1)) + if (paramStr.Equals(list[i].Item1)) { retValue = i; } @@ -3409,6 +4496,12 @@ namespace CampusAppWP8.Utility return retValue; } + /// Check parameter and parameter value. + /// Fiedler, 05.09.2013. + /// The parameter string. + /// The parameter value string. + /// The list. + /// true if it succeeds, false if it fails. private static bool CheckParamAndParamValue(string paramStr, string paramValueStr, Tuple[] list) { bool retValue = false; @@ -3436,6 +4529,12 @@ namespace CampusAppWP8.Utility return retValue; } + /// Check parameter and parameter value. + /// Fiedler, 05.09.2013. + /// The parameter string. + /// The parameter value string. + /// The list. + /// true if it succeeds, false if it fails. private static bool CheckParamAndParamValue(string paramStr, string[] paramValueStr, Tuple[] list) { bool retValue = true; @@ -3451,11 +4550,13 @@ namespace CampusAppWP8.Utility return retValue; } - + /// UTC string to date time. + /// Fiedler, 05.09.2013. + /// The time string. + /// Date/Time object represented by the time string. + /// private static DateTime UTCStringToDateTime(string timeStr) { - // see http://tools.ietf.org/html/rfc5545 3.3.5. - timeStr = timeStr.Insert(4, "-"); timeStr = timeStr.Insert(7, "-"); @@ -3468,14 +4569,27 @@ namespace CampusAppWP8.Utility return DateTime.Parse(timeStr); } + /// Query if time string is date. + /// Fiedler, 05.09.2013. + /// The time string. + /// true if date, false if not. private static bool IsDate(string timeStr) { if (timeStr[timeStr.Length - 1].Equals('Z')) + { return false; + } else + { return true; + } } + /// String to time span. + /// Fiedler, 05.09.2013. + /// Thrown when the requested operation is not supported. + /// The time string. + /// TimeSpan object represented by the time string. private static TimeSpan StringToTimeSpan(string timeStr) { TimeSpan retValue = TimeSpan.Zero; @@ -3517,11 +4631,15 @@ namespace CampusAppWP8.Utility return retValue; } + /// Duration split. + /// Fiedler, 05.09.2013. + /// The duration string. + /// Tuple of the string. private static Tuple[] DurSplit(string durStr) { - List> retValue = new List>(); + List> retValue = new List>(); - string str = durStr.Replace("P", "").Replace("T", "").Replace("+", "").Replace("-", ""); + string str = durStr.Replace("P", string.Empty).Replace("T", string.Empty).Replace("+", string.Empty).Replace("-", string.Empty); int val = 0; char typeChar; @@ -3531,7 +4649,7 @@ namespace CampusAppWP8.Utility if (durStr[i] >= '0' && durStr[i] <= '9') { val *= 10; - val += (durStr[0] - '0'); + val += durStr[0] - '0'; } else { @@ -3544,6 +4662,11 @@ namespace CampusAppWP8.Utility return retValue.ToArray(); } + /// Time span to string. + /// Fiedler, 05.09.2013. + /// The time span. + /// (Optional) the is negative. + /// String representing the TimeSpan object. private static string TimeSpanToString(TimeSpan timeSpan, bool isNegative = false) { string retValue = string.Empty; @@ -3568,6 +4691,11 @@ namespace CampusAppWP8.Utility return retValue; } + /// Date time to string. + /// Fiedler, 05.09.2013. + /// Date/Time of the value. + /// (Optional) date of the is. + /// String representing the Date/Time object. private static string DateTimeToString(DateTime val, bool isDate = false) { string retValue = string.Empty;