Пример #1
0
        //static object lock_variable = new object();

        /// <summary>
        /// Downloads web page synchronously
        /// </summary>
        /// <param name="url">url of page</param>
        /// <param name="send_cookies">defines if cookies should be sent</param>
        /// <returns>reqest status</returns>
        public bool GetPage(string url, bool send_cookies)
        {
            if (AutoRotateProxy)
            {
                proxy = Proxies.Next();
            }
            int      attempt_count = 1;
            CURLcode rc            = load_page(url, send_cookies);

            while (proxy != null &&
                   (rc == CURLcode.CURLE_GOT_NOTHING ||
                    rc == CURLcode.CURLE_COULDNT_RESOLVE_PROXY ||
                    rc == CURLcode.CURLE_OPERATION_TIMEOUTED ||
                    rc == CURLcode.CURLE_COULDNT_CONNECT ||
                    rc == CURLcode.CURLE_SEND_ERROR)
                   )
            {
                Proxies.Delete(proxy);
                if (attempt_count >= Config.Proxy.MaxAttemptCountWithNewProxy)
                {
                    WR.log.Error("Attempt quota exeeded: " + attempt_count.ToString());
                    break;
                }
                proxy = Proxies.Next();
                attempt_count++;
                WR.log.Write("Attempt #: " + attempt_count.ToString());
                rc = load_page(url, send_cookies);
            }
            return(rc == CURLcode.CURLE_OK);
        }
Пример #2
0
        static void Main(string[] args)
        {
            Proxies.Load();
            if (args.Length < 1)
            {
                Console.WriteLine("No files uploaded. Just Drag'andDrop txt them to this exe file.");
                Console.ReadLine();
                return;
            }
            LoadCfg();
            SetBlackList();
            SetUrlsList(args);

            Console.WriteLine();
            Console.WriteLine("Uploaded file : {0}", args.Length);
            Console.WriteLine("Uploaded line : {0}", _urls.Count);
            Console.WriteLine("Uploaded black list : {0}", _blackList.Count);
            Console.WriteLine();

            StartParsing();
            Save();


            Console.WriteLine();
            Console.WriteLine("Find chat : {0}", _good.Count);
            Console.WriteLine("Channel : {0}", _channels);
            Console.WriteLine("Error : {0}", _errors.Count);

            Console.WriteLine("\n\nPress <Any key> to quit.");
            Console.ReadKey();
        }
Пример #3
0
        public AddProfiler(Global global, Persona persona)
        {
            ProfilerMode        = ProfilerMode.Edit;
            this.persona        = persona;
            this.global         = global;
            addProfileViewModel = new ViewModels.AddProfileViewModel(this, global);

            HashString = persona.HashString;
            Bitmap avaBitmap = AvatarGen.GenerateAvatar(HashString);

            Avatar = GetBitmapImage(avaBitmap);

            view    = new Views.AddProfile(addProfileViewModel);
            Proxies = global.Proxies;

            //нужно сделать, чтобы если на акке был прокси, то его можно было удалить
            if (persona.Proxy != null)
            {
                var pr = Proxies.Where(p => p.Ip == persona.Proxy.Ip && p.Port == persona.Proxy.Port).FirstOrDefault();
                if (pr != null)
                {
                    Proxy = pr;
                }
                else
                {
                    Proxy = persona.Proxy;
                }
            }


            view.ShowDialog();
        }
Пример #4
0
        private string UploadImageToGoogle()
        {
            try
            {
                Console.Write("Trying connection to new proxy: ");
                ReqParametres req = new ReqParametres($"https://www.google.com/searchbyimage?image_url={_imageUrl}");
                req.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.53 Safari/537.36");
                //req.SetProxy(5000, Proxies.GetProxy());
                LinkParser link = new LinkParser(req.Request);
                if (link.IsError)
                {
                    Proxies.DeleteFirstProxy();
                    return(UploadImageToGoogle());
                }

                if (link.Data.ParsFromTo("role=\"heading\"><a href=\"", "\"") == "")
                {
                    Proxies.DeleteFirstProxy();
                    return(UploadImageToGoogle());
                }
                Console.WriteLine("Succes!");
                return("https://www.google.com" + link.Data.ParsFromTo("role=\"heading\"><a href=\"", "\"").Replace("amp;", ""));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Proxies.DeleteFirstProxy();
                return(UploadImageToGoogle());
            }
        }
