Exemple #1
0
        public async Task <ConfigRES> Get()
        {
            Universal universal = new Universal();
            ConfigRES configRES = await universal.GET <ConfigRES>("config", false);

            if (string.IsNullOrEmpty(configRES.apiKey))
            {
                currentApiKey = configRES.apiKey;
                Console.WriteLine($"Changed ApiKey to: '{configRES.apiKey}'");
                Console.WriteLine();
            }
            if (currentApiKey != configRES.apiKey)
            {
                currentApiKey = configRES.apiKey;
                Console.WriteLine($"Changed ApiKey to: '{configRES.apiKey}'");
                Console.WriteLine();
            }

            Console.WriteLine($"{configRES.appName}");
            Console.WriteLine($"Current APIKey: {configRES.apiKey}");
            Console.WriteLine();

            return(configRES);
        }
Exemple #2
0
        public async Task MainAsync()
        {
            string username; string password;
            var    loginFile = new FileInfo("login.txt");

            if (loginFile.Exists)
            {
                Console.WriteLine($"Reading login info from {loginFile.Name}");
                var lines = File.ReadAllLines(loginFile.FullName);
                username = lines[0]; password = lines[1];
            }
            else
            {
                Console.WriteLine("Username:"******"Password:"******"Is banned");
                }

                if (inErrorState)
                {
                    await Task.Delay(3000);
                }
            }
            ConfigRES configRES = await client.Config.Get();

            if (!inErrorState)
            {
                if (!txt_path.Exists || !json_path.Exists)
                {
                    return;
                }
                var txt_avis = txt_path.ReadAllLines().ToList().Where(l => !string.IsNullOrWhiteSpace(l)).Select(l => l.Trim()).ToList();
                Console.WriteLine($"Read {txt_avis.Count} avatars from {txt_path.FullName.Quote()}");
                var json_avis = JsonConvert.DeserializeObject <List <SavedAvi> >(json_path.ReadAllText());
                Console.WriteLine($"Read {json_avis.Count} avatars from {json_path.FullName.Quote()}");
                foreach (var avi in txt_avis)
                {
                    try
                    {
                        var hasAvi = json_avis.Where(a => a.AvatarID == avi).FirstOrDefault();
                        if (hasAvi is null)
                        {
                            AvatarRES aRES = await client.Avatars.GetSingle(avi);

                            Console.WriteLine(aRES.ToJSON());
                            json_avis.Add(new SavedAvi()
                            {
                                Name = aRES.name, AvatarID = avi, ThumbnailImageUrl = aRES.thumbnailImageUrl
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        json_avis.Add(new SavedAvi()
                        {
                            Name = avi, AvatarID = avi, ThumbnailImageUrl = ""
                        });
                        // Console.ReadLine();
                    }
                }
                json_avis = json_avis.OrderByDescending(a => a.Name).ToList();
                var json = JsonConvert.SerializeObject(json_avis, Formatting.Indented);
                Console.WriteLine(json);
                Console.ReadKey();
                json_path.WriteAllText(json);
            }
        }
Exemple #3
0
        public async Task MainAsync()
        {
            Console.Title = "VRChatAPIdotNET";

            apiMenu = new List <string>()
            {
                "1. Grab Avatar by ID",
                "2. Grab Avatars",
                "3. Grab World by ID",
                "4. Grab Worlds",
                "5. Grab World Instance",
                "6. Grab World Metadata",
                "7. Grab User by ID",
                "8. Grab Users",
                "9. Grab User by name M1",
                "10. Grab User by name M2",
                "11. Grab Favorite by ID",
                "12. Grab Favorites",
                "13. Post new Favorite",
                "14. Grab Friends",
                "15. Send Friendrequest by ID",
                "16. Accept Friendrequest by ID",
                "17. Delete Friend by ID",
                "18. Grab Moderations",
                "19. Grab Moderations against other Users",
                "20. Grab Moderations against me",
                "21. Grab Notifications",
                "22. Send Invite",
                "23. Send Message",
                "24. Send Votekick M1",
                "25. Send Votekick M2",
                "26. Grab current VRChat Config",
                "27. Register an Account (obsolete)",
                "28. Update Accountinfo",
                "29. Get Discord Names",
                "Exit"
            };

            while (currentUser == null)
            {
                Console.Clear();

                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("If you are banned, please restart this program\nafter you're done looking at your moderations.\n");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(seperator);

                string username; string password;
                var    loginFile = new FileInfo("login.txt");
                if (loginFile.Exists)
                {
                    Console.WriteLine($"Reading login info from {loginFile.Name}");
                    var lines = File.ReadAllLines(loginFile.FullName);
                    username = lines[0]; password = lines[1];
                }
                else
                {
                    Console.WriteLine("Username:"******"Password:"******"{x.ip}\n{x.reason}\n{x.created}\n{x.expires}\n"); });
                }

                if (inErrorState)
                {
                    await Task.Delay(3000);
                }
            }

            Console.WriteLine(seperator);

            ConfigRES configRES = await client.Config.Get();

            Console.WriteLine(seperator);

            if (!inErrorState)
            {
                Console.WriteLine("Switching to Main Menu..");

                await Task.Delay(2500);

                Console.Clear();

                while (true)
                {
                    Console.Title = "VRChatAPIdotNET - Main Menu";
                    selected      = drawMenu(apiMenu);
                    if (selected == apiMenu[0])
                    {
                        await DoGetAvatarByID();
                    }
                    else if (selected == apiMenu[1])
                    {
                        await DoGetAvatars();
                    }
                    else if (selected == apiMenu[2])
                    {
                        await DoGetWorldByID();
                    }
                    else if (selected == apiMenu[13])
                    {
                        await DoGrabFriends();
                    }
                    else if (selected == apiMenu[26])
                    {
                        await DoRegisterAccount();
                    }
                    else if (selected == apiMenu[28])
                    {
                        await DoGetFriendsDiscord();
                    }
                    else if (selected == "Exit")
                    {
                        Environment.Exit(0);
                    }
                }
            }
        }