예제 #1
0
 public static void Search(ISocialNetworkService searcher)
 {
     var users = searcher.GetUsersAfterCertainDate(2013);
     var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
     var friendships = searcher.GetFriendships(2, 10);
     var chatUsers = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");
 }
예제 #2
0
 public static void Search(ISocialNetworkService searcher)
 {
     var users        = searcher.GetUsersAfterCertainDate(2013);
     var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
     var friendships  = searcher.GetFriendships(2, 10);
     var chatUsers    = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");
 }
예제 #3
0
        public static void Search(ISocialNetworkService searcher)
        {
            var users = searcher.GetUsersAfterCertainDate(2013);
            var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
            var friendships = searcher.GetFriendships(2, 10);
            var chatUsers = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");

            var jsons = new List<string>
            {
                users.ToString(),
                postsByUsers.ToString(),
                friendships.ToString(),
                chatUsers.ToString()
            };


            for (int i = 1; i <= jsons.Count; i++)
            {
                using (var writer = new StreamWriter(string.Format("../../JsonFiles/Result{0}.json", i)))
                {
                    writer.WriteLine(jsons[i - 1]);
                }
            }

            //SaveJsonToFile("Result1.json", users.ToString());
        }
예제 #4
0
        public static void Search(ISocialNetworkService searcher)
        {
            var users        = searcher.GetUsersAfterCertainDate(2013);
            var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
            var friendships  = searcher.GetFriendships(2, 10);
            var chatUsers    = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");

            var jsons = new List <string>
            {
                JsonConvert.SerializeObject(users, Formatting.Indented),
                JsonConvert.SerializeObject(postsByUsers, Formatting.Indented),
                JsonConvert.SerializeObject(friendships, Formatting.Indented),
                JsonConvert.SerializeObject(chatUsers, Formatting.Indented)
            };

            for (int i = 1; i <= jsons.Count; i++)
            {
                var dir = new DirectoryInfo("../../../JSONResults");
                dir.Create();

                using (var writer = new StreamWriter(string.Format("../../../JSONResults/Result{0}.json", i)))
                {
                    writer.WriteLine(jsons[i - 1]);
                }
            }
        }
예제 #5
0
        public static void Search(ISocialNetworkService searcher)
        {
            var users = searcher.GetUsersAfterCertainDate(2013);
            var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
            var friendships = searcher.GetFriendships(2, 10);
            var chatUsers = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");

            var jsons = new List<string>()
            {
                JsonConvert.SerializeObject(users, Formatting.Indented),
                JsonConvert.SerializeObject(postsByUsers, Formatting.Indented),
                JsonConvert.SerializeObject(friendships, Formatting.Indented),
                JsonConvert.SerializeObject(chatUsers, Formatting.Indented),

            };

            //foreach (var user in users)
            //{
            //    string json = JsonConvert.SerializeObject(user, Formatting.Indented);
            //    jsons.Add(json);
            //}

            //foreach (var post in postsByUsers)
            //{
            //    string json = JsonConvert.SerializeObject(post, Formatting.Indented);
            //    jsons.Add(json);
            //}

            //foreach (var friendship in friendships)
            //{
            //    string json = JsonConvert.SerializeObject(friendship, Formatting.Indented);
            //    jsons.Add(json);
            //}

            //foreach (var chatUser in chatUsers)
            //{
            //    string json = JsonConvert.SerializeObject(chatUser, Formatting.Indented);
            //    jsons.Add(json);
            //}

            for (int i = 1; i <= jsons.Count; i++)
            {
                using (var writer = new StreamWriter(string.Format("Result{0}.json", i)))
                {
                    writer.WriteLine(jsons[i - 1]);
                }
            }
        }
