Example #1
0
File: Link.cs Project: gwely/Reddit
        internal static Link Create(JObject Json)
        {
            var Temp = new Link();

            Temp.ID = Json["id"].StringValue;
            Temp.Kind = Kind.Link;
            Temp.Domain = Json["domain"].StringValue;
            //Temp.BannedBy = null;
            //Temp.MediaEmbed = null;
            Temp.SubredditName = Json["subreddit"].StringValue;
            Temp.SelfContentHtml = Json["selftext_html"].StringValue;
            Temp._SelfContent = Json["selftext"].StringValue;
            //Temp.Likes = Json["likes"].IntValue;
            Temp.LinkFlairText = Json["link_flair_text"].StringValue;
            Temp.Clicked = Json["clicked"].BooleanValue;
            Temp.Title = Json["title"].StringValue;
            Temp.NumComments = Json["num_comments"].IntValue;
            Temp.Score = Json["score"].IntValue;
            //Temp.ApprovedBy = null;
            Temp.Over18 = Json["over_18"].BooleanValue;
            Temp.Hidden = Json["hidden"].BooleanValue;
            Temp.Thumbnail = Json["thumbnail"].StringValue;
            Temp.Edited = Json["edited"].BooleanValue;
            Temp.LinkFlairCSSClass = Json["link_flair_css_class"].StringValue;
            Temp.AuthorFlairCSSClass = Json["author_flair_css_class"].StringValue;
            Temp.Downvotes = Json["downs"].IntValue;
            Temp.Saved = Json["saved"].BooleanValue;
            Temp.IsSelf = Json["is_self"].BooleanValue;
            Temp.Permalink = Json["permalink"].StringValue;
            Temp.Created = Json["created"].DoubleValue.ToDateTime();
            Temp.CreatedUTC = Json["created_utc"].DoubleValue.ToDateTime();
            Temp.Url = Json["url"].StringValue;
            Temp.AuthorFlairText = Json["author_flair_text"].StringValue;
            Temp.AuthorName = Json["author"].StringValue;
            //Temp.Media = null;
            //Temp.NumReports = null;
            Temp.Upvotes = Json["ups"].IntValue;

            return Temp;
        }
Example #2
0
        public static bool EqualNumber(JObject o1, JObject o2)
        {
            if (o1.MinFloat != o2.MinFloat ||
                o1.MinInteger != o2.MinInteger ||
                o1.IsNegative != o2.IsNegative ||
                o1.IsFractional != o2.IsFractional) return false;

            if (o1.IsFractional)
            {
                return o1.DoubleValue == o2.DoubleValue;
            }
            if (o1.IsNegative)
            {
                return o1.LongValue == o2.LongValue;
            }

            return o1.ULongValue == o2.ULongValue;
        }
Example #3
0
 public ScannerData(JObject result, int index)
 {
     Result = result;
     Index = index;
 }
 public void WriteJObject(JObject obj) {
     switch (obj.Kind) {
     case JObjectKind.Array:
         BeginArray();
         foreach (var elem in obj.ArrayValue) {
             WriteJObject(elem);
         }
         EndArray();
         break;
     case JObjectKind.Boolean:
         WriteBool(obj.BooleanValue);
         break;
     case JObjectKind.Null:
         WriteNull();
         break;
     case JObjectKind.Number:
         if (obj.IsFractional) {
             WriteNumber(obj.DoubleValue);
         } else if (obj.IsNegative) {
             WriteNumber(obj.LongValue);
         } else {
             WriteNumber(obj.ULongValue);
         }
         break;
     case JObjectKind.Object:
         BeginObject();
         foreach (var pair in obj.ObjectValue) {
             WriteKey(pair.Key);
             WriteJObject(pair.Value);
         }
         EndObject();
         break;
     case JObjectKind.String:
         WriteString(obj.StringValue);
         break;
     }
 }
Example #5
0
File: Me.cs Project: gwely/Reddit
        internal static Me Create(JObject Json)
        {
            var Temp = new Me();

            Temp.ID = Json["id"].StringValue;
            Temp.ModHash = Json["modhash"].StringValue;
            Temp.Name = Json["name"].StringValue;

            Temp.HasMail = Json["has_mail"].BooleanValue;
            Temp.HasModMail = Json["has_mod_mail"].BooleanValue;

            Temp.Created = Json["created"].DoubleValue.ToDateTime();
            Temp.CreatedUTC = Json["created_utc"].DoubleValue.ToDateTime();

            Temp.LinkKarma = Json["link_karma"].LongValue;
            Temp.CommentKarma = Json["comment_karma"].LongValue;

            Temp.IsGold = Json["is_gold"].BooleanValue;
            Temp.IsMod = Json["is_mod"].BooleanValue;

            return Temp;
        }