Exemple #1
0
 public override iCalObject Copy(iCalObject parent)
 {
     Parameter p = (Parameter)base.Copy(parent);
     foreach (string s in Values)
         p.Values.Add(s);
     return p;
 }
Exemple #2
0
 public override iCalObject Copy(iCalObject parent)
 {
     Property p = (Property)base.Copy(parent);
     p.Name = Name;
     p.Value = Value;
     return p;
 }
Exemple #3
0
 public override void RemoveChild(iCalObject child)
 {
     if (child is Alarm)
     {
         Alarms.Remove((Alarm)child);
     }
     base.RemoveChild(child);
 }
Exemple #4
0
 public override void AddChild(iCalObject child)
 {
     if (child is Alarm)
     {
         Alarms.Add((Alarm)child);
     }
     base.AddChild(child);
 }
Exemple #5
0
        public override iCalObject Copy(iCalObject parent)
        {
            Parameter p = (Parameter)base.Copy(parent);

            foreach (string s in Values)
            {
                p.Values.Add(s);
            }
            return(p);
        }
Exemple #6
0
 public iCalObject(iCalObject parent)
 {
     this.Parent = parent;
     if (parent != null)
     {
         if (!(this is Property) &&
             !(this is Parameter))
             parent.AddChild(this);
     }
 }
Exemple #7
0
 public iCalObject(iCalObject parent)
 {
     Parent = parent;
     if (parent != null)
     {
         if (!(this is Property) &&
             !(this is Parameter))
         {
             parent.AddChild(this);
         }
     }
 }
 static public ComponentBase Create(iCalObject parent, string name)
 {            
     switch (name)
     {
         case "VEVENT":
             // For event objects, use our custom event class
             return new CustomEvent(parent);                    
         default:
             // Otherwise, use the default classes
             return ComponentBase.Create(parent, name);
     }
 }
Exemple #9
0
        static public ComponentBase Create(iCalObject parent, string name)
        {
            switch (name.ToUpper())
            {
            case "VALARM": return(new Alarm(parent)); break;

            case "VEVENT": return(new Event(parent)); break;

            case "VFREEBUSY": return(new FreeBusy(parent)); break;

            case "VJOURNAL": return(new Journal(parent)); break;

            case "VTIMEZONE": return(new DDay.iCal.Components.TimeZone(parent)); break;

            case "VTODO": return(new Todo(parent)); break;

            default: return(new ComponentBase(parent, name)); break;
            }
        }
Exemple #10
0
 public Parameter(iCalObject parent) : base(parent)
 {
 }
Exemple #11
0
 public Property(iCalObject parent, string name, string value) : this(parent, name)
 {
     Value = value;
 }
 public iCalObjectSerializer(DDay.iCal.Objects.iCalObject iCalObject)
 {
     this.m_object = iCalObject;
 }
Exemple #13
0
 public Parameter(iCalObject parent) : base(parent) { }
Exemple #14
0
 public Property(iCalObject parent, string name, string value) : this(parent, name)
 {
     Value = value;            
 }
Exemple #15
0
 public RecurringComponent(iCalObject parent) : base(parent)
 {
     Initialize();
 }
Exemple #16
0
 public ContentLine(iCalObject parent) : base(parent) { }
Exemple #17
0
 public override iCalObject Copy(iCalObject parent)
 {
     iCalDataType icdt = (iCalDataType)Activator.CreateInstance(GetType());
     icdt.CopyFrom(this);
     icdt.Parent = parent;
     return icdt;            
 }
Exemple #18
0
 /// <summary>
 /// Adds an <see cref="iCalObject"/>-based object as a child
 /// of the current object.
 /// </summary>
 /// <param name="child">The <see cref="iCalObject"/>-based object to add.</param>
 virtual public void AddChild(iCalObject child)
 {
     Children.Add(child);
 }
Exemple #19
0
 /// <summary>
 /// Removed an <see cref="iCalObject"/>-based object from the <see cref="Children"/>
 /// collection.
 /// </summary>
 /// <param name="child"></param>
 virtual public void RemoveChild(iCalObject child)
 {
     if (Children.Contains(child))
         Children.Remove(child);
 }
