Ejemplo n.º 1
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);
                }
            }
        }
Ejemplo n.º 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);
				}
			}
		}
Ejemplo n.º 3
0
		public void AddNested(vCard nc)
		{
			_crds.Add(nc);
		}
Ejemplo n.º 4
0
 public void AddNested(vCard nc)
 {
     _crds.Add(nc);
 }