Пример #5
0
        public static bool InitialiseServerSettings(ServerSettings serverSettings, out string errorMessage)
        {
            errorMessage = string.Empty;
            bool   succeeded       = true;
            string _settingSection = PluginMain._settingSection;

            try
            {
                Proxies.Initialize(serverSettings, true);
                using (Settings xmlwriter = new MPSettings())
                {
                    xmlwriter.SetValue(_settingSection, TvHome.SettingName.MacAddresses, serverSettings.WakeOnLan.MacAddresses);
                    xmlwriter.SetValue(_settingSection, TvHome.SettingName.IPAddress, serverSettings.WakeOnLan.IPAddress);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.IsSingleSeat, IsThisASingleSeatSetup(serverSettings.ServerName));
                }
            }
            catch (ArgusTVNotFoundException ex)
            {
                errorMessage = ex.Message;
                succeeded    = false;
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
                succeeded    = false;
            }
            return(succeeded);
        }
Пример #6
0
        private void LoadProxy_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog
            {
                Filter           = "Text files (*.txt)|*.txt",
                InitialDirectory = Directory.GetCurrentDirectory()
            };

            if (openFileDialog.ShowDialog() == true)
            {
                var filePath = openFileDialog.FileName;
                var fileText = File.ReadAllText(filePath);
                var proxies  = fileText.ParsRegex("[0-9.]{9,}:[0-9]{3,}");
                if (proxies.Count == 0)
                {
                    MessageBox.Show("В указанном файле не обнаружены прокси.\nПопробуйте загрузить другой файл.");
                    return;
                }

                Proxies.Login    = Login.Text;
                Proxies.Password = Password.Text;
                Proxies.AddProxies(proxies);
                MessageBox.Show("Прокси-файл успешно загружен!");
                LoadProxy.IsEnabled     = false;
                StartWatching.IsEnabled = true;
                ManualCheck.IsEnabled   = true;
            }
        }
Пример #7
0
        public TelegramChecker(string url, int reconnects)
        {
            triesToConnect = reconnects;
            Url            = url;
            LinkParser linkParser = null;

            do
            {
                ReqParametres req = new ReqParametres(url);
                _currentProxy = Proxies.GetProxy();
                req.SetProxy(_currentProxy);
                req.SetTimout(8000);
                linkParser = new LinkParser(req.Request);
            }while (triesToConnect-- > 0 && linkParser.IsError);

            if (!linkParser.IsError)
            {
                string title = linkParser.Data.ParsFromTo("<title>", "</title>");
                string data  = linkParser.Data.ParsFromTo("<div class=\"tgme_page_extra\">", "</div>");
                SetType(title, data);
                SetMembers(data);
                Proxies.ReturnProxie(_currentProxy);
            }
            else
            {
                IsError = true;
            }
        }
Пример #8
0
        public override void RemoveProxy(IWebProxy webProxy)
        {
            lock (_proxiesLock)
            {
                if (webProxy == null || Proxies == null)
                {
                    return;
                }

                Queue <IWebProxy> proxies = new Queue <IWebProxy>();

                int proxiesCount = Proxies.Count;

                while (Proxies.Count != 0)
                {
                    IWebProxy webProxy2 = Proxies.Dequeue();

                    if (webProxy != webProxy2)
                    {
                        proxies.Enqueue(webProxy2);
                    }
                }

                _proxies = proxies;
            }
        }
Пример #9
0
 public MainViewModel()
 {
     _userAgent = new UserAgent("useragents.xml");
     _proxy     = new Proxies("proxies.csv");
     _process   = new ProcessViewModel(null);
     _cts       = new CancellationTokenSource();
 }