예제 #6
0
        public static void Search(ISocialNetworkService searcher)
        {
            var users        = searcher.GetUsersAfterCertainDate(2013);
            var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
            var friendships  = searcher.GetFriendships(2, 10);
            var chatUsers    = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");

            var jsons = new List <string>
            {
            };

            for (int i = 1; i <= jsons.Count; i++)
            {
                using (var writer = new StreamWriter(string.Format("Result{0}.json", i)))
                {
                    writer.WriteLine(jsons[i - 1]);
                }
            }
        }
예제 #7
0
        public static void Search(ISocialNetworkService searcher)
        {
            var users = searcher.GetUsersAfterCertainDate(2013);
            var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
            var friendships = searcher.GetFriendships(2, 10);
            var chatUsers = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");

            // todo : data parsed from DATABASE, Json Data not written, not enought time left!

            var jsons = new List<string>
            {
            };

            for (int i = 1; i <= jsons.Count; i++)
            {
                using (var writer = new StreamWriter(string.Format("Result{0}.json", i)))
                {
                    writer.WriteLine(jsons[i - 1]);
                }
            }
        }
예제 #8
0
        public static void Search(ISocialNetworkService searcher)
        {
            var users        = searcher.GetUsersAfterCertainDate(2013);
            var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
            var friendships  = searcher.GetFriendships(2, 10);
            var chatUsers    = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");

            var json = new List <string>
            {
                JsonConvert.SerializeObject(users, Formatting.Indented),
                JsonConvert.SerializeObject(postsByUsers, Formatting.Indented),
                JsonConvert.SerializeObject(friendships, Formatting.Indented),
                JsonConvert.SerializeObject(chatUsers, Formatting.Indented)
            };

            for (var i = 0; i < json.Count; i++)
            {
                using (var writer = new StreamWriter($"Jsons{i + 1}.json"))
                {
                    writer.WriteLine(json[i]);
                }
            }
        }
예제 #9
0
        public static void Search(ISocialNetworkService searcher)
        {
            var users = searcher.GetUsersAfterCertainDate(2013);
            var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
            var friendships = searcher.GetFriendships(2, 10);
            var chatUsers = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");

            var json = new List<string>
            {
                JsonConvert.SerializeObject(users,Formatting.Indented),
                JsonConvert.SerializeObject(postsByUsers,Formatting.Indented),
                JsonConvert.SerializeObject(friendships,Formatting.Indented),
                JsonConvert.SerializeObject(chatUsers,Formatting.Indented)
            };

            for (var i = 0; i < json.Count; i++)
            {
                using (var writer = new StreamWriter($"Jsons{i + 1}.json"))
                {
                    writer.WriteLine(json[i]);
                }
            }
        }
예제 #10
0
        public static void Search(ISocialNetworkService searcher)
        {
            if (!Directory.Exists(JsonResultFiles))
            {
                Directory.CreateDirectory(JsonResultFiles);
            }

            var users        = searcher.GetUsersAfterCertainDate(2013);
            var postsByUsers = searcher.GetPostsByUser("ZtlKYHVN7h8SwMmaJs");
            var friendships  = searcher.GetFriendships(2, 10);
            var chatUsers    = searcher.GetChatUsers("ZtlKYHVN7h8SwMmaJs");

            var usersJson        = JsonConvert.SerializeObject(users, Formatting.Indented);
            var postsByUsersJson = JsonConvert.SerializeObject(postsByUsers, Formatting.Indented);
            var chatUsersJson    = JsonConvert.SerializeObject(chatUsers, Formatting.Indented);
            var friendshipsJson  = JsonConvert.SerializeObject(friendships, Formatting.Indented);


            var jsons = new List <string>
            {
                usersJson,
                postsByUsersJson,
                chatUsersJson,
                friendshipsJson
            };

            Console.WriteLine("Generating query results into /JsonResults");
            for (int i = 1; i <= jsons.Count; i++)
            {
                var filePath = Path.Combine(JsonResultFiles, string.Format("Result{0}.json", i));

                using (var writer = new StreamWriter(filePath))
                {
                    writer.WriteLine(jsons[i - 1]);
                }
            }
        }