コード例 #1
0
        public void Call(string[] args)
        {
            var arg = new Argument(args);

            var musicDataTable = new MusicDataTable();

            using (var connector = new ChunithmNetHttpClientConnector())
                using (var databaseConnector = new ChunithmMusicDatabaseHttpClientConnector(arg.DataBaseUrl))
                {
                    var currentTable = databaseConnector.GetTableAsync().GetMusicDatabaseApiResult("get current table... ");

                    connector.LoginAsync(arg.SegaId, arg.Password).GetNetApiResult("login... ");
                    connector.SelectAimeAsync(arg.AimeIndex).GetNetApiResult("selecting aime... ");

                    var musicGenre = connector.GetMusicGenreAsync(GENRE_CODE_ALL, Difficulty.Master).GetNetApiResult("downloading music list... ");
                    musicDataTable.Add(musicGenre.MusicGenre);

                    if (currentTable.MusicDataTable.GetTableUnits().Count() == musicDataTable.GetTableUnits().Count())
                    {
                        Console.WriteLine("skip update.");
                        return;
                    }

                    for (var i = 0; i < arg.MaxLevelValue; i++)
                    {
                        var musicLevel = connector.GetMusicLevelAsync(i).GetNetApiResult($"downloading level info ({i + 1}/{arg.MaxLevelValue})", false);
                        musicDataTable.Add(musicLevel.MusicLevel);
                    }

                    databaseConnector.UpdateTableAsync(musicDataTable.MusicDatas).GetMusicDatabaseApiResult("sending table... ");

                    Console.WriteLine("completed.");
                }
        }
コード例 #2
0
        public void Call(string[] args)
        {
            var arg = new Argument(args);

            var genres = new List <string>();

            using (var connector = new ChunithmNetHttpClientConnector())
            {
                connector.LoginAsync(arg.SegaId, arg.Password).Wait();
                var selectAime = connector.SelectAimeAsync(arg.AimeIndex);
                if (!selectAime.Result.Success)
                {
                    throw new Exception("Failed to login.");
                }

                var musicGenre = connector.GetMusicGenreAsync(Utility.GENRE_ALL_CODE, Difficulty.Master).Result;
                foreach (var unit in musicGenre.MusicGenre.Units)
                {
                    if (!genres.Contains(unit.Genre))
                    {
                        genres.Add(unit.Genre);
                    }
                }
            }

            var genreListText = new StringBuilder();

            genreListText.Append("[");
            for (var i = 0; i < genres.Count; i++)
            {
                if (i > 0)
                {
                    genreListText.Append(',');
                }
                genreListText.Append('"');
                genreListText.Append(genres[i]);
                genreListText.Append('"');
            }
            genreListText.Append("]");
            Console.WriteLine(genreListText.ToString());
        }