Пример #10
0
 /// <summary>
 /// Resets the properties to their default value.
 /// </summary>
 public void Reset()
 {
     General.Reset();
     Proxies.Reset();
     Captchas.Reset();
     Selenium.Reset();
 }
Пример #11
0
        private static async Task <byte[]> DownloadAndSaveImage(string url, Proxies proxyInfos)
        {
            var attempt = 0;
            var result  = new byte[0];
            var proxies = ProxyDistributor.GetProxies(proxyInfos.Infos);

            foreach (var proxy in proxies)
            {
                attempt++;
                try {
                    result = await DoDownloadImage(url, proxy);

                    Statistics.Info($"{proxy?.Url ?? "self"} {url} Ok");
                    SaveImage(url, result);
                    return(result);
                }
                catch (Exception e) {
                    if (e.Message.Contains("(Not Found)"))
                    {
                        Statistics.Info($"{proxy?.Url ?? "self"} {url} NotFound");
                        return(GetNotFound());
                    }
                    Statistics.Info($"{proxy?.Url ?? "self"} {url} Error");
                    Logger.Error(e, $"{url} {attempt} attempt");
                    if (e is UnknownImageFormatException)
                    {
                        File.WriteAllBytes($"logs/data/{url.Split('/').ToList().LastOrDefault() ?? "null"}", result);
                    }
                }
            }

            return(GetNotFound());
        }
Пример #12
0
        protected override void Dispose(bool disposing)
        {
            // If you need thread safety, use a lock around these
            // operations, as well as in your methods that use the resource.
            if (Disposed)
            {
                return;
            }

            // If disposing equals true, dispose all managed
            // and unmanaged resources.
            if (disposing)
            {
                // Dispose managed resources.
                if (Proxies != null)
                {
                    Proxies.Dispose();
                }

                // Call the appropriate methods to clean up
                // unmanaged resources here.
                // If disposing is false,
                // only the following code is executed.
            }

            // Indicate that the instance has been disposed.
            Proxies  = null;
            Disposed = true;
        }
Пример #13
0
        public Release(Release other)
        {
            Name        = other.Name;
            Footsite    = other.Footsite;
            ProductLink = other.ProductLink;
            Category    = other.Category;

            foreach (string keyWord in other.KeyWords)
            {
                KeyWords.Add(keyWord);
            }

            Style       = other.Style;
            GlobalProxy = other.GlobalProxy != null ? new Proxy(other.GlobalProxy) : null;

            foreach (ReleaseCheckoutProfile profile in other.Profiles)
            {
                Profiles.Add(new ReleaseCheckoutProfile(profile));
            }

            foreach (Proxy proxy in other.Proxies)
            {
                Proxies.Add(new Proxy(proxy));
            }
        }
Пример #14
0
        public void RemoteBrowserMobProxyInstanceList()
        {
            //Assemble
            IRestRequest req      = null;
            var          portList = new List <int> {
                9001, 9002, 9003
            };
            var proxyList = new Proxies()
            {
                ProxyList = portList.Select(p => new PortDetails()
                {
                    Port = p
                }).ToList()
            };

            _restClientMoq.Setup(x => x.Execute <Proxies>(It.IsAny <IRestRequest>()))
            .Callback <IRestRequest>(request => req = request)
            .Returns(new RestResponse <Proxies> {
                Data = proxyList
            });

            var list = _remoteBrowserMobProxyClient.RemoteBrowserMobProxyInstances();

            //Assert
            _restClientMoq.Verify(x => x.Execute <Proxies>(It.IsAny <IRestRequest>()), Times.Once);

            Assert.AreEqual(Method.GET, req.Method);
            Assert.IsEmpty(req.Parameters);

            CollectionAssert.AreEqual(portList, list.Select(x => x.Port));
        }
