예제 #1
0
        public override void ParseFromStream(StreamReader sr)
        {
            String tkn = "";

            while (true)
            {
                tkn = Parser.GetToken(sr);
                if (tkn == "END")
                {
                    tkn = Parser.GetToken(sr);
                    if (tkn != ":")
                    {
                        throw new InvalidDocumentStructureExeption();
                    }
                    tkn = Parser.GetToken(sr);
                    if (tkn != "VTODO")
                    {
                        throw new InvalidDocumentStructureExeption();
                    }
                    return;
                }

                vObjectProperty pr = null;
                switch (tkn)
                {
                case "BEGIN":
                    throw new InvalidDocumentStructureExeption();
                    break;

                case "DCREATED":
                    pr = new DateTimeCreated(this);
                    break;

                case "COMPLETED":
                    pr = new DateTimeCompleted(this);
                    break;

                case "DESCRIPTION":
                    pr = new Description(this);
                    break;

                case "LAST-MODIFIED":
                    pr = new LastModified(this);
                    break;

                case "CATEGORIES":
                    pr = new Categories(this);
                    break;

                case "DUE":
                    pr = new DueDateTime(this);
                    break;

                case "DTEND":
                    pr = new EndDateTime(this);
                    break;

                case "PRIORITY":
                    pr = new Priority(this);
                    break;

                case "DTSTART":
                    pr = new StartDateTime(this);
                    break;

                case "SUMMARY":
                    pr = new Summary(this);
                    break;

                case "STATUS":
                    pr = new Status(this);
                    break;

                default:
                    if (tkn.Substring(0, 2) == "X-")                          // Extention property
                    {
                        pr = new ExtensionProperty(tkn, this);
                    }
                    else                              // Comment this if optional properties support is not required
                    {
                        pr = new OptionalProperty(tkn, this);
                    }
                    break;
                }
                if (pr != null)
                {
                    pr.ParseFromStream(sr);
                    SetProperty(pr);
                }
            }
        }
예제 #2
0
		public override void ParseFromStream(StreamReader sr)
		{
			String tkn="";
			while(true)
			{
				tkn=Parser.GetToken(sr);
				if(tkn=="END")
				{
					tkn=Parser.GetToken(sr);
					if(tkn!=":")throw new InvalidDocumentStructureExeption();
					tkn=Parser.GetToken(sr);
					if(tkn!="VTODO")throw new InvalidDocumentStructureExeption();
					return ;
				}

				vObjectProperty pr=null;
				switch(tkn)
				{
					case "BEGIN":
						throw new InvalidDocumentStructureExeption();
						break;
					case "DCREATED":
						pr=new DateTimeCreated(this);
						break;
					case "COMPLETED":
						pr=new DateTimeCompleted(this);
						break;
					case "DESCRIPTION":
						pr=new Description(this);
						break;
					case "LAST-MODIFIED":
						pr=new LastModified(this);
						break;
					case "CATEGORIES":
						pr=new Categories(this);
						break;
					case "DUE":
						pr=new DueDateTime(this);
						break;
					case "DTEND":
						pr=new EndDateTime(this);
						break;
					case "PRIORITY":
						pr=new Priority(this);
						break;
					case "DTSTART":
						pr=new StartDateTime(this);
						break;
					case "SUMMARY":
						pr=new Summary(this);
						break;
					case "STATUS":
						pr=new Status(this);
						break;
					default:
						if(tkn.Substring(0,2)=="X-")  // Extention property
						{
							pr=new ExtensionProperty(tkn,this);
						}
						else  // Comment this if optional properties support is not required
						{
							pr=new OptionalProperty(tkn,this);
						}
						break;
				}
				if(pr!=null)
				{
					pr.ParseFromStream(sr);
					SetProperty(pr);
				}
			}
		}