Exemple #20
0
 public UniqueComponent(iCalObject parent) : base(parent)
 {
 }
Exemple #21
0
 public RecurringComponent(iCalObject parent, string name) : base(parent, name)
 {
     DateTimes = new ArrayList();
     Alarms    = new List <Alarm>();
 }
Exemple #22
0
 public RecurringComponent(iCalObject parent, string name) : base(parent, name)
 {
     Periods = new List <Period>();
     Alarms  = new List <Alarm>();
 }
 public CustomComponentBase(iCalObject parent) : base(parent) { }
Exemple #24
0
 public Parameter(iCalObject parent, string name) : base(parent, name)
 {
     AddToParent();
 }
Exemple #25
0
 public iCalObject(iCalObject parent, string name)
     : this(parent)
 {
     Name = name;
 }
 public RecurringComponent(iCalObject parent) : base(parent)
 {
     DateTimes = new ArrayList();
 }
Exemple #27
0
 public ComponentBase(iCalObject parent, string name) : base(parent, name)
 {
 }
Exemple #28
0
 public RecurringComponent(iCalObject parent, string name) : base(parent, name)
 {
     Initialize();
 }
 public iCalObjectSerializer(DDay.iCal.Objects.iCalObject iCalObject)
 {
     this.m_object = iCalObject;
 }
Exemple #30
0
        virtual public iCalObject Copy(iCalObject parent)
        {
            iCalObject obj = null;
            Type type = GetType();
            ConstructorInfo[] constructors = type.GetConstructors();
            foreach (ConstructorInfo ci in constructors)
            {
                // Try to find a constructor with the following signature:
                // .ctor(iCalObject parent, string name)
                ParameterInfo[] parms = ci.GetParameters();
                if (parms.Length == 2 &&
                    parms[0].ParameterType == typeof(iCalObject) &&
                    parms[1].ParameterType == typeof(string))
                {                    
                    obj = (iCalObject)Activator.CreateInstance(type, parent, Name);
                }
            }
            if (obj == null)
            {
                foreach (ConstructorInfo ci in constructors)
                {
                    // Try to find a constructor with the following signature:
                    // .ctor(iCalObject parent)
                    ParameterInfo[] parms = ci.GetParameters();
                    if (parms.Length == 1 &&
                        parms[0].ParameterType == typeof(iCalObject))
                    {
                        obj = (iCalObject)Activator.CreateInstance(type, parent);
                    }
                }
            }
            // No complex constructor was found, use the default constructor!
            if (obj == null)
                obj = (iCalObject)Activator.CreateInstance(type);

            // Add properties
            foreach (DictionaryEntry de in Properties)
                ((Property)(de.Value)).Copy(obj);

            // Add parameters
            foreach (DictionaryEntry de in Parameters)
                ((Parameter)(de.Value)).Copy(obj);

            // Add each child
            foreach (iCalObject child in Children)
                child.Copy(obj);

            //
            // Get a list of serialized items,
            // iterate through each, make a copy
            // of each item, and assign it to our
            // copied object.
            //
            List<object> items = SerializedItems;
            foreach (object item in items)
            {
                FieldInfo field = null;
                PropertyInfo prop = null;

                if (item is FieldInfo)
                    field = (FieldInfo)item;
                else
                    prop = (PropertyInfo)item;

                // Get the item's value
                object itemValue = (field == null) ? prop.GetValue(this, null) : field.GetValue(this);

                // Make a copy of the item, if it's copyable.
                if (itemValue is iCalObject)
                    itemValue = ((iCalObject)itemValue).Copy(obj);
                else { } // FIXME: make an exact copy, if possible.

                // Set the item's value in our copied object
                if (field == null)
                    prop.SetValue(obj, itemValue, null);
                else field.SetValue(obj, itemValue);
            }

            return obj;
        }
