Inheritance: MonoBehaviour
示例#1
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var first  = user.ReadInput("Enter First as int").AsInt;
            var tagIds = new List <string>(user.ReadInputWhileBreakAsString("Enter Tag Id"));

            string cursor = null;

            while (true)
            {
                var tags = handler.API.New.Tags.GetAllStreamTags(cursor, first, tagIds);

                foreach (var tag in tags.Tags)
                {
                    user.SendMessage();
                    user.SendMessage($"Id={tag.Id}");
                    user.SendMessage($"    IsAuto={tag.IsAuto}");
                    user.SendMessage($"    Name={(tag.LocalizationNames.TryGetValue("ko-kr", out var name) ? name : null)}");
                    user.SendMessage($"    Description={(tag.LocalizationDescriptions.TryGetValue("ko-kr", out var description) ? description : null)}");
                }

                cursor = tags.Pagination.Cursor;

                if (string.IsNullOrWhiteSpace(cursor) == true)
                {
                    break;
                }

                Thread.Sleep(1000);
            }
        }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        float scroll = Input.GetAxis("Mouse ScrollWheel");

        if (scroll != 0)
        {
            if (scroll > 0)
            {
                if (TestMain.GetCamera().orthographicSize > 25)
                {
                    TestMain.GetCamera().orthographicSize -= 5;
                }
            }
            else
            {
                if (TestMain.GetCamera().orthographicSize < 200)
                {
                    TestMain.GetCamera().orthographicSize += 5;
                }
            }
        }
        bool[] currMouseDown = new bool[] { Input.GetMouseButtonDown(0), Input.GetMouseButtonDown(1) };
        if (currMouseDown[0] || currMouseDown[1])
        {
            m_mode[(int)currMode].OnClick(currMouseDown);
        }
        else
        {
            m_mode[(int)currMode].OnHover();
        }
        if (!mapLoaded)
        {
            mapLoaded = TestMain.GetMap().ExtendBound(ref bottomLeft, ref topRight);
        }
    }
示例#3
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var options = new TwitchGetTopClipsOptions();

            options.Channel = user.ReadInput("Enter Channel").AsString;
            options.Game    = user.ReadInput("Enter Game").AsString;
            options.Languages.AddRange(user.ReadInputWhileBreakAsString("Enter Language"));
            options.Limit    = user.ReadInput("Enter Limit as long").AsLong;
            options.Period   = user.QueryInput("Enter Channel", TopClipsPeriod.Register, null, true).Value;
            options.Trending = user.ReadInput("Enter Trending as bool").AsBool;

            while (true)
            {
                var clips = handler.API.V5.Clips.GetTopClips(options);
                options.Cursor = clips.Cursor;

                user.SendMessageAsReflection("TopClips", clips);

                if (string.IsNullOrWhiteSpace(options.Cursor) == true)
                {
                    break;
                }
                else if (user.ReadBreak() == true)
                {
                    break;
                }
            }
        }
示例#4
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="N15InsideForm"/>
        /// </summary>
        public N15InsideForm()
        {
            this.InitializeComponent();
            N15InsideParameters.ParameterChanged += RefreshFormElements;
            RefreshFormElements();

            if (ParametersConfig.IsTesting)
            {
                N15InsideParameters.TestModuleRef = this;
                N15InsideParameters.Action       += TestMain.Action;
            }

            LearnMain.form = this;
            switch (LearnMain.getIntent())
            {
            case ModulesEnum.H15Inside_open_from_H15:
                if (LearnMain.globalIntent == GlobalIntentEnum.OneChannel)
                {
                    LearnMain.setIntent(ModulesEnum.H15Inside_power);
                }
                break;
            }
            switch (TestMain.getIntent())
            {
            case ModulesEnum.H15Inside_open_from_H15:
                //if (TestMain.globalIntent == GlobalIntentEnum.OneChannel)
                //{
                TestMain.setIntent(ModulesEnum.H15Inside_power);
                //}
                break;
            }
        }