Пример #15
0
        private void _okButton_Click(object sender, EventArgs e)
        {
            try
            {
                _serverSettings.ServerName = _serverTextBox.Text.Trim();
                ServiceTransport transport = ServiceTransport.Http;
                if (_transportComboBox.SelectedIndex == 1)
                {
                    transport = ServiceTransport.Https;
                }
                _serverSettings.Transport                = transport;
                _serverSettings.Port                     = (int)_portNumericUpDown.Value;
                _serverSettings.WakeOnLan.Enabled        = _useWolCheckBox.Checked;
                _serverSettings.WakeOnLan.TimeoutSeconds = (int)_wolSecondsNumericUpDown.Value;

                bool doConnect = true;

                if (_serverSettings.Transport == ServiceTransport.Https)
                {
                    using (LogonForm logonForm = new LogonForm())
                    {
                        logonForm.UserName       = _serverSettings.UserName;
                        logonForm.Password       = _serverSettings.Password;
                        doConnect                = (DialogResult.OK == logonForm.ShowDialog(this));
                        _savePassword            = logonForm.SavePassword;
                        _serverSettings.UserName = logonForm.UserName;
                        _serverSettings.Password = logonForm.Password;
                    }
                }

                if (doConnect)
                {
                    try
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        Proxies.Initialize(_serverSettings, true);

                        if (_saveAsProfileCheckBox.Checked)
                        {
                            _profileName = _profileNameTextBox.Text.Trim();
                        }
                        else
                        {
                            _profileName = null;
                        }
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    finally
                    {
                        Cursor.Current = Cursors.Default;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #16
0
 /// <summary>
 /// Fires the event.
 /// </summary>
 public override void Fire()
 {
     if (NaoState.Instance.Connected)
     {
         Proxies.GetProxy <Aldebaran.Proxies.TextToSpeechProxy>().say(ExitMessage);
     }
     Environment.Exit(0);
 }
Пример #17
0
        private static void InitializeServiceChannelFactories()
        {
            ServerSettings serverSettings = new ServerSettings();

            serverSettings.ServerName = Properties.Settings.Default.ArgusTVServerName;
            serverSettings.Port       = Properties.Settings.Default.ArgusTVPort;
            Proxies.Initialize(serverSettings, false);
        }
Пример #18
0
        private void explainLeftArm(Proxies Proxies)
        {
            Proxies.TextToSpeechProxy.post.say("Bring your left hand slightly forward");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART1_LEFT_ARM);
            Proxies.TextToSpeechProxy.post.say("Then bring your left hand next to your upper body");

            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART2_LEFT_ARM);
            Proxies.TextToSpeechProxy.say("It is that simple!");
        }
Пример #19
0
 public void Add(Proxy proxy)
 {
     lock (Proxies)
     {
         Proxies.Add(proxy);
         LastUpdated.Add(proxy.Session.Id, new Record());
     }
     SessionRepository.AddSession(proxy.Session);
 }
Пример #20
0
 public void SetProxyAsRemoved(WebProxyHolder holder)
 {
     foreach (var proxyViewModel in Proxies.Where(proxyViewModel => proxyViewModel.Proxy == holder))
     {
         proxyViewModel.Remove = true;
         break;
     }
     CurrentProxyCount--;
 }
Пример #21
0
        public override void Explain(Proxies Proxies)
        {
            this.NumberOfTimesExplained++;

            Proxies.TextToSpeechProxy.post.say("Move your left hand forward.");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_LEFT_HAND_PUNCH_FORWARD);
            Proxies.TextToSpeechProxy.post.say("And then move it backward.");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_LEFT_HAND_PUNCH_BACKWARD);
        }
Пример #22
0
        public override void Explain(Proxies Proxies)
        {
            this.NumberOfTimesExplained++;

            Proxies.TextToSpeechProxy.post.say("Move your left hand forward.");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_LEFT_HAND_PUNCH_FORWARD);
            Proxies.TextToSpeechProxy.post.say("And then move it backward.");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_LEFT_HAND_PUNCH_BACKWARD);
        }
Пример #23
0
 private void UpdateProxyList()
 {
     Proxies.Clear();
     Proxies.Add(new ProxyViewModel());
     foreach (ProxyInfo proxyInfo in _proxyRegistry.Proxies)
     {
         Proxies.Add(new ProxyViewModel(proxyInfo));
     }
 }
