示例#1
0
        private ODataProperty ReadPropertyImplementation()
        {
            List <VCardItem> items = new List <VCardItem>();

            this.reader.Read();
            this.reader.Read();
            while (this.reader.State == VCardReaderState.Item)
            {
                VCardItem item = new VCardItem()
                {
                    Name   = this.reader.Name,
                    Value  = this.reader.Value,
                    Groups = this.reader.Groups,
                };

                if (this.reader.Params != null)
                {
                    item.Params = new Dictionary <string, string>();
                    foreach (string param in this.reader.Params.Split(';'))
                    {
                        int idx = param.IndexOf('=');
                        if (idx >= 0)
                        {
                            // need to care about when = appear in last.
                            item.Params.Add(param.Substring(0, idx), param.Substring(idx + 1));
                        }
                        else
                        {
                            if (item.Params.ContainsKey("TYPE"))
                            {
                                item.Params["TYPE"] = item.Params["TYPE"] + ";" + param;
                            }
                            else
                            {
                                item.Params.Add("TYPE", param);
                            }
                        }
                    }
                }

                items.Add(item);
                this.reader.Read();
            }

            Debug.Assert(this.reader.State == VCardReaderState.End);

            return(new ODataProperty()
            {
                Name = "fake", Value = GetEntryFromItems(items)
            });
        }
        private ODataProperty ReadPropertyImplementation()
        {
            List<VCardItem> items = new List<VCardItem>();
            this.reader.Read();
            this.reader.Read();
            while (this.reader.State == VCardReaderState.Item)
            {
                VCardItem item = new VCardItem()
                {
                    Name = this.reader.Name,
                    Value = this.reader.Value,
                    Groups = this.reader.Groups,
                };

                if (this.reader.Params != null)
                {
                    item.Params = new Dictionary<string, string>();
                    foreach (string param in this.reader.Params.Split(';'))
                    {
                        int idx = param.IndexOf('=');
                        if (idx >= 0)
                        {
                            // need to care about when = appear in last.
                            item.Params.Add(param.Substring(0, idx), param.Substring(idx + 1));
                        }
                        else
                        {
                            if (item.Params.ContainsKey("TYPE"))
                            {
                                item.Params["TYPE"] = item.Params["TYPE"] + ";" + param;
                            }
                            else
                            {
                                item.Params.Add("TYPE", param);
                            }
                        }
                    }
                }

                items.Add(item);
                this.reader.Read();
            }

            Debug.Assert(this.reader.State == VCardReaderState.End);

            return new ODataProperty() { Name = "fake", Value = GetEntryFromItems(items) };
        }