Exemplo n.º 1
0
        public bool SubmitRun(
            IRun run,
            string username, string password,
            Func <Image> screenShotFunction = null,
            bool attachSplits   = false,
            TimingMethod method = TimingMethod.RealTime,
            string gameId       = "", string categoryId = "",
            string version      = "", string comment    = "",
            string video        = "", params string[] additionalParams)
        {
            if (!IsLoggedIn)
            {
                if (!VerifyLogin())
                {
                    return(false);
                }
            }

            TwitchGame game = null;

            try
            {
                var gameList = FindGame(run.GameName);

                game = gameList.First(twitchGame => twitchGame.Name == run.GameName);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                bool resolved = false;

                do
                {
                    try
                    {
                        var dialog = new TwitchGameResolveDialog(run.GameName);
                        var result = dialog.ShowDialog();
                        if (result != DialogResult.OK)
                        {
                            return(false);
                        }
                        else if (dialog.Game != null)
                        {
                            game = dialog.Game;
                        }
                        resolved = true;
                    }
                    catch (Exception exc)
                    {
                        Log.Error(exc);
                    }
                } while (!resolved);
            }

            SetStreamTitleAndGame(comment, game);

            return(true);
        }
Exemplo n.º 2
0
        public bool SubmitRun(
            IRun run,
            string username, string password,
            Func<Image> screenShotFunction = null,
            bool attachSplits = false,
            TimingMethod method = TimingMethod.RealTime,
            string gameId = "", string categoryId = "",
            string version = "", string comment = "",
            string video = "", params string[] additionalParams)
        {
            if (!IsLoggedIn)
            {
                if (!VerifyLogin())
                    return false;
            }

            string game = "";

            try
            {
                var gameList = FindGame(run.GameName);
                if (gameList.Contains(run.GameName))
                    game = run.GameName;
                else
                    game = gameList.First();
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                bool resolved = false;

                do
                {
                    try
                    {
                        var dialog = new TwitchGameResolveDialog(run.GameName);
                        var result = dialog.ShowDialog();
                        if (result != DialogResult.OK)
                        {
                            return false;
                        }
                        else if (dialog.GameName != null)
                        {
                            var gameList = FindGame(dialog.GameName);
                            if (gameList.Contains(dialog.GameName))
                                game = dialog.GameName;
                            else
                                game = gameList.First();
                        }
                        resolved = true;
                    }
                    catch (Exception exc)
                    {
                        Log.Error(exc);
                    }
                } while (!resolved);
            }

            SetStreamTitleAndGame(comment, game);

            return true;
        }