Пример #24
0
        public static void Update(Configuration config, bool forceDisable, PACServer pacSrv, bool noRetry = false)
        {
            bool global  = config.global;
            bool enabled = config.enabled;

            if (forceDisable)
            {
                enabled = false;
            }

            try
            {
                if (enabled)
                {
                    if (global)
                    {
                        Sysproxy.SetIEProxy(true, true, "localhost:" + config.localPort.ToString(), null);
                    }
                    else
                    {
                        string pacUrl;
                        if (config.useOnlinePac && !config.pacUrl.IsNullOrEmpty())
                        {
                            pacUrl = config.pacUrl;
                        }
                        else
                        {
                            pacUrl = pacSrv.PacUrl;
                        }
                        Sysproxy.SetIEProxy(true, false, null, pacUrl);
                    }
                }
                else
                {
                    Sysproxy.SetIEProxy(false, false, null, null);
                    Proxies.UnsetProxy();
                }
            }
            catch (ProxyException ex)
            {
                Logging.LogUsefulException(ex);
                if (ex.Type != ProxyExceptionType.Unspecific && !noRetry)
                {
                    var ret = MessageBox.Show(I18N.GetString("Error occured when process proxy setting, do you want reset current setting and retry?"), I18N.GetString("Shadowsocks"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (ret == DialogResult.Yes)
                    {
                        Sysproxy.ResetIEProxy();
                        Update(config, forceDisable, pacSrv, true);
                    }
                }
                else
                {
                    MessageBox.Show(I18N.GetString("Unrecoverable proxy setting error occured, see log for detail"), I18N.GetString("Shadowsocks"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #25
0
 public void Init()
 {
     foreach (var result in ParaGenerator.Generate())
     {
         var p = new Proxy();
         p.UnsafeDictDeserialize(result);
         Proxies.Add(p);
     }
     ;
 }
Пример #26
0
 private void Form1_Load(object sender, EventArgs e)
 {
     UserSettings.GenerateSettings();
     GeneratedSettings.SetFilePaths();
     GeneratedSettings.SetHashFiles();
     Chat.SetRichTextBox(this.chatBox);
     Proxies.ImportProxylist();
     CDKeys.ImportCdKeys();
     ConnectedBar.Reference(this.labelConnectedForecolor);
 }
Пример #27
0
 public Proxy this[string id]
 {
     get
     {
         lock (Proxies)
         {
             return(Proxies.FirstOrDefault(x => x.Session.Id == id));
         }
     }
 }
Пример #28
0
        private bool SetAndConnect(bool test)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                ServerSettings serverSettings = new ServerSettings();
                serverSettings.ServerName = _serverHttpsTextBox.Text.Trim();
                if (!String.IsNullOrEmpty(serverSettings.ServerName))
                {
                    serverSettings.Port      = (int)_portHttpsNumericUpDown.Value;
                    serverSettings.Transport = ServiceTransport.Https;
                    serverSettings.UserName  = _userNameTextBox.Text;
                    serverSettings.Password  = _passwordTextBox.Text;

#if DEBUG
                    if (serverSettings.ServerName == "localhost")
                    {
                        serverSettings.Port     += 2;
                        serverSettings.Transport = ServiceTransport.Http;
                    }
#endif
                    Proxies.Initialize(serverSettings, true);

                    Config.Current.ServerName   = serverSettings.ServerName;
                    Config.Current.Port         = serverSettings.Port;
                    Config.Current.MacAddresses = serverSettings.WakeOnLan.MacAddresses;
                    Config.Current.IpAddress    = serverSettings.WakeOnLan.IPAddress;
                    Config.Current.UserName     = serverSettings.UserName;
                    Config.Current.Password     = serverSettings.Password;
                }
                else
                {
                    Config.Current.ServerName = String.Empty;
                    Config.Current.Port       = ServerSettings.DefaultHttpsPort;
                }
                return(true);
            }
            catch (ArgusTVNotFoundException ex)
            {
                if (MessageBox.Show(this, ex.Message, null, test ? MessageBoxButtons.OK : MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    return(!test);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Failed to connect to ARGUS TV." + Environment.NewLine + Environment.NewLine + ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
            return(false);
        }
Пример #29
0
 public void SetProxylist(List <Proxy> proxies, bool join)
 {
     if (join)
     {
         Proxies.AddRange(proxies);
     }
     else
     {
         Proxies = proxies;
     }
 }
Пример #30
0
 /// <summary>
 /// remove all null value from proxies list
 /// </summary>
 public static void RemoveAllNullValue()
 {
     Proxies.RemoveAll(_ =>
     {
         if (_ == null)
         {
             return(true);
         }
         return(false);
     });
 }
Пример #31
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Grabber()
 {
     NaoState.Instance.OnConnect    += BuildCameraAndProcessor;
     NaoState.Instance.OnDisconnect += ClearCameraAndProcessor;
     if (NaoState.Instance.Connected)
     {
         BuildCameraAndProcessor(NaoState.Instance.IP.ToString(), NaoState.Instance.Port);
     }
     motion  = Proxies.GetProxy <MotionProxy>();
     posture = Proxies.GetProxy <RobotPostureProxy>();
 }
Пример #32
0
        public override void Explain(Proxies Proxies)
        {
            this.NumberOfTimesExplained++;

            //Proxies.TextToSpeechProxy.say("This motion is called the " + this.Name);

            // First step.
            Proxies.TextToSpeechProxy.post.say("You move your right hand forward");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_RIGHT_HAND_PUNCH_FORWARD);

            // Second step .
            Proxies.TextToSpeechProxy.post.say("And then move your right hand back");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_RIGHT_HAND_PUNCH_BACKWARD);
        }
Пример #33
0
        public NaoTeacher(Preferences Preferences, Proxies Proxies, Scenario Scenario)
        {
            this.Preferences = Preferences;
            this.Proxies = Proxies;
            this.Scenario = Scenario;

            this.NaoCommenter = new NaoCommenter(this.Proxies);

            this.CurrentTrial = 0;

            // Create thread.
            this.Worker.DoWork += Run;
            this.Worker.WorkerSupportsCancellation = true;
        }
Пример #34
0
        public override void Explain(Proxies Proxies)
        {
            this.NumberOfTimesExplained++;

            Proxies.TextToSpeechProxy.post.say("This motion is called " + this.Name + ", it is used to block an incoming kick");
            this.PerformDefault(Proxies);
            Proxies.TextToSpeechProxy.say("I will break it down for you in three steps");

            explanation(Proxies);

            if (NumberOfTimesExplained > 1)
            {
                Proxies.TextToSpeechProxy.post.say("I already explained this motion but I see you do not yet really get this motion, let me explain both arms seperately");
                Proxies.BehaviorManagerProxy.runBehavior("naos-life-channel/stand_scratchHead1");
                explainLeftArm(Proxies);
                explainRightArm(Proxies);
                Proxies.TextToSpeechProxy.say("By combining these motions you get this.");
                this.PerformDefault(Proxies);

                Proxies.TextToSpeechProxy.say("Do you understand this motion now?");
                string choicePositiveNegative = Proxies.KinectSpeechRecognition.WaitForChoice(KinectSpeechRecognition.CHOICES_POSITIVE_NEGATIVE);

                switch (choicePositiveNegative)
                {
                    case KinectSpeechRecognition.CHOICE_POSITIVE:
                        Proxies.TextToSpeechProxy.say("Alright, then let's continue");
                        break;
                    case KinectSpeechRecognition.CHOICE_NEGATIVE:
                    default:
                        Proxies.TextToSpeechProxy.say("Too bad, are you having trouble with your left or your right arm?");

                        string choiceLeftRight = Proxies.KinectSpeechRecognition.WaitForChoice(KinectSpeechRecognition.CHOICES_LEFT_RIGHT);
                        switch (choiceLeftRight)
                        {
                            case KinectSpeechRecognition.CHOICE_LEFT:
                                explainLeftArm(Proxies);
                                break;
                            case KinectSpeechRecognition.CHOICE_RIGHT:
                            default:
                                explainRightArm(Proxies);
                                break;
                        }
                        break;
                }
            }
        }
Пример #35
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="Proxies"></param>
 /// <param name="KinectSpeechRecognition"></param>
 public NaoCommenter(Proxies Proxies)
 {
     this.Proxies = Proxies;
 }
Пример #36
0
 /*
 public void override DeterminePerformance(List<Skeleton> skeletons)
 {
     base.DeterminePerformance(skeletons);
     this.Performance *= 1.5;
 }
  * */
 public override void PerformDefault(Proxies Proxies)
 {
     Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI);
 }
 /// <summary>
 /// Initialises a new instance of the <see cref="SalutationViewModel" /> class.
 /// </summary>
 /// <param name="model"><see cref="SalutationModel" /> object.</param>
 public SalutationViewModel(Proxies.Models.SalutationModel model)
 {
     this.Text = model.Text;
     this.Value = model.Value;
 }
Пример #38
0
 public override void PerformDefault(Proxies Proxies)
 {
     Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_RIGHT_HAND_CONTINUOUS_PUNCH);
 }
Пример #39
0
 public override void GiveFeedback(Proxies Proxies)
 {
     Proxies.TextToSpeechProxy.say("Pay attention to your right hand, you need to stretch it out completely.");
 }
Пример #40
0
 public override void GiveFeedback(Proxies Proxies)
 {
     Proxies.TextToSpeechProxy.say("Pay attention to your right hand, remember that you need to rotate it during the performance.");
 }
Пример #41
0
 /// <summary>
 /// Sets the 'InitialLocation' attached property on the specified proxy.
 /// </summary>
 /// <param name="paneProxy">The <see cref="SplitPaneProxy"/> on which the property value is set.</param>
 /// <param name="value">The value set on the proxy.</param>
 public static void SetInitialLocation(SplitPaneProxy paneProxy, Proxies.Docking.InitialPaneLocation value)
 {
     paneProxy.SetValue(InitialLocationProperty, value);
 }
Пример #42
0
        private void explanation(Proxies Proxies)
        {
            // First step.
            Proxies.TextToSpeechProxy.say("Bring your right hand towards your left ear.");
            Proxies.TextToSpeechProxy.say("While moving your right hand you also need to move your left arm forward.");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART1);
            Proxies.TextToSpeechProxy.say("");

            // Second step.
            Proxies.TextToSpeechProxy.say("Then more your right hand forward in a sweeping motion, while bringing your left hand next to your upper body.");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART2);

            // Third step.
            Proxies.TextToSpeechProxy.post.say("Make your to rotate your right hand during this motion.");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART3);
        }
Пример #43
0
        private void explainRightArm(Proxies Proxies)
        {
            // First step.
            Proxies.TextToSpeechProxy.post.say("Bring your right hand towards your left ear");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART1_RIGHT_ARM);

            // Second step.
            Proxies.TextToSpeechProxy.say("Now more your right hand forward in a sweeping motion");
              //  Proxies.TextToSpeechProxy.say("Here we go!");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART2_RIGHT_ARM);

            // Third step.
               // Proxies.TextToSpeechProxy.say("There is something important about your right hand");
            Proxies.TextToSpeechProxy.say("Make your to rotate your right hand while doing this");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART3);
        }
Пример #44
0
        private void explainLeftArm(Proxies Proxies)
        {
            Proxies.TextToSpeechProxy.post.say("Bring your left hand slightly forward");
            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART1_LEFT_ARM);
            Proxies.TextToSpeechProxy.post.say("Then bring your left hand next to your upper body");

            Proxies.BehaviorManagerProxy.runBehavior(NaoBehaviors.BEHAVIOR_GEDAN_BARAI_PART2_LEFT_ARM);
            Proxies.TextToSpeechProxy.say("It is that simple!");
        }