示例#5
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var channelId = user.ReadInput("Enter Channel Id").AsString;
            var limit     = user.ReadInput("Enter Limit as int").AsInt;
            var offset    = user.ReadInput("Enter Offset as int").AsInt;
            var direction = user.QueryInput("Enter Direction", SortDirection.Tags, null, true).Value;

            string cursor = null;

            while (true)
            {
                var channelFollowers = handler.API.V5.Channels.GetChannelFollowers(channelId, limit, offset, cursor, direction);
                user.SendMessageAsReflection("ChannelFollowers", channelFollowers);

                offset = null;
                cursor = channelFollowers.Cursor;

                if (string.IsNullOrWhiteSpace(cursor) == true)
                {
                    break;
                }

                Thread.Sleep(1000);
            }
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var requests = new List <UserRequest>();

            while (true)
            {
                var typeInput = user.QueryInput("Enter UserType", UserRequestType.Tags, null, true);

                if (typeInput.Breaked == true)
                {
                    break;
                }

                var request = new UserRequest();
                request.Type  = typeInput.Value;
                request.Value = user.ReadInput($"Enter User{request.Type}").AsString;

                requests.Add(request);
            }

            var api    = handler.API;
            var tusers = api.New.Users.GetUsers(requests);

            user.SendMessageAsReflection("Users", tusers);
        }
示例#7
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="PowerCabelForm"/>
        /// </summary>
        public PowerCabelForm()
        {
            InitializeComponent();
            PowerCabelParameters.ParameterChanged += RefreshFormElements;
            PowerCabelParameters.СтанцияСгорела   += ВыводСообщенияСтанцияСгорела;

            if (ParametersConfig.IsTesting)
            {
                PowerCabelParameters.TestModuleRef = this;
                PowerCabelParameters.Action       += TestMain.Action;
            }

            this.RefreshFormElements();

            if (LearnMain.getIntent() == ModulesEnum.openPowerCabeltoPower)
            {
                LearnMain.setIntent(ModulesEnum.PowerCabelConnect);
                LearnMain.form = this;
                LearnMain.Action();
            }

            if (TestMain.getIntent() == ModulesEnum.openPowerCabeltoPower)
            {
                TestMain.setIntent(ModulesEnum.PowerCabelConnect);
                IsExactModule = true;
            }
        }
示例#8
0
 /// <summary>
 /// Закрытие формы внутренней части блока
 /// </summary>
 /// <param name="sender">Объет вызвавший событие</param>
 /// <param name="e">Событие закрытия формы</param>
 private void N15InsideForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     N15InsideParameters.ParameterChanged -= RefreshFormElements;
     if (ParametersConfig.IsTesting)
     {
         N15InsideParameters.Action -= TestMain.Action;
     }
     switch (TestMain.getIntent())
     {
     case ModulesEnum.H15Inside_power:
         if (N15InsideParameters.ПереключательПУЛ480ПРМ_1 == 3 &&
             N15InsideParameters.ПереключательПУЛ480ПРМ_2 == 3 &&
             N15InsideParameters.ПереключательПУЛ48ПРД_1 == 3 &&
             N15InsideParameters.ПереключательПУЛ48ПРД_2 == 3 &&
             N15InsideParameters.ТумблерПУЛ480ПРМ_1 == Модуляция.ОФТ &&
             N15InsideParameters.ТумблерПУЛ480ПРМ_2 == Модуляция.ОФТ &&
             N15InsideParameters.ТумблерПУЛ48ПРД_1 == Модуляция.ОФТ &&
             N15InsideParameters.ТумблерПУЛ48ПРД_2 == Модуляция.ОФТ)
         {
             //TestMain.setIntent(ModulesEnum.N15);
             //TODO: доделать переход на н15
         }
         break;
     }
     Owner.Show();
 }
示例#9
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var options = new TwitchGetClipsOptions();

            options.BroadcasterId = user.ReadInput("Enter BroadcasterId").AsString;
            options.GameId        = user.ReadInput("Enter GameId").AsString;
            options.Ids.AddRange(user.ReadInputWhileBreakAsString("Enter Id"));
            options.First     = user.ReadInput("Enter First as int").AsInt;
            options.StartedAt = TwitchDateTimeUtils.ToDatetime(user.ReadInput("Enter StartedAt as TwtichDateTime").AsString);
            options.EndedAt   = TwitchDateTimeUtils.ToDatetime(user.ReadInput("Enter EndedAt as TwtichDateTime").AsString);

            string cursor = null;

            while (true)
            {
                options.After = cursor;
                var clips = handler.API.New.Clips.GetClips(options);
                user.SendMessageAsReflection("Clips", clips);

                cursor = clips.Pagination.Cursor;

                if (string.IsNullOrWhiteSpace(cursor) == true)
                {
                    break;
                }

                Thread.Sleep(1000);
            }
        }
示例#10
0
    protected virtual void Initialise()
    {
        Canvas     canvas    = TestMain.GetCanvas();
        GameObject canvasObj = new GameObject();

        m_item = new MenuItem[0];
    }
