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.");
                }
        }
 private async Task LoadGlobalMusicDataTable()
 {
     if (Utility.GetGlobalMusicDataTable() == null)
     {
         DebugLogger.WriteLine("楽曲テーブルのダウンロード");
         var   tableGet = dataManagerConnector.GetTableAsync();
         await tableGet;
         Utility.SetGlobalMusicDataTable(tableGet.Result.MusicDataTable);
     }
 }
Exemplo n.º 3
0
        private static IMusicDataTable <IMusicDataTableUnit> GetTable(Argument arg)
        {
            using (var connector = new ChunithmMusicDatabaseHttpClientConnector(arg.Host))
            {
                Console.WriteLine("get table...");
                var tableGet = connector.GetTableAsync().Result;
                if (tableGet.Success)
                {
                    Console.WriteLine("success.");
                }
                else
                {
                    Console.WriteLine("failure.");
                }

                return(tableGet.MusicDataTable);
            }
        }
Exemplo n.º 4
0
        public void Call(string[] args)
        {
            var arg = new Argument(args);

            IMusicDataTable <IMusicDataTableUnit> table = null;

            using (var connector = new ChunithmMusicDatabaseHttpClientConnector(arg.DataBaseUrl))
            {
                var tableGet = connector.GetTableAsync().Result;
                table = tableGet.MusicDataTable;
            }

            using (var writer = new StreamWriter(arg.DestinationPath))
            {
                var source = GenerateSource(table, arg.VersionName, arg.TemplateHtmlPath);
                writer.Write(source);
            }
        }
Exemplo n.º 5
0
        // 楽曲テーブルの取得
        private static void GetMusicDataTable()
        {
            if (!UPDATE_HISTORY)
            {
                musicDataTable = new MusicDataTable();
                return;
            }

            using (var databaseConnector = new ChunithmMusicDatabaseHttpClientConnector(""))
            {
                var getTableResult = databaseConnector.GetTableAsync().Result;
                if (!getTableResult.Success)
                {
                    throw new Exception("楽曲テーブルの取得に失敗");
                }
                if (getTableResult.MusicDataTable == null)
                {
                    throw new Exception("楽曲テーブルがnull");
                }
                musicDataTable = new MusicDataTable();
                musicDataTable.Add(getTableResult.MusicDataTable);
                Console.WriteLine("楽曲テーブル取得");
            }
        }
Exemplo n.º 6
0
        private static IMusicDataTable <IMusicDataTableUnit> GetMusicDataTable(string url)
        {
            var connector = new ChunithmMusicDatabaseHttpClientConnector(url);

            return(connector.GetTableAsync().Result.MusicDataTable);
        }