Exemple #31
0
 public Property(iCalObject parent, string name, string value) : base(parent, name)
 {
     Value = value;
     AddToParent();
 }
Exemple #32
0
 public UniqueComponent(iCalObject parent, string name) : base(parent, name)
 {
 }
Exemple #33
0
 public Property(iCalObject parent) : base(parent) { }
Exemple #34
0
 public iCalObject(iCalObject parent, string name)
     : this(parent)
 {
     Name = name;
 }
Exemple #35
0
 public Property(iCalObject parent, string name, string value) : base(parent, name)
 {
     Value = value;
     AddToParent();
 }
Exemple #36
0
        virtual public iCalObject Copy(iCalObject parent)
        {
            iCalObject obj  = null;
            Type       type = GetType();

            ConstructorInfo[] constructors = type.GetConstructors();
            foreach (ConstructorInfo ci in constructors)
            {
                // Try to find a constructor with the following signature:
                // .ctor(iCalObject parent, string name)
                ParameterInfo[] parms = ci.GetParameters();
                if (parms.Length == 2 &&
                    parms[0].ParameterType == typeof(iCalObject) &&
                    parms[1].ParameterType == typeof(string))
                {
                    obj = (iCalObject)Activator.CreateInstance(type, parent, Name);
                }
            }
            if (obj == null)
            {
                foreach (ConstructorInfo ci in constructors)
                {
                    // Try to find a constructor with the following signature:
                    // .ctor(iCalObject parent)
                    ParameterInfo[] parms = ci.GetParameters();
                    if (parms.Length == 1 &&
                        parms[0].ParameterType == typeof(iCalObject))
                    {
                        obj = (iCalObject)Activator.CreateInstance(type, parent);
                    }
                }
            }
            // No complex constructor was found, use the default constructor!
            if (obj == null)
            {
                obj = (iCalObject)Activator.CreateInstance(type);
            }

            // Add properties
            foreach (DictionaryEntry de in Properties)
            {
                ((Property)(de.Value)).Copy(obj);
            }

            // Add parameters
            foreach (DictionaryEntry de in Parameters)
            {
                ((Parameter)(de.Value)).Copy(obj);
            }

            // Add each child
            foreach (iCalObject child in Children)
            {
                child.Copy(obj);
            }

            //
            // Get a list of serialized items,
            // iterate through each, make a copy
            // of each item, and assign it to our
            // copied object.
            //
            List <object> items = SerializedItems;

            foreach (object item in items)
            {
                FieldInfo    field = null;
                PropertyInfo prop  = null;

                if (item is FieldInfo)
                {
                    field = (FieldInfo)item;
                }
                else
                {
                    prop = (PropertyInfo)item;
                }

                // Get the item's value
                object itemValue = (field == null) ? prop.GetValue(this, null) : field.GetValue(this);

                // Make a copy of the item, if it's copyable.
                if (itemValue is iCalObject)
                {
                    itemValue = ((iCalObject)itemValue).Copy(obj);
                }
                else
                {
                }        // FIXME: make an exact copy, if possible.

                // Set the item's value in our copied object
                if (field == null)
                {
                    prop.SetValue(obj, itemValue, null);
                }
                else
                {
                    field.SetValue(obj, itemValue);
                }
            }

            return(obj);
        }
Exemple #37
0
 public ContentLine(iCalObject parent) : base(parent)
 {
 }
Exemple #38
0
 virtual public void AddChild(iCalObject child)
 {
     Children.Add(child);
 }
Exemple #39
0
 public Property(iCalObject parent) : base(parent)
 {
 }
Exemple #40
0
 public ComponentBase(iCalObject parent) : base(parent)
 {
 }
Exemple #41
0
 public Property(iCalObject parent, string name) : base(parent, name)
 {
     AddToParent();
 }
Exemple #42
0
 public Parameter(iCalObject parent, string name) : base(parent, name)
 {
     AddToParent();
 }
Exemple #43
0
 public Property(iCalObject parent, string name) : base(parent, name)
 {
     AddToParent();
 }