public bool AddStory(JsonClasses.Story story) { JsonClasses.Story existing = this.connection.Table <JsonClasses.Story>().Where <JsonClasses.Story>(u => u.id.Equals(story.id)).FirstOrDefault <JsonClasses.Story>(); if (existing != null) { return(false); } else { this.connection.Insert(story); return(true); } }
private string SaveMedia(byte[] image, JsonClasses.Story story) { if (story.zipped) { image = this.Unzip(image); } if (image != null) { string filename = Path.Combine(this.path, string.Format("{0}.{1}", story.id, story.media_type == 0 ? "jpg" : "mov")); File.WriteAllBytes(filename, image); return(filename); } return(string.Empty); }
protected void NotifyTray(JsonClasses.Story story, string file) { if (this.InvokeRequired) { NotifyStoryDelegate d = new NotifyStoryDelegate(NotifyTray); this.Invoke(d, story, file); } else { this.unseenCounter++; this.fileToOpen = file; this._notifyTray(string.Format("New story update from {0}!", story.username), this.getNotifyPreview(file)); this.UpdateNotifyText(); } }
public JsonClasses.Story[] GetStories(string data) { List <JsonClasses.Story> stories = new List <JsonClasses.Story>(); JObject foo = JObject.Parse(data); JToken response = foo["stories_response"]; JArray allfriendsstories = response["friend_stories"].ToObject <JArray>(); foreach (JToken friend in allfriendsstories) { JArray substory = friend["stories"].ToObject <JArray>(); foreach (JToken substoryy in substory) { JsonClasses.Story story = substoryy["story"].ToObject <JsonClasses.Story>(); stories.Add(story); } } return(stories.ToArray()); }