Exemple #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 != "VCALENDAR")
                    {
                        throw new InvalidDocumentStructureExeption();
                    }
                    return;
                }

                vObjectProperty pr = null;
                switch (tkn)
                {
                case "BEGIN":
                {
                    tkn = Parser.GetToken(sr);
                    if (tkn != ":")
                    {
                        throw new InvalidDocumentStructureExeption();
                    }
                    tkn = Parser.GetToken(sr);
                    vObject ent = null;
                    if (tkn == "VEVENT")
                    {
                        ent = new vEvent();
                    }
                    if (tkn == "VTODO")
                    {
                        ent = new vTodo();
                    }
                    if ((tkn != "VEVENT") && (tkn != "VTODO"))
                    {
                        throw new InvalidDocumentStructureExeption();
                    }
                    ent.ParseFromStream(sr);
                    AddEntity(ent);
                    break;
                }

                case "GEO":
                    pr = new GeographicPosition(this);
                    break;

                case "PRODID":
                    pr = new ProductID(this);
                    break;

                case "TZ":
                    pr = new TZone(this);
                    break;

                case "VERSION":
                    pr = new SpecificationVersion(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);
                }
            }
        }
Exemple #2
0
		public override void ParseFromStream(StreamReader sr)
		{
			String tkn="";
			while(true)
			{
				tkn=Parser.GetTokenPnt(sr);
				if(tkn=="END")
				{
					tkn=Parser.GetToken(sr);
					if(tkn!=":")throw new InvalidDocumentStructureExeption();
					tkn=Parser.GetToken(sr);
					if(tkn!="VCARD")throw new InvalidDocumentStructureExeption();
					return ;
				}

				vObjectProperty pr=null;
				switch(tkn)
				{
					case "BEGIN":
					{
						tkn=Parser.GetToken(sr);
						if(tkn!=":")throw new InvalidDocumentStructureExeption();
						tkn=Parser.GetToken(sr);
						vCard ent=null;
						if(tkn=="VCARD")
							ent=new vCard();
						if(tkn!="VCARD")throw new InvalidDocumentStructureExeption();
						ent.ParseFromStream(sr);
						AddNested(ent);
						break;
					}
					case "N":
						pr=new NameProperty(this);
						break;
					case "GEO":
						pr=new GeographicPosition(this);
						break;
					case "TZ":
						pr=new TZone(this);
						break;
					case "VERSION":
						pr=new SpecificationVersion(this);
						break;
					default:
						if(tkn[tkn.Length-1]=='.')
						{ 
							String cn=tkn.Substring(0,tkn.Length-1);
							tkn=Parser.GetToken(sr);
							pr=new OptionalProperty(tkn,this);
							pr.ParseFromStream(sr);
							SetPrToComposite(cn,pr);
							pr=null;
							break;
						}
						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);
				}
			}
		}
Exemple #3
0
        public override void ParseFromStream(StreamReader sr)
        {
            String tkn = "";

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

                vObjectProperty pr = null;
                switch (tkn)
                {
                case "BEGIN":
                {
                    tkn = Parser.GetToken(sr);
                    if (tkn != ":")
                    {
                        throw new InvalidDocumentStructureExeption();
                    }
                    tkn = Parser.GetToken(sr);
                    vCard ent = null;
                    if (tkn == "VCARD")
                    {
                        ent = new vCard();
                    }
                    if (tkn != "VCARD")
                    {
                        throw new InvalidDocumentStructureExeption();
                    }
                    ent.ParseFromStream(sr);
                    AddNested(ent);
                    break;
                }

                case "N":
                    pr = new NameProperty(this);
                    break;

                case "GEO":
                    pr = new GeographicPosition(this);
                    break;

                case "TZ":
                    pr = new TZone(this);
                    break;

                case "VERSION":
                    pr = new SpecificationVersion(this);
                    break;

                default:
                    if (tkn[tkn.Length - 1] == '.')
                    {
                        String cn = tkn.Substring(0, tkn.Length - 1);
                        tkn = Parser.GetToken(sr);
                        pr  = new OptionalProperty(tkn, this);
                        pr.ParseFromStream(sr);
                        SetPrToComposite(cn, pr);
                        pr = null;
                        break;
                    }
                    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);
                }
            }
        }
Exemple #4
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!="VCALENDAR")throw new InvalidDocumentStructureExeption();
					return ;
				}

				vObjectProperty pr=null;
				switch(tkn)
				{
					case "BEGIN":
					{
						tkn=Parser.GetToken(sr);
						if(tkn!=":")throw new InvalidDocumentStructureExeption();
						tkn=Parser.GetToken(sr);
						vObject ent=null;
						if(tkn=="VEVENT")
							ent=new vEvent();
						if(tkn=="VTODO")
							ent=new vTodo();
						if((tkn!="VEVENT")&&(tkn!="VTODO"))throw new InvalidDocumentStructureExeption();
						ent.ParseFromStream(sr);
						AddEntity(ent);
						break;
					}
					case "GEO":
						pr=new GeographicPosition(this);
						break;
					case "PRODID":
						pr=new ProductID(this);
						break;
					case "TZ":
						pr=new TZone(this);
						break;
					case "VERSION":
						pr=new SpecificationVersion(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);
				}
			}
		}