fixed static name

This commit is contained in:
Christian Fiedler
2013-09-05 14:20:53 +02:00
parent e02c2d3607
commit 589bee809f
3 changed files with 365 additions and 69 deletions

View File

@@ -33,9 +33,19 @@ namespace CampusAppWP8.Utility
}
public abstract string GetString();
public abstract string GetName();
}
//
/*
public class DEFAULT : Interface
{
public static readonly string Name;
}
*/
//
public class Begin : Interface
{
// ???
@@ -105,6 +115,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return Begin.Name;
}
}
public class End : Begin // same
@@ -130,6 +145,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return End.Name;
}
}
public class Version : Interface
@@ -236,6 +256,11 @@ namespace CampusAppWP8.Utility
this.Value = value;
}
}
public override string GetName()
{
return Version.Name;
}
}
public class ProductID : Interface
@@ -281,6 +306,11 @@ namespace CampusAppWP8.Utility
this.value = value;
}
}
public override string GetName()
{
return ProductID.Name;
}
}
public class CalendarScale : Interface
@@ -344,7 +374,63 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return CalendarScale.Name;
}
}
public class Method : Interface
{
// 3.7.2.
public static readonly string Name = ICSTag.METHOD;
public static readonly List<Tuple<string, string[]>> PParams
= new List<Tuple<string, string[]>>();
private string value = string.Empty;
public Method()
{
}
public override void Set(string valueStr, string[] paramStrList)
{
if (paramStrList != null && paramStrList.Count() > 0)
{
throw new NotSupportedException("there is no param supported");
}
this.value = valueStr;
}
public override string GetString()
{
string retValue = string.Empty;
retValue += Name + ":" + this.value;
return retValue;
}
public string Value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
public override string GetName()
{
return Method.Name;
}
}
//
public class Attachment : Interface
@@ -499,6 +585,11 @@ namespace CampusAppWP8.Utility
this.formatType = value;
}
}
public override string GetName()
{
return Attachment.Name;
}
}
public class Categories : Interface
@@ -604,6 +695,11 @@ namespace CampusAppWP8.Utility
this.languageType = value;
}
}
public override string GetName()
{
return Categories.Name;
}
}
public class AccessClass : Interface
@@ -668,6 +764,10 @@ namespace CampusAppWP8.Utility
}
}
public override string GetName()
{
return AccessClass.Name;
}
}
public class Comment : Interface
@@ -773,6 +873,11 @@ namespace CampusAppWP8.Utility
this.languageType = value;
}
}
public override string GetName()
{
return Comment.Name;
}
}
public class Description : Comment // because the structure is the same
@@ -783,6 +888,11 @@ namespace CampusAppWP8.Utility
public Description() : base()
{
}
public override string GetName()
{
return Description.Name;
}
}
public class Geo : Interface
@@ -854,6 +964,11 @@ namespace CampusAppWP8.Utility
this.value = value;
}
}
public override string GetName()
{
return Geo.Name;
}
}
public class Location : Comment // because the structure is the same
@@ -864,6 +979,11 @@ namespace CampusAppWP8.Utility
public Location() : base()
{
}
public override string GetName()
{
return Location.Name;
}
}
public class PercentComplete : Interface
@@ -935,6 +1055,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return PercentComplete.Name;
}
}
public class Priority : Interface
@@ -1011,6 +1136,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return Priority.Name;
}
}
public class Resources : Comment // because the structure is the same
@@ -1021,6 +1151,11 @@ namespace CampusAppWP8.Utility
public Resources() : base()
{
}
public override string GetName()
{
return Resources.Name;
}
}
public class Status : Interface
@@ -1119,6 +1254,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return Status.Name;
}
}
public class Summary : Comment // because the structure is the same
@@ -1130,6 +1270,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return Summary.Name;
}
}
public class DTCompleted : Interface
@@ -1187,6 +1332,11 @@ namespace CampusAppWP8.Utility
this.value = value;
}
}
public override string GetName()
{
return DTCompleted.Name;
}
}
public class DTEnd : Interface
@@ -1361,6 +1511,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return DTEnd.Name;
}
}
public class DTDue : DTEnd // because the structure is the same
@@ -1372,6 +1527,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return DTDue.Name;
}
}
public class DTStart : DTEnd // because the structure is the same
@@ -1383,6 +1543,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return DTStart.Name;
}
}
public class Duration : Interface
@@ -1452,6 +1617,11 @@ namespace CampusAppWP8.Utility
this.isNegative = value;
}
}
public override string GetName()
{
return Duration.Name;
}
}
public class FreeBusyTime : Interface
@@ -1619,6 +1789,11 @@ namespace CampusAppWP8.Utility
{
this.ValueList.Add(new Tuple<DateTime, TimeSpan, DateTime, bool>(dtStart, TimeSpan.Zero, dtEnd, false));
}
public override string GetName()
{
return FreeBusyTime.Name;
}
}
public class TimeTransparency : Interface
@@ -1688,6 +1863,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return TimeTransparency.Name;
}
}
public class TimeZoneIdentifier : Interface
@@ -1738,6 +1918,11 @@ namespace CampusAppWP8.Utility
this.value = value;
}
}
public override string GetName()
{
return TimeZoneIdentifier.Name;
}
}
public class TimeZoneName : Interface
@@ -1827,6 +2012,11 @@ namespace CampusAppWP8.Utility
this.language = value;
}
}
public override string GetName()
{
return TimeZoneName.Name;
}
}
public class TimeZoneOffsetFrom : Interface
@@ -1903,6 +2093,11 @@ namespace CampusAppWP8.Utility
this.isNegative = value;
}
}
public override string GetName()
{
return TimeZoneOffsetFrom.Name;
}
}
public class TimeZoneOffsetTo : TimeZoneOffsetFrom // because the structure is the same
@@ -1914,6 +2109,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return TimeZoneOffsetTo.Name;
}
}
public class TimeZoneUrl : Interface // INTERFACE: string value only
@@ -1964,6 +2164,11 @@ namespace CampusAppWP8.Utility
this.value = value;
}
}
public override string GetName()
{
return TimeZoneUrl.Name;
}
}
public class Attendee : Interface
@@ -2112,6 +2317,11 @@ namespace CampusAppWP8.Utility
this.paramList.RemoveAt(pos);
}
}
public override string GetName()
{
return Attendee.Name;
}
}
public class Contact : Comment // because the structure is the same
@@ -2123,6 +2333,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return Contact.Name;
}
}
public class Organizer : Attendee // nearly the same structure
@@ -2140,6 +2355,11 @@ namespace CampusAppWP8.Utility
public Organizer() : base()
{
}
public override string GetName()
{
return Organizer.Name;
}
}
public class RecurrenceID : DTEnd // because the structure is the same
@@ -2151,6 +2371,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return RecurrenceID.Name;
}
}
public class RelatedTo : Interface
@@ -2250,6 +2475,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return RelatedTo.Name;
}
}
public class Url : TimeZoneUrl // because structure is the same
@@ -2261,6 +2491,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return Url.Name;
}
}
public class UniqueID : TimeZoneUrl // because structure is the same
@@ -2272,6 +2507,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return UniqueID.Name;
}
}
public class DTException : DTEnd // because structure is the same
@@ -2283,6 +2523,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return DTException.Name;
}
}
public class DTRecurrence : Interface
@@ -2482,6 +2727,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return DTRecurrence.Name;
}
}
public class RecurrenceRule : Interface
@@ -2605,6 +2855,11 @@ namespace CampusAppWP8.Utility
this.values = value;
}
}
public override string GetName()
{
return RecurrenceRule.Name;
}
}
public class Action : Interface
@@ -2673,7 +2928,10 @@ namespace CampusAppWP8.Utility
}
}
public override string GetName()
{
return Action.Name;
}
}
public class RepeatCount : Interface
@@ -2724,6 +2982,11 @@ namespace CampusAppWP8.Utility
this.value = value;
}
}
public override string GetName()
{
return RepeatCount.Name;
}
}
public class Trigger : Interface
@@ -2872,6 +3135,11 @@ namespace CampusAppWP8.Utility
this.paramList = value;
}
}
public override string GetName()
{
return Trigger.Name;
}
}
public class DTCreated : Interface
@@ -2917,6 +3185,11 @@ namespace CampusAppWP8.Utility
this.value = value;
}
}
public override string GetName()
{
return DTCreated.Name;
}
}
public class DTStamp : DTCreated // because has same structure
@@ -2928,6 +3201,11 @@ namespace CampusAppWP8.Utility
: base()
{
}
public override string GetName()
{
return DTStamp.Name;
}
}
public class LastModified : DTCreated // because has same structure
@@ -2940,6 +3218,10 @@ namespace CampusAppWP8.Utility
{
}
public override string GetName()
{
return LastModified.Name;
}
}
public class SequenceNumber : RepeatCount
@@ -2950,6 +3232,11 @@ namespace CampusAppWP8.Utility
public SequenceNumber() : base()
{
}
public override string GetName()
{
return SequenceNumber.Name;
}
}
public class IANAPropertie
@@ -3082,6 +3369,11 @@ namespace CampusAppWP8.Utility
}
}
}
public override string GetName()
{
return RequestStatus.Name;
}
}

View File

@@ -50,6 +50,9 @@ namespace CampusAppWP8.Utility
public List<string> valueList;
}
List<object> vcalProps;
List<List<object>> subProps;
/// <summary>Default constructor. </summary>
/// <remarks>Fiedler, 27.08.2013. </remarks>
public ICSObject()
@@ -71,45 +74,41 @@ namespace CampusAppWP8.Utility
foreach (string e in elems)
{
ContentLine obj = this.ToContentLine(e);
ContentLine prop = this.ToContentLine(e);
ICSDict.ICSElemDesc tempElem = null;
if ((tempElem = parentList.Last().GetValue(obj.name)) != null)
if ((tempElem = parentList.Last().GetValue(prop.name)) != null)
{
object t1 = tempElem.CreateObj();
Type t2 = t1.GetType();
Type t3 = tempElem.GetObjType();
string s1 = (t1 as ICSClasses.Interface).GetName();
ICSDict.ICSValueDesc va = null;
if (this.Is(obj, ICSTag.BEGIN))
//tempElem.
if (this.Is(prop, ICSTag.BEGIN))
{
parentList.Add(this.GetSubValue(obj.valueList[0], tempElem));
parentList.Add(this.GetSubValue(prop.valueList[0], tempElem));
}
else if (this.Is(obj, ICSTag.END))
else if (this.Is(prop, ICSTag.END))
{
if (this.GetSubValue(obj.valueList[0], tempElem) != null)
if (this.GetSubValue(prop.valueList[0], tempElem) != null)
{
parentList.RemoveAt(parentList.Count - 1);
}
}
else if (this.Is(obj, ICSTag.ATTACHMENT))
{
}
else if (this.Is(obj, ICSTag.GEO)) // 3.8.1.6
{
//TODO
string[] posAsStr = obj.valueList[0].Split(';');
Tuple<float, float> posAsFloat = new Tuple<float, float>(float.Parse(posAsStr[0]), float.Parse(posAsStr[1]));
}
}
else
{
if (obj.name.IndexOf("X-") == 0)
if (prop.name.IndexOf("X-") == 0)
{
// TODO
}
else
{
throw new NotSupportedException("Tag (" + obj.name + ") was not found in (" + parentList.Last().Name + ")");
throw new NotSupportedException("Tag (" + prop.name + ") was not found in (" + parentList.Last().Name + ")");
}
}

View File

@@ -224,6 +224,11 @@ namespace CampusAppWP8.Utility
return retValue;
}
public Type GetObjType()
{
return this.objType;
}
}
public static ICSValueDesc Root = new ICSValueDesc("ROOT", new ICSElemDesc[] {
@@ -234,7 +239,7 @@ namespace CampusAppWP8.Utility
new ICSElemDesc(ICSTag.CAL_SCALE, typeof(ICSClasses.CalendarScale), new ICSValueDesc[] {
new ICSValueDesc(ICSValue.GREGORIAN, null)
}),
new ICSElemDesc(ICSTag.METHOD, typeof(), null),
new ICSElemDesc(ICSTag.METHOD, typeof(ICSClasses.Method), null),
new ICSElemDesc(ICSTag.END, typeof(ICSClasses.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VCALENDAR, null)
}),
@@ -358,71 +363,71 @@ namespace CampusAppWP8.Utility
new ICSElemDesc(ICSTag.ORGANIZER, typeof(ICSClasses.Organizer), null),
new ICSElemDesc(ICSTag.RECURRENCE_ID, typeof(ICSClasses.RecurrenceID), null),
new ICSElemDesc(ICSTag.SEQ, typeof(ICSClasses.SequenceNumber), null),
new ICSElemDesc(ICSTag.STATUS, typeof(), null),
new ICSElemDesc(ICSTag.SUMMARY, typeof(), null),
new ICSElemDesc(ICSTag.URL, typeof(), null),
new ICSElemDesc(ICSTag.RRULE, typeof(), null),
new ICSElemDesc(ICSTag.ATTACHMENT, typeof(), null),
new ICSElemDesc(ICSTag.ATTENDEE, typeof(), null),
new ICSElemDesc(ICSTag.CATEGORIES, typeof(), null),
new ICSElemDesc(ICSTag.COMMENT, typeof(), null),
new ICSElemDesc(ICSTag.CONTACT, typeof(), null),
new ICSElemDesc(ICSTag.DESCRIPTION, typeof(), null),
new ICSElemDesc(ICSTag.EXDATE, typeof(), null),
new ICSElemDesc(ICSTag.RELATED, typeof(), null),
new ICSElemDesc(ICSTag.RDATE, typeof(), null),
new ICSElemDesc(ICSTag.RSTATUS, typeof(), null),
new ICSElemDesc(ICSTag.END, typeof(), new ICSValueDesc[] {
new ICSElemDesc(ICSTag.STATUS, typeof(ICSClasses.Status), null),
new ICSElemDesc(ICSTag.SUMMARY, typeof(ICSClasses.Summary), null),
new ICSElemDesc(ICSTag.URL, typeof(ICSClasses.Url), null),
new ICSElemDesc(ICSTag.RRULE, typeof(ICSClasses.RecurrenceRule), null),
new ICSElemDesc(ICSTag.ATTACHMENT, typeof(ICSClasses.Attachment), null),
new ICSElemDesc(ICSTag.ATTENDEE, typeof(ICSClasses.Attendee), null),
new ICSElemDesc(ICSTag.CATEGORIES, typeof(ICSClasses.Categories), null),
new ICSElemDesc(ICSTag.COMMENT, typeof(ICSClasses.Comment), null),
new ICSElemDesc(ICSTag.CONTACT, typeof(ICSClasses.Contact), null),
new ICSElemDesc(ICSTag.DESCRIPTION, typeof(ICSClasses.Description), null),
new ICSElemDesc(ICSTag.EXDATE, typeof(ICSClasses.DTException), null),
new ICSElemDesc(ICSTag.RELATED, typeof(ICSClasses.RelatedTo), null),
new ICSElemDesc(ICSTag.RDATE, typeof(ICSClasses.DTRecurrence), null),
new ICSElemDesc(ICSTag.RSTATUS, typeof(ICSClasses.RequestStatus), null),
new ICSElemDesc(ICSTag.END, typeof(ICSClasses.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VJOURNAL, null)
})
}),
new ICSValueDesc(ICSTag.VFREEBUSY, new ICSElemDesc[] {
new ICSElemDesc(ICSTag.DT_STAMP, typeof(), null),
new ICSElemDesc(ICSTag.UNIQUE_ID, typeof(), null),
new ICSElemDesc(ICSTag.CONTACT, typeof(), null),
new ICSElemDesc(ICSTag.DT_START, typeof(), null),
new ICSElemDesc(ICSTag.DT_END, typeof(), null),
new ICSElemDesc(ICSTag.ORGANIZER, typeof(), null),
new ICSElemDesc(ICSTag.URL, typeof(), null),
new ICSElemDesc(ICSTag.ATTENDEE, typeof(), null),
new ICSElemDesc(ICSTag.COMMENT, typeof(), null),
new ICSElemDesc(ICSTag.FREEBUSY, typeof(), null),
new ICSElemDesc(ICSTag.RSTATUS, typeof(), null),
new ICSElemDesc(ICSTag.END, typeof(), new ICSValueDesc[] {
new ICSElemDesc(ICSTag.DT_STAMP, typeof(ICSClasses.DTStamp), null),
new ICSElemDesc(ICSTag.UNIQUE_ID, typeof(ICSClasses.UniqueID), null),
new ICSElemDesc(ICSTag.CONTACT, typeof(ICSClasses.Contact), null),
new ICSElemDesc(ICSTag.DT_START, typeof(ICSClasses.DTStart), null),
new ICSElemDesc(ICSTag.DT_END, typeof(ICSClasses.DTEnd), null),
new ICSElemDesc(ICSTag.ORGANIZER, typeof(ICSClasses.Organizer), null),
new ICSElemDesc(ICSTag.URL, typeof(ICSClasses.Url), null),
new ICSElemDesc(ICSTag.ATTENDEE, typeof(ICSClasses.Attendee), null),
new ICSElemDesc(ICSTag.COMMENT, typeof(ICSClasses.Comment), null),
new ICSElemDesc(ICSTag.FREEBUSY, typeof(ICSClasses.FreeBusyTime), null),
new ICSElemDesc(ICSTag.RSTATUS, typeof(ICSClasses.RequestStatus), null),
new ICSElemDesc(ICSTag.END, typeof(ICSClasses.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VFREEBUSY, null)
})
}),
new ICSValueDesc(ICSTag.VTIMEZONE, new ICSElemDesc[] {
new ICSElemDesc(ICSTag.TIME_ZONE_ID, typeof(), null),
new ICSElemDesc(ICSTag.DT_MODIFIED, typeof(), null),
new ICSElemDesc(ICSTag.TIME_ZONE_URL, typeof(), null),
new ICSElemDesc(ICSTag.BEGIN, typeof(), new ICSValueDesc[] {
new ICSElemDesc(ICSTag.TIME_ZONE_ID, typeof(ICSClasses.TimeZoneIdentifier), null),
new ICSElemDesc(ICSTag.DT_MODIFIED, typeof(ICSClasses.LastModified), null),
new ICSElemDesc(ICSTag.TIME_ZONE_URL, typeof(ICSClasses.TimeZoneUrl), null),
new ICSElemDesc(ICSTag.BEGIN, typeof(ICSClasses.Begin), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.STANDARD, new ICSElemDesc[] {
new ICSElemDesc(ICSTag.DT_START, typeof(), null),
new ICSElemDesc(ICSTag.TIME_ZONE_OFFSET_TO, typeof(), null),
new ICSElemDesc(ICSTag.TIME_ZONE_OFFSET_FROM, typeof(), null),
new ICSElemDesc(ICSTag.RRULE, typeof(), null),
new ICSElemDesc(ICSTag.COMMENT, typeof(), null),
new ICSElemDesc(ICSTag.RDATE, typeof(), null),
new ICSElemDesc(ICSTag.TIME_ZONE_NAME, typeof(), null),
new ICSElemDesc(ICSTag.END, typeof(), new ICSValueDesc[] {
new ICSElemDesc(ICSTag.DT_START, typeof(ICSClasses.DTStart), null),
new ICSElemDesc(ICSTag.TIME_ZONE_OFFSET_TO, typeof(ICSClasses.TimeZoneOffsetTo), null),
new ICSElemDesc(ICSTag.TIME_ZONE_OFFSET_FROM, typeof(ICSClasses.TimeZoneOffsetFrom), null),
new ICSElemDesc(ICSTag.RRULE, typeof(ICSClasses.RecurrenceRule), null),
new ICSElemDesc(ICSTag.COMMENT, typeof(ICSClasses.Comment), null),
new ICSElemDesc(ICSTag.RDATE, typeof(ICSClasses.DTRecurrence), null),
new ICSElemDesc(ICSTag.TIME_ZONE_NAME, typeof(ICSClasses.TimeZoneName), null),
new ICSElemDesc(ICSTag.END, typeof(ICSClasses.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.STANDARD, null)
})
}),
new ICSValueDesc(ICSTag.DAYLIGHT, new ICSElemDesc[] {
new ICSElemDesc(ICSTag.DT_START, typeof(), null),
new ICSElemDesc(ICSTag.TIME_ZONE_OFFSET_TO, typeof(), null),
new ICSElemDesc(ICSTag.TIME_ZONE_OFFSET_FROM, typeof(), null),
new ICSElemDesc(ICSTag.RRULE, typeof(), null),
new ICSElemDesc(ICSTag.COMMENT, typeof(), null),
new ICSElemDesc(ICSTag.RDATE, typeof(), null),
new ICSElemDesc(ICSTag.TIME_ZONE_NAME, typeof(), null),
new ICSElemDesc(ICSTag.END, typeof(), new ICSValueDesc[] {
new ICSElemDesc(ICSTag.DT_START, typeof(ICSClasses.DTStart), null),
new ICSElemDesc(ICSTag.TIME_ZONE_OFFSET_TO, typeof(ICSClasses.TimeZoneOffsetTo), null),
new ICSElemDesc(ICSTag.TIME_ZONE_OFFSET_FROM, typeof(ICSClasses.TimeZoneOffsetFrom), null),
new ICSElemDesc(ICSTag.RRULE, typeof(ICSClasses.RecurrenceRule), null),
new ICSElemDesc(ICSTag.COMMENT, typeof(ICSClasses.Comment), null),
new ICSElemDesc(ICSTag.RDATE, typeof(ICSClasses.DTRecurrence), null),
new ICSElemDesc(ICSTag.TIME_ZONE_NAME, typeof(ICSClasses.TimeZoneName), null),
new ICSElemDesc(ICSTag.END, typeof(ICSClasses.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.STANDARD, null)
})
})
}),
new ICSElemDesc(ICSTag.END, typeof(), new ICSValueDesc[] {
new ICSElemDesc(ICSTag.END, typeof(ICSClasses.End), new ICSValueDesc[] {
new ICSValueDesc(ICSTag.VTIMEZONE, null)
})
})