示例#1
0
        public bool SetState(string line)
        {
            //Parse Command Line args
            _commandArgs = new commandArgs();
            // migrate T381 T390
            var argsList  = line.Split(' ');
            var lineSplit = argsList.ToList().FindAll(s => !s.ToLower().Contains("setstores") && !string.IsNullOrEmpty(s)).ToList();

            if (lineSplit.Count != 3)
            {
                Console.WriteLine("usage migrate [From TitleId] [To TitleId]");
                _state = States.Complete;
                return(false);
            }
            _commandArgs.FromTitleId = lineSplit[1];
            _commandArgs.ToTitleId   = lineSplit[2];

            //SetUp Data Objects
            _titleData         = new TitleDataMigration();
            _titleInternalData = new TitleDataMigration();
            _currencyData      = new CurrencyDataMigration();
            _cloudScriptData   = new CloudScriptDataMigration();
            _cdnData           = new CdnFileDataMigration();
            _catalogData       = new CatalogDataMigration();
            _droptableData     = new DropTableDataMigration();
            _storeData         = new StoreDataMigration
            {
                StoreList = PlayFabService.Settings.StoreList
            };

            SetNextState();
            return(false);
        }
        public bool SetState(string line)
        {
            _state = States.Working;
            //Parse Command Line args
            _commandArgs = new commandArgs();
            // migrate T381 T390
            var argsList  = line.Split(' ');
            var lineSplit = argsList.ToList().FindAll(s => !s.ToLower().Contains("setstores") && !string.IsNullOrEmpty(s)).ToList();

            if (lineSplit.Count != 3)
            {
                Console.WriteLine("usage migrate [From TitleId] [To TitleId]");

                _state = States.Failed;
                return(false);
            }
            _commandArgs.FromTitleId = lineSplit[1];
            _commandArgs.ToTitleId   = lineSplit[2];

            Console.WriteLine("Migration Started");

            Task.Run(async() => {
                try {
                    await MigrateTitleData(_commandArgs.FromTitleId, _commandArgs.ToTitleId);
                    await MigrateInternalTitleData(_commandArgs.FromTitleId, _commandArgs.ToTitleId);
                    await MigrateCurrencyAsync(_commandArgs.FromTitleId, _commandArgs.ToTitleId);
                    await MigrateCloudScriptAsync(_commandArgs.FromTitleId, _commandArgs.ToTitleId);
                    await MigrateCatolgItems(_commandArgs.FromTitleId, _commandArgs.ToTitleId);
                    await MigrateStores(_commandArgs.FromTitleId, _commandArgs.ToTitleId, PlayFabService.Settings.StoreList);
                    await MigrateDropTables(_commandArgs.FromTitleId, _commandArgs.ToTitleId);

                    await Task.Delay(10);
                } catch {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("\nMigration FAILED");
                    Console.ForegroundColor = ConsoleColor.White;
                    _state = States.Failed;
                }
                if (_state != States.Failed)
                {
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("\nMigration Completed");
                    _state = States.Complete;
                }
            });

            return(false);
        }