示例#11
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var first = user.ReadInput("Enter First as int").AsInt;

            string after  = null;
            string before = null;

            while (true)
            {
                var topGames = handler.API.New.Games.GetTopGames(after, before, first);
                user.SendMessageAsReflection("TopGames", topGames);

                after  = null;
                before = null;
                var index = user.QueryInput("Select Direction", new string[] { "after", "before" }, null, true).Index;

                if (index == -1)
                {
                    break;
                }
                else if (index == 0)
                {
                    after = topGames.Pagination.Cursor;
                }
                else
                {
                    before = topGames.Pagination.Cursor;
                }
            }
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var first  = user.ReadInput("Enter First as int").AsInt;
            var fromId = user.ReadInput("Enter From Id, show followings").AsString;
            var toId   = user.ReadInput("Enter To Id, show followers").AsString;

            var    api    = handler.API;
            string cursor = null;

            while (true)
            {
                var userFollows = api.New.Users.GetUserFollows(cursor, first, fromId, toId);
                user.SendMessageAsReflection("UserFollows", userFollows);

                cursor = userFollows.Pagination.Cursor;

                if (string.IsNullOrWhiteSpace(cursor) == true)
                {
                    break;
                }

                //Thread.Sleep(1000);
            }
        }
示例#13
0
        private void VoltageStabilizerForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            VoltageStabilizerParameters.ParameterChanged            -= RefreshFormElements;
            VoltageStabilizerParameters.ОператорСтанцииПораженТоком -= ВыводСообщенияОператорСтанцииПоражёнТоком;

            if (ParametersConfig.IsTesting)
            {
                VoltageStabilizerParameters.Action -= TestMain.Action;
            }

            if ((LearnMain.getIntent() == ModulesEnum.VoltageStabilizerSetUp) &&
                (VoltageStabilizerParameters.КабельВход > 0))
            {
                LearnMain.setIntent(ModulesEnum.openN502BtoPower);
            }
            else
            {
                LearnMain.setIntent(ModulesEnum.openVoltageStabilizer);
            }

            if ((TestMain.getIntent() == ModulesEnum.VoltageStabilizerSetUp) &&
                (VoltageStabilizerParameters.КабельВход > 0))
            {
                TestMain.setIntent(ModulesEnum.openN502BtoPower);
            }
            else
            {
                TestMain.setIntent(ModulesEnum.openVoltageStabilizer);
            }
        }
示例#14
0
        public void Class_DBlink()
        {
            var dblink         = new TestMain();
            var dblinkexpected = "ture";
            var dblinkfunction = dblink.Dblinkmethod();

            Assert.AreEqual(dblinkexpected, dblinkfunction);
        }
示例#15
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var tuser = handler.API.V5.Users.GetUser();

            user.SendMessageAsReflection("User", tuser);
        }
示例#16
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var set = handler.API.Other.BadgesTwitchTV.GetGlobalBadges();

            user.SendMessageAsReflection("Badges", set);
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var followedStreams = handler.API.V5.Streams.GetFollowedStreams();

            user.SendMessageAsReflection("FollowedStreams", followedStreams);
        }
示例#18
0
        public MainForm()
        {
            InitializeComponent();

            tm = new TestMain();
            tm.MainForm = this;

            this.toolStripMenuItem1.PerformClick();
        }
示例#19
0
        private void ВыводСообщенияНекорректноеДействие()
        {
            MessageBox.Show("Некорректное действие!", "ОШИБКА");

            if (ParametersConfig.IsTesting)
            {
                TestMain.MakeSoftMistake();
            }
        }
示例#20
0
        private void ВыводСообщенияСтанцияСгорела()
        {
            MessageBox.Show("Станция сгорела!", "ОШИБКА");

            if (ParametersConfig.IsTesting)
            {
                TestMain.MakeBlunderMistake();
            }
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var channelId = user.ReadInput("Enter Channel Id").AsString;
            var teams     = handler.API.V5.Channels.GetChannelTeams(channelId);

            user.SendMessageAsReflection("Teams", teams);
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var teamName        = user.ReadInput("Enter TeamName").AsString;
            var teamAndChannels = handler.API.V5.Teams.GetTeam(teamName);

            user.SendMessageAsReflection("TeamAndChannels", teamAndChannels);
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var channelId = user.ReadInput("Channel Id").AsString;
            var set       = handler.API.Other.BadgesTwitchTV.GetChannelBadges(channelId);

            user.SendMessageAsReflection("Badges", set);
        }
示例#24
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var channelId = user.ReadInput("Enter ChannelId (Empty is global)").AsString;
            var actions   = handler.API.V5.Bits.GetCheermotes(channelId);

            user.SendMessageAsReflection("Actions", actions);
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var slug = user.ReadInput("Enter Slug").AsString;
            var clip = handler.API.V5.Clips.GetClip(slug);

            user.SendMessageAsReflection("Clip", clip);
        }
