示例#1
0
        public static bool Test_GetRelease()
        {
            try
            {
                GitHubFunctions udp = new GitHubFunctions("TheE7Player", GitHubUpdater.LogTypeSettings.LogStatusOnly);

                /*Bypass the waiting process (FOR TESTING)
                 * Repo t = new Repo();
                 * t.setProject_Name("CSGO-Event-Viewer");
                 * t.setProject_Full_Name ( "TheE7Player/CSGO-Event-Viewer");
                 * t.setProject_URL ( "https://github.com/TheE7Player/CSGO-Event-Viewer");
                 * t.setProject_APIURL ( "https://api.github.com/repos/TheE7Player/CSGO-Event-Viewer");
                 * t.setProject_Description ("A Java project to allow users to see what events you can use with logic_eventlistener");
                 * t.setProject_Language ("Java");
                 * t.setProjects_Creation_Date ("2019-11-16T19:00:17Z");
                 * t.setProjects_Latest_Update_Date ("2019-11-30T16:23:40Z");
                 * t.setProjects_Latest_Push_Date ("2019-11-30T16:23:38Z"); */

                bool          findFiles = true;
                Release[]     r         = ProductComparer.GetUpdates(udp.GetRepository("CSGO-Event-Viewer"), findFiles, 2);
                List <Assets> _files    = null;
                Console.WriteLine(" -- INFORMATION FROM RELEASES -- ");

                if (r is null)
                {
                    return(false);
                }

                foreach (Release a in r)
                {
                    _files = a.Assets; //<- Get files from each release

                    Console.WriteLine($"Release: {a.Name}");
                    Console.WriteLine($"└─ Tag: {a.Tag }");
                    Console.WriteLine($"└─ Url: {a.URL}");
                    Console.WriteLine($"└─ Prerelease: {a.isPreRelease }");

                    Console.WriteLine("└─ Dates:");
                    Console.WriteLine($"     └─ Created Date (When drafted) : { a.Created}");
                    Console.WriteLine($"     └─ Published Date (When visible to public): { a.Published }");

                    Console.WriteLine($"└─ Downloadable files {_files.Count}: ");
                    foreach (Assets x in _files)
                    {
                        Console.WriteLine($"     └─ File { x.itemName } : { x.getItemSize(Assets.DisplaySize.Megabytes) } ({x.getItemSize(Assets.DisplaySize.Kilobytes) }) -> { x.itemDownloadUrl}");
                    }
                }
                Console.WriteLine(" -- INFORMATION FROM RELEASES -- ");

                return((findFiles) ? r != null && _files != null : r != null);
            }
            catch (Exception)
            {
                return(false);
            }
        }