示例#1
0
文件: UserVm.cs 项目: rmarinho/AgFx
            protected override object DeserializeCore(LoadContext context, System.Xml.Linq.XElement xml, Type objectType, System.IO.Stream stream)
            {
                //<person nsid="12037949754@N01" ispro="0" iconserver="122" iconfarm="1">
                //    <username>bees</username>
                //    <realname>Cal Henderson</realname>
                //        <mbox_sha1sum>eea6cd28e3d0003ab51b0058a684d94980b727ac</mbox_sha1sum>
                //    <location>Vancouver, Canada</location>
                //    <photosurl>http://www.flickr.com/photos/bees/</photosurl>
                //    <profileurl>http://www.flickr.com/people/bees/</profileurl>
                //    <photos>
                //        <firstdate>1071510391</firstdate>
                //        <firstdatetaken>1900-09-02 09:11:24</firstdatetaken>
                //        <count>449</count>
                //    </photos>
                //</person>

                XElement personElement = xml;

                var user = new UserVm(personElement.Attribute("nsid").Value);

                user.ProfileIconUrl = UserVm.MakeIconUri(user.UserId, personElement.Attribute("iconfarm").Value, personElement.Attribute("iconserver").Value);
                bool success;

                user.UserName = personElement.Element("username").Value;
                user.FullName = TryGetValue(personElement, "realname", "", out success);
                return user;
            }
示例#2
0
文件: UserVm.cs 项目: rmarinho/AgFx
            public object DeserializeOptimizedData(LoadContext context, Type objectType, System.IO.Stream stream)
            {
                StreamReader sr = new StreamReader(stream);

                string id = sr.ReadLine();

                UserVm vm = new UserVm(id);

                vm.FullName = sr.ReadLine();
                vm.UserName = sr.ReadLine();
                vm.ProfileIconUrl = new Uri(sr.ReadLine());
                return vm;
            }