示例#26
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var broadcasterId = user.ReadInput("Enter Broadcaster Id").AsString;
            var tagsId        = user.ReadInputWhileBreakAsString("Enter Tag Id");

            handler.API.New.Tags.ReplaceStreamTags(broadcasterId, tagsId);
        }
示例#27
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var userId = user.ReadInput("Enter UserId").AsString;
            var set    = handler.API.V5.Users.GetUserEmotes(userId);

            user.SendMessageAsReflection("EmoticonSet", set);
        }
示例#28
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var emoteIds = user.ReadInputWhileBreakAsString("Enter Emote Id");
            var emotes   = handler.API.Other.TwitchEmotesAPI.GetEmotes(emoteIds);

            user.SendMessageAsReflection("Emotes", emotes);
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var channelName = user.ReadInput("Enter Channel Name").AsString;
            var set         = handler.API.Other.CbenniAPI.GetBadges(channelName);

            user.SendMessageAsReflection("Badges", set);
        }
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var description = user.ReadInput("Enter Descrption").AsString;
            var tuser       = handler.API.New.Users.UpdateUser(description);

            user.SendMessageAsReflection("User", tuser);
        }
示例#31
0
        public override void Run(TestMain main)
        {
            var user    = main.User;
            var handler = main.TwitchAPIHandler;

            var userId = user.ReadInput("Enter User Id").AsString;
            var tuser  = handler.API.V5.Users.GetUserByID(userId);

            user.SendMessageAsReflection("User", tuser);
        }
示例#32
0
        /// <summary>
        /// Linq2SQL 基本功能测试
        /// 
        /// 基本的 查询 / 插入 / 更新 / 删除 处理.
        /// 
        /// </summary>
        private static void BaseTest()
        {
            Test context = new Test(connString);






            // 单表查询
            var query =
                from testMain in context.TestMain
                select testMain;
            foreach (TestMain main in query)
            {
                Console.WriteLine("Main[{0}, {1}]", main.Id, main.Value);
            }

            // 关联查询
            var query2 =
                from testSub in context.TestSub
                where testSub.TestMain.Value == "ONE"
                select testSub;
            foreach (TestSub sub in query2)
            {
                Console.WriteLine("Sub[{0}, {1}]", sub.Id, sub.Value);
            }

            // 插入.
            TestMain main3 = new TestMain();
            main3.Id = 3;
            main3.Value = "Three";
            context.TestMain.InsertOnSubmit(main3);
            context.SubmitChanges();

            Console.WriteLine("INSERT FINISH! --- Please Press Enter Ket");
            Console.ReadLine();

            // 更新.
            var newTestMain =
                (from testMain in context.TestMain
                 where testMain.Id == 3
                 select testMain).First();
            newTestMain.Value = "Three3";
            context.SubmitChanges();

            Console.WriteLine("UPDATE FINISH!  --- Please Press Enter Ket");
            Console.ReadLine();


            // 单表查询 TOP 2
            var queryTop2 =
                (from testMain in context.TestMain
                 orderby testMain.Id descending
                 select testMain).Take(2);

            foreach (TestMain main in queryTop2)
            {
                Console.WriteLine("Main[{0}, {1}]", main.Id, main.Value);
            }

            // 删除.
            context.TestMain.DeleteOnSubmit(newTestMain);
            context.SubmitChanges();

            Console.WriteLine("DELETE FINISH! --- Please Press Enter Ket");
            Console.ReadLine();

        }
示例#33
0
        /// <summary>
        /// 事务处理的测试.
        /// 
        /// 隐式创建事务
        /// 
        /// </summary>
        private static void TransactionTest()
        {
            // 在我们没有显式的开启事务时,
            // DataContext.SubmitChanges在提交时会隐式创建事务

            Test context = new Test(connString);

            try
            {

                // 插入.
                TestMain main3 = new TestMain();
                main3.Id = 3;
                main3.Value = "Three";
                context.TestMain.InsertOnSubmit(main3);


                TestMain main3x = new TestMain();
                main3x.Id = 3;
                main3x.Value = "Three Err";
                context.TestMain.InsertOnSubmit(main3x);


                context.SubmitChanges();

            }
            catch (Exception err)
            {
                Console.WriteLine(err.ToString());              
            }


            var query =
               from testMain in context.TestMain
               where testMain.Id == 3
               select testMain;

            Console.WriteLine("TestMain 表中, id=3 的记录有{0}条 ", query.Count());


        }