• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Components.iCalObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DDay.iCal.Components.iCalObject的典型用法代码示例。如果您正苦于以下问题:C# iCalObject类的具体用法?C# iCalObject怎么用?C# iCalObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



iCalObject类属于DDay.iCal.Components命名空间,在下文中一共展示了iCalObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Copy

 public override iCalObject Copy(iCalObject parent)
 {
     Parameter p = (Parameter)base.Copy(parent);
     foreach (string s in Values)
         p.Values.Add(s);
     return p;
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:7,代码来源:Parameter.cs


示例2: AddChild

        public override void AddChild(iCalObject child)
        {
            if (child is TimeZoneInfo)
                TimeZoneInfos.Add((TimeZoneInfo)child);

            base.AddChild(child);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:7,代码来源:iCalTimeZone.cs


示例3: Copy

 public override iCalObject Copy(iCalObject parent)
 {
     Property p = (Property)base.Copy(parent);
     p.Name = Name;
     p.Value = Value;
     return p;
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:7,代码来源:Property.cs


示例4: RemoveChild

        public override void RemoveChild(iCalObject child)
        {
            if (child is TimeZoneInfo &&
                TimeZoneInfos.Contains((TimeZoneInfo)child))
                TimeZoneInfos.Remove((TimeZoneInfo)child);

            base.RemoveChild(child);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:8,代码来源:iCalTimeZone.cs


示例5: Create

 static public new ComponentBase Create(iCalObject parent, string name)
 {
     switch (name)
     {
         case "VEVENT": return new CustomEvent1(parent);
         default: return ComponentBase.Create(parent, name);
     }
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:8,代码来源:Custom1.cs


示例6: Create

 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);
     }
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:12,代码来源:CustomComponentBase.cs


示例7: Create

 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;
         case "DAYLIGHT":
         case "STANDARD":
             return new DDay.iCal.Components.TimeZone.TimeZoneInfo(name.ToUpper(), parent); break;
         default: return new ComponentBase(parent, name); break;
     }
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:16,代码来源:ComponentBase.cs


示例8: Create

 static public ComponentBase Create(iCalObject parent, string name)
 {
     switch(name.ToUpper())
     {
         case ALARM: return new Alarm(parent); break;
         case EVENT: return new Event(parent); break;
         case FREEBUSY: return new FreeBusy(parent); break;
         case JOURNAL: return new Journal(parent); break;
         case TIMEZONE: return new DDay.iCal.Components.TimeZone(parent); break;
         case TODO: return new Todo(parent); break;
         case DAYLIGHT:
         case STANDARD:
             return new DDay.iCal.Components.TimeZone.TimeZoneInfo(name.ToUpper(), parent); break;
         default: return new ComponentBase(parent, name); break;
     }
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:16,代码来源:ComponentBase.cs


示例9: component

	public ComponentBase  component(
		iCalObject o
	) //throws RecognitionException, TokenStreamException
{
		ComponentBase c = null;;
		
		
		{ // ( ... )+
			int _cnt11=0;
			for (;;)
			{
				if ((LA(1)==BEGIN) && (LA(2)==COLON) && (LA(3)==X_NAME))
				{
					c=x_comp(o);
				}
				else if ((LA(1)==BEGIN) && (LA(2)==COLON) && (LA(3)==IANA_TOKEN)) {
					c=iana_comp(o);
				}
				else if ((LA(1)==CRLF) && (tokenSet_1_.member(LA(2))) && (tokenSet_2_.member(LA(3)))) {
					match(CRLF);
				}
				else
				{
					if (_cnt11 >= 1) { goto _loop11_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
				}
				
				_cnt11++;
			}
_loop11_breakloop:			;
		}    // ( ... )+
		return c;
	}
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:32,代码来源:iCalParser.cs


示例10: DeserializeToObject

        /// <summary>
        /// For iCalendar components, automatically finds and retrieves fields that
        /// match the field specified in the <see cref="ContentLine"/>, and sets
        /// their value.
        /// <example>
        /// For example, if a public DTStart field exists in the specified component,
        /// (i.e. <c>public Date_Time DTStart;</c>)
        /// and a content line of <c>DTSTART;TZID=US-Eastern:20060830T090000</c> is
        /// encountered, this method will automatically set the value of the
        /// DTStart field to Aug. 30, 2006, 9:00 AM in the US-Eastern TimeZone.
        /// </example>
        /// <note>
        ///     It should not be necessary to invoke this method manually as it
        ///     is handled automatically during the iCalendar parsing.
        /// </note>
        /// </summary>
        /// <param name="cl">The <see cref="ContentLine"/> to process.</param>
        /// <param name="obj">The <see cref="iCalObject"/> to assign information to.</param>
        static public void DeserializeToObject(ContentLine cl, iCalObject obj)
        {
            if (cl.Name != null)
            {
                string name = cl.Name;
                Type type = obj.GetType();

                // Remove X- from the property name, since
                // non-standard properties are named like
                // everything else, but also have the NonstandardAttribute
                // attached.
                if (name.StartsWith("X-"))
                    name = name.Remove(0, 2);

                // Replace invalid characters
                name = name.Replace("-", "_");

                //
                // Find the public field that matches the name of our content line (ignoring case)
                //
                FieldInfo field = type.GetField(name, BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.GetField | BindingFlags.Static);
                PropertyInfo property = null;

                if (field == null)
                    property = type.GetProperty(name, BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.Static);

                if (field != null ||
                    property != null)
                {
                    // Get the field/property's value
                    object value = field == null ? property.GetValue(obj, null) : field.GetValue(obj);
                    Type itemType = field == null ? property.PropertyType : field.FieldType;
                    object[] itemAttributes = field == null ? property.GetCustomAttributes(true) : field.GetCustomAttributes(true);

                    Type elementType = itemType.IsArray ? itemType.GetElementType() : itemType;

                    // If it's an iCalDataType, or an array of iCalDataType, then let's fill it!
                    if (itemType.IsSubclassOf(typeof(iCalDataType)) ||
                        (itemType.IsArray && itemType.GetElementType().IsSubclassOf(typeof(iCalDataType))))
                    {
                        iCalDataType icdt = null;
                        if (!itemType.IsArray)
                            icdt = (iCalDataType)value;
                        if (icdt == null)
                            icdt = (iCalDataType)Activator.CreateInstance(elementType);

                        // Assign custom attributes for the specific field
                        icdt.Attributes = itemAttributes;

                        // Set the content line for the object.                        
                        icdt.ContentLine = cl;

                        // It's an array, let's add an item to the end
                        if (itemType.IsArray)
                        {
                            ArrayList arr = new ArrayList();
                            if (value != null)
                                arr.AddRange((ICollection)value);
                            arr.Add(icdt);
                            if (field != null)
                                field.SetValue(obj, arr.ToArray(elementType));
                            else
                                property.SetValue(obj, arr.ToArray(elementType), null);
                        }
                        // Otherwise, set the value directly!
                        else
                        {
                            if (field != null)
                                field.SetValue(obj, icdt);
                            else property.SetValue(obj, icdt, null);
                        }
                    }
                    else
                    {
                        FieldInfo minValue = itemType.GetField("MinValue");
                        object minVal = (minValue != null) ? minValue.GetValue(null) : null;

                        if (itemType.IsArray)
                        {
                            ArrayList arr = new ArrayList();
                            if (value != null)
                                arr.AddRange((ICollection)value);
//.........这里部分代码省略.........
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:101,代码来源:ContentLineSerializer.cs


示例11: Copy

        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 = ci.Invoke(new object[] { parent, Name }) as iCalObject;
                }
            }
            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 = ci.Invoke(new object[] { parent }) as iCalObject;
                    }
                }
            }
            // No complex constructor was found, use the default constructor!
            if (obj == null)
                obj = (iCalObject)Activator.CreateInstance(type);

            // Add properties
            foreach (Property p in Properties)
                p.Copy(obj);

            // Add parameters
            foreach (Parameter p in Parameters)
                p.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;
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:80,代码来源:iCalObject.cs


示例12: RemoveChild

 /// <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);
 }        
开发者ID:xxjeng,项目名称:nuxleus,代码行数:10,代码来源:iCalObject.cs


示例13: Copy

        public override iCalObject Copy(iCalObject parent)
        {
            iCalDataType icdt = (iCalDataType)Activator.CreateInstance(GetType());
            icdt.CopyFrom(this);

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

            icdt.Parent = parent;
            return icdt;            
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:12,代码来源:iCalDataType.cs


示例14: param

	public void param(
		iCalObject o
	) //throws RecognitionException, TokenStreamException
{
		
		Parameter p; string n; string v;
		
		n=param_name();
		p = new Parameter(o, n);
		match(EQUAL);
		v=param_value();
		p.Values.Add(v);
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==COMMA))
				{
					match(COMMA);
					v=param_value();
					p.Values.Add(v);
				}
				else
				{
					goto _loop54_breakloop;
				}
				
			}
_loop54_breakloop:			;
		}    // ( ... )*
	}
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:30,代码来源:iCalParser.cs


示例15: contentline

	public void contentline(
		iCalObject o
	) //throws RecognitionException, TokenStreamException
{
		
		
		ContentLine c = new ContentLine(o);
		string n;
		string v;
		
		
		n=name();
		c.Name = n;
		{    // ( ... )*
			for (;;)
			{
				if ((LA(1)==SEMICOLON))
				{
					match(SEMICOLON);
					{
						switch ( LA(1) )
						{
						case IANA_TOKEN:
						{
							param(c);
							break;
						}
						case X_NAME:
						{
							xparam(c);
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
				}
				else
				{
					goto _loop50_breakloop;
				}
				
			}
_loop50_breakloop:			;
		}    // ( ... )*
		match(COLON);
		v=value();
		c.Value = v; DDay.iCal.Serialization.iCalendar.Components.ContentLineSerializer.DeserializeToObject(c, o);
		match(CRLF);
	}
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:52,代码来源:iCalParser.cs


示例16: calprop

	public void calprop(
		iCalObject o
	) //throws RecognitionException, TokenStreamException
{
		
		
		switch ( LA(1) )
		{
		case PRODID:
		{
			prodid(o);
			break;
		}
		case VERSION:
		{
			version(o);
			break;
		}
		case CALSCALE:
		{
			calscale(o);
			break;
		}
		case METHOD:
		{
			method(o);
			break;
		}
		case X_NAME:
		{
			x_prop(o);
			break;
		}
		case IANA_TOKEN:
		{
			iana_prop(o);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		 }
	}
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:44,代码来源:iCalParser.cs


示例17: iana_comp

	public ComponentBase  iana_comp(
		iCalObject o
	) //throws RecognitionException, TokenStreamException
{
		ComponentBase c = null;;
		
		IToken  n = null;
		
		match(BEGIN);
		match(COLON);
		n = LT(1);
		match(IANA_TOKEN);
		c = o.iCalendar.Create(o, n.getText().ToLower());
		match(CRLF);
		{ // ( ... )+
			int _cnt14=0;
			for (;;)
			{
				if ((tokenSet_3_.member(LA(1))))
				{
					calendarline(c);
				}
				else
				{
					if (_cnt14 >= 1) { goto _loop14_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
				}
				
				_cnt14++;
			}
_loop14_breakloop:			;
		}    // ( ... )+
		match(END);
		match(COLON);
		match(IANA_TOKEN);
		match(CRLF);
		c.OnLoaded(EventArgs.Empty);
		return c;
	}
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:38,代码来源:iCalParser.cs


示例18: CustomComponentBase

 public CustomComponentBase(iCalObject parent) : base(parent) { }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:1,代码来源:CustomComponentBase.cs


示例19: ContentLine

 public ContentLine(iCalObject parent) : base(parent) { }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:1,代码来源:ContentLine.cs


示例20: Copy

        public override iCalObject Copy(iCalObject parent)
        {
            iCalDataType icdt = (iCalDataType)Activator.CreateInstance(GetType());
            icdt.CopyFrom(this);

            // Add parameters
            foreach (Parameter p in Parameters)
                p.Copy(icdt);

            icdt.Parent = parent;
            return icdt;            
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:12,代码来源:iCalDataType.cs



注:本文中的DDay.iCal.Components.iCalObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DataTypes.Date_Time类代码示例发布时间:2022-05-24
下一篇:
C# Swf.